In this article, you will learn how to do the easiest Node.js deployment you have ever seen. The application will be deployed with Docker, docker-compose & Caddy Server onto a DigitalOcean droplet.

This guide could be used to deploy a Node.js application onto any VPC, such as Amazon EC2, Linode, even a Raspberry Pi.

GitHub repository:

The diagram below visualizes what you will build as a result of following this guide. Requests will come into the VPC, in this case, a DigitalOcean droplet, they will hit the Docker application running Caddy. Caddy will reverse proxy the request to…

In this guide, we are going to build a REST API with Node.js, TypeScript, and MongoDB. This guide is for junior to mid-level developers that want to build APIs like a senior developer.

Finished repository:

Postman collection:

Note: This guide uses commands like mkdir and touch. For those that are unfamiliar, mkdir will make a new directory and touch will create a new file. These commands will work on a Mac or Linux OS, but will not work on a Windows machine as far as I’m aware.

Note 2: For the best learning outcome, watch the video…

In my previous article, we looked at how we can integrate Mongoose and TypeScript to create strongly typed models manually. In this article, you will learn how to create Mongoose models & TypeScript types simultaneously with Typegoose.

See final repository:

What’s the problem?

Often, the data shapes used throughout our applications start at the model level. We then replicate these data shapes with TypeScript so we can represent the data through the application. Typegoose aims to eliminate the need to create our data shapes in both Mongoose & TypeScript and keep the shapes synchronized throughout the development lifecycle.


In this guide, we will be building a GraphQL API with NestJS. NestJS is a NodeJS framework designed for building scalable, efficient, and reliable applications. The framework is open-source and has easy to follow documentation.

As a result of following this guide, you will have a GraphQL API built on top of NestJS that can be deployed in a Docker container. The GraphQL layer will be developed with TypeGraphQL, reducing the need for TypeScript & GraphQL boilerplate.

⭐You can find the finished repository here⭐:

⚠️Warning⚠️: NestJS comes with a lot of boilerplate. If you haven't used it before, you…

Almost every NodeJS developer would be familiar with the error message Error listen EADDRINUSE: address already in use. The message simply means that the application could not start because there is already a process using that port. Here is the easiest way I have found to stop a process running on your Mac that is using a specific port.

  1. Add a new file called stop to this directory: usr/local/bin

You can easily do this by typing: usr/local/bin/stop

2. Past the following script into the file:

3. Save the script and start using it

You can use the script by…

In a previous post, we explored how to integrate TypeScript with your Mongoose models. In this post, we’ll move up to the service layer and see how we can use Mongoose types to get even more out of your application's Mongoose & Typescript implementations.

Firstly let’s answer some basic questions about the service layer: what is a service layer and how do I use it?

The service layer is used to encapsulate implementations of an application’s business logic and provide an API for invocation of that logic in a consistent way.

Services are functions that perform common tasks on your…

Have you got several projects on the go that you’ll probably never finish? Yeah, me too. In this post, I will go through what I did to successfully develop and launch my latest side project. As a result of reading, I hope to inspire you to finish developing and launch one of your side projects.

Since I started working from home and haven’t been able to leave the house for anything non-essential, I have gained a lot of time and a nice home office setup.

Around the start of April, I made a conscious decision to spend my time creating…

In this post, you will learn how OAuth integrations work and specifically how you can set up a Google OAuth integration with your own Node.js application.

GitHub repository:

Note: This guide does not use Passport

How does OAuth work?

Setting up an OAuth integration for the first time can be a little confusing. Luckily, most OAuth integrations, including Google, follow the same flow:

  1. Provide the user with a link to the authentication system that includes what data you’d like the user to give your application access to (scopes), your client ID, and a redirect URL
  2. When the user clicks the link and grants…

Deno’s growth has started to accelerate at an unprecedented rate. Partly because the creator is Ryan Dhal and partly because the JavaScript runtime looks extremely promising. Already, we have several different ways to create an HTTP server, the base for almost every modern application.

In this article we will explore five ways to create a HTTP server with Deno, using the standard library and four packages.

You can find all the code here:

Note: None of these solutions is a great choice for a brand new application. Deno is not ready for you to risk your job with, so…

In 2018, Ryan Dahl, the creator of Node.js, presented at JSConf on 10 things he regrets about Node.js. In the presentation, Dahl confessed that he couldn’t change Node.js now - It runs on millions of machines worldwide and is loved by millions of developers. So what do you do when you can’t change the old version? You move some of the letters around and create a brand new language.

In May 2020, Ryan Dahl, Bert Belder, and Bartek Iwańczuk announced Deno 1.0.

What’s the same as Node.js?

In the 2019 Stackoverflow developer survey, 50.4% of professional developers said they use Node.js. There’s a good…

Tom Nagle

I am a full stack JavaScript developer, living in Melbourne, Australia. My preferred stack is Mongoose, TypeScript, Node.js, React & GraphQL.

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