RETROSPECTIVE

November 15th, 2021

Building a Web Application with React and TypeScript

React

TypeScript

+5 More

I recently rewrote my web application saintsxctf.com using React and TypeScript. This article looks at how the application is configured and walks through some React code. All the code for the website exists in a GitHub repository.

RETROSPECTIVE

November 1st, 2021

SaintsXCTF Version 2.0: React Web Application Overview

React

Redux

+3 More

At its core, SaintsXCTF is a web application that allows users to log their running workouts, openly express how they felt while running, and encourage and support teammates. From a user perspective, the website is the most important part of the SaintsXCTF technology stack, since it is what they interact with every day and depend on being operational.

When I wrote the first version of the saintsxctf.com website, I was a senior in college who just began learning web development. I was also new to user interface (UI) design and user experience (UX) design. Over time, this inexperience became more and more apparent when viewing the first version of the website and its underlying code. While designing the second version of the website, I knew not only did I need to follow best engineering practices, but I also had to make an elegant user interface.

RETROSPECTIVE

October 25th, 2021

SaintsXCTF Version 2.0: Kubernetes Infrastructure

Kubernetes

AWS EKS

+5 More

The infrastructure for the React/TypeScript frontend and Flask/Python backend for my website saintsxctf.com is hosted on Kubernetes. My Kubernetes infrastructure is hosted on a cluster, which is managed by AWS EKS. This article outlines the Kubernetes infrastructure and walks through Terraform code which configures and builds the infrastructure.

RETROSPECTIVE

October 19th, 2021

Creating a Go Module for Reusable Test Functions

Go

Kubernetes

Recently I wrote tests for my Kubernetes infrastructure in Go. These tests are split across multiple different repositories. However, there is a lot of overlap in testing logic between the test suites in each repository. In attempts to follow good programming practices and keep my code DRY, I split out the common code between the repositories into reusable functions. These functions exist in their own Go module, which is imported into the test suites as a dependency.

Go modules are part of Go's dependency management system1. They consist of a collection of packages, which are defied in a go.mod file. Go modules can be used as dependencies in other modules, as is the case with my reusable test function module and my Kubernetes test modules.

RETROSPECTIVE

October 10th, 2021

Writing Kubernetes Tests with Go

Kubernetes

Go

+2 More

These days, most of my application infrastructure exists on Docker containers, orchestrated by Kubernetes. My AWS account has a Kubernetes cluster, which is hosted using EKS (Elastic Kubernetes Service). Since two of my production applications (jarombek.com and saintsxctf.com) run on this Kubernetes cluster, the health of their infrastructure is critical. To help ensure that the Kubernetes cluster is running properly, I created tests which check the state of my Kubernetes objects and ensure that they exist on the EKS cluster as expected.

This article explores my Kubernetes test suite, which is written in Go and leverages the Kubernetes Go Client. It also describes how the test suite is run on an automated schedule, alerting me when test failures occur.

RETROSPECTIVE

September 24th, 2021

Creating Reverse Proxies with Nginx and Docker

Nginx

Docker

+2 More

Many of my applications contain frontend components and API components. These two components are loosely coupled but communicate with each other over HTTPS. For example, my saintsxctf.com application has a React frontend which communicates with a Flask REST API backend, along with other API Gateway REST APIs. One way to accomplish communication from a frontend to an API is by explicitly writing the URLs of the APIs in the frontend code. This works fine, but it also exposes information about API origin servers to clients. Origin server information exposure can be avoided by passing all API traffic through the same URL as the frontend application. This is accomplished using a reverse proxy.

The following image shows my SaintsXCTF website, and how the URL of the API is hidden from clients. If users inspect the website's network traffic, they see HTTPS requests sent to the reverse proxy server for saintsxctf.com, instead of the actual API server api.saintsxctf.com.

DISCOVERY

August 11th, 2021

Building Cypress End to End Tests in TypeScript

Cypress

TypeScript

JavaScript

Cypress is an end to end (e2e) testing framework written in JavaScript for front-end applications. Cypress tests run in a Chrome web browser or a headless browser, navigating through and interacting with web pages. It's reasonable to compare Cypress to other test automation frameworks such as Selenium or Puppeteer; however, unlike those frameworks, Cypress was created specifically for writing end to end tests. Because of its test first design, Cypress provides lots of features that make writing end to end tests easy. It is currently my preferred end to end testing tool.

