There are a few genuine concerns with Vapor but I honestly don't think any of these are very relevant.

Vendor lock in is not an issue I've ever run into anywhere and its generally more expensive to maintain vendor agnostic applications than it is to re-write parts of your code to move vendor.

Centralisation is a funny one. The beauty about lambda is you pay per execution. That means you can literally deploy your application to every single AWS region and have it cost exactly the same as if you'd only deployed in a single region. It would be a…

Data Access Layer

Zentrum Paul Klee Museum by Ricardo Gomez Angel

There’s no incredible insights here, no hot takes and nothing worthy of applause. It’s a simple rule that I follow on every SPA I build — regardless of size. To me, this is obvious and make sense. I cannot conceive of maintaining an application without having a dedicated Data Access Layer (DAL). I consistently see the same problems occur when people access API’s directly from their components. A DAL is a titanium bullet solution (silver bullets don’t exist) that squashes all of these issues at once.

Data Access Layer may not be technically the correct term, but the interpretation in…

AWS CDK

This is a very short, un-paywalled survivorship guide to using the AWS CDK with TypeScript and node ESM.

TL;DR: ts-node fails when there are ES modules in the dependency graph (not specific to CDK but you need it to run cdk synth).

If you are using ESM you should already have "type": "module" in your package.json

If you’ve used the CLI to add the CDK to a TypeScript project you will get a generated file cdk.ts that looks something like this

If you run cdk synth you are likely to get the following error

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension…

Refactoring JavaScript: Collection Pipelines

Photo by Jonathan Fox on Unsplash

I recently started writing about refactoring JavaScript to use Collection Pipelines instead of loops. I make a pretty bold claim that this will lead to cleaner code, what I haven’t done yet is make a clear argument for why I think this leads to cleaner code.

To me, there is something truly satisfying in taking a collection of arbitrary objects, piping it through a series of individual transformations and filters and getting a new collection out the other side. Seeing a workflow broken down into discrete, often single-line steps, with no side effects is great way to write code.

Functional Building Blocks

map()

An introduction to the unknown type: a better any

Photo by Nicolas Lobos on Unsplash.

TypeScript code around the world is littered with the any type, and it drives me absolutely crazy. There is no (valid) reason to use it in application code, and you are opting out of the safety of a static type system.

Many developers who are new (or not so new to TypeScript) assume that when you don’t know what type you are going to get, you should type it with any. TypeScript’s official documentation also tells you that this is not the case:

“Don’t use any as a type unless you are in the process of migrating a JavaScript project…

Refactoring JavaScript: Collection Pipelines (Example)

This is part of a series called “Refactoring Javascript: Collection Pipelines.” You can read the introduction here.

In a previous article, I gave an introduction to the power of reduce(), however, I didn’t really highlight it’s potential with a real world example.

In this article we will solve the Canva technical challenge using a single reduce function.

Note: In the event that Canva is still using this question to screen candidates, be aware that they use HackerRank to check for plagiarism, don’t try to submit this answer.

The Challenge

The task is to write an algorithm that takes two parameters. The first…

Refactoring JavaScript: Collection Pipelines (Part 2)

This is part of a series called “Refactoring Javascript: Collection Pipelines.” You can read the introduction here.

In a previous article, I showed how simple collection pipelines can simplify the readability of your code with an example of IP validation.

const validateIP = (ip: string): boolean => {
const numbers = ip.split('.');
return numbers.length === 4
&& numbers
.filter((x) => Number(x).toString() === x)
.map((x) => parseInt(x, 10))
.filter((x) => x >= 0 && x <= 255)
.length === 4;
};

This code is nice because it breaks each step of the validation down into a single step. Each step pipes…

Refactoring Javascript: Collection Pipelines

This is the first post in a series of posts about refactoring your Javascript code to use map, filter and reduce instead of loops. I refer to this style of programming as Collection Pipelines as I was first introduced to this concept in Martin Fowler’s Refactoring.

One of the first control structures we learn as programmers is loops. …

Gitlab CI/CD pipelines

Serverless framework is an amazing tool and I’m very bullish on the future of serverless development. For all the amazing content out there for serverless, there isn’t a lot on how to build CI/CD pipelines for serverless projects — so here we go.

In this tutorial, we are going to use Gitlab pipelines because I’m a huge fan of Gitlab. The same template can be used to guide pipelines with Bitbucket, Azure, or any other provider. I’m going to assume next to no knowledge about setting up CI/CD so hopefully anyone can follow along. …

At some point in your serverless journey you’ll no doubt utilise DynamoDB. You’ll also probably want to be able to write integration tests against it. In this post we’ll go through the basics of getting an offline environment set up for testing, in a future post i’ll walk you through the couple of lines of code that needs to change if you want to utilise DynamoBBStreams (seperate post for SEO and maximum help for anyone debugging the issue).

Configuring serverless-dynamodb-local

We’ll begin by building on top of the serverless template I wrote about previously which can be found on github here. Whether…

Michael Timbs

Full-stack developer. In love with Typescript and Serverless

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store