While Cypress tests can be written in JavaScript, as is the case with my jarombek.com application, Cypress also has TypeScript support. Nowadays, I write most of my front-end applications in TypeScript due to its type safety. In my experience, TypeScript helps reduce the number of bugs and type mismatch mistakes in JavaScript code. For applications written in TypeScript, it is great to be able to write Cypress tests in TypeScript as well. This helps keep the programming language uniform across the front-end application code and test code.

DISCOVERY

August 2nd, 2021

Writing Less Stylesheets

Less

CSS

Sass

When it comes to CSS preprocessors (stylesheet languages that add features on top of CSS and transpile to CSS), in the past I've often used Sass. When I first started learning about CSS preprocessors, the two main choices were Sass and Less. The reason I decided to learn Sass instead of Less was due to its greater popularity and me trying to follow industry trends. At the time, Bootstrap had just released version 4, which switched its stylesheet language from Less to Sass1. In my mind, it didn't make sense for me to learn a preprocessor language that was being left in the dust.

Over time, I increasingly wished to learn the difference between Sass and Less. It was hard for me to tell if there were differences in the functionality of Sass or Less, or if Sass was picked as the favorite due to syntactical preferences and third-party library support. Last year I wrote two front-end application prototypes, graphql-react-prototype and apollo-client-server-prototype. Instead of using a stylesheet technology I already knew such as Sass or JSS, I decided to learn Less and use it as the stylesheet language for these prototypes.

RETROSPECTIVE

July 31st, 2021

Building a GraphQL React Prototype

GraphQL

React

+5 More

Last year, I started using GraphQL at my job. I decided to create some GraphQL prototypes in my spare time, to get better acquainted with the GraphQL ecosystem. In 2018 I learned the basics of GraphQL and wrote two articles about my experience, but never dove into using GraphQL in real world applications. The GraphQL React prototype discussed in this article along with my Apollo prototype are the beginnings of that production application journey. In the future, I plan on using GraphQL for the API layer of my applications.

The GraphQL prototype discussed in this article is a React front-end application that connects to a GitHub GraphQL API. The API provides details about my repositories, and React displays those details in a dashboard. The dashboard is shown below.

DISCOVERY

July 26th, 2021

Creating AWS CloudWatch Synthetics Canary Functions with Terraform

AWS CloudWatch

AWS

+6 More

AWS CloudWatch Synthetic Monitoring is a platform that enables the creation of functions that monitor applications or APIs. These functions are known as canary functions, and they use AWS Lambda for their infrastructure. Canary functions are written in JavaScript or Python. They utilize Puppeteer (JavaScript) and Selenium (Python) for browser test automation.

I started looking into Synthetic Monitoring as a way to test my SaintsXCTF application running in production. I had an issue where the website unexpectedly stopped working, and there was no automated process in place to alert me. With Synthetic Monitoring, I created canary functions to test critical paths of the website, such as signing in a user. If canary functions fail, I get an email alerting me of the issue.

DISCOVERY

July 3rd, 2021

Exploring AWS DynamoDB

DynamoDB

AWS

+7 More

DynamoDB is a NoSQL database on AWS specializing in key-value and document storage. DynamoDB is fully managed by AWS, meaning users don't need to provision any servers for it to run on. I often compare DynamoDB to MongoDB, due to their similar functionality and JSON document/item structure.

Recently, DynamoDB has come up quite a bit in engineering conversations I've had in relation to building cloud native applications. I wrote a series of articles on MongoDB in 2017 while I was prototyping with the database. Recently I did the same with DynamoDB, creating a sample DynamoDB table with Terraform and using AWS SDKs to modify and test its contents. This article discusses what I've learned about DynamoDB and showcases my prototype code.

DISCOVERY

June 30th, 2021

Styling React Components With JSS

JSS

React

+3 More

In my previous article on JSS, I discussed the improvements JSS makes over traditional CSS stylesheets and CSS preprocessors such as Sass. JSS utilizes the highly expressive JavaScript language, enables style reusability, dynamic styling, and provides name conflict resolution. Although JSS works with any front-end framework or library, it really shines when paired with React. In this article, I begin by discussing the basics of JSS in React applications. Then, I show sample code from my SaintsXCTF application, which is running in production and utilizes JSS for its stylesheets.