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: https://github.com/tomanagle/Typegoose-example

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.

How…


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⭐: https://github.com/tomanagle/GraphQL-NestJS-MongoDB-TypeScript-Tutorial

⚠️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: https://github.com/tomanagle/google-oauth-tutorial

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: https://github.com/tomanagle/deno-http-servers

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…


Imagine coming across the same problem multiple times and having to re-develop a solution for it every time. That would be exhausting, it may even be confusing for those around you and your solution would never get the chance to be optimised. Instead, we use patterns to solve problems. In everyday life we call these heuristics, in software development we call them design patterns.

The design patterns in this post have examples in this repository: https://github.com/tomanagle/JavaScript-design-patterns

Please submit pull requests if you would like to add a pattern or make a change to an existing pattern.

In software development, a…


Companies around the world are reducing their payroll or pivoting, increasing the pressure of development teams to produce features. As developers, we don’t just want to produce features like a canned soup factory, we want to produce products that we’re proud of and our customers love.

Code quality is important, for your developers, your quality assurance (QA) team, and most importantly, your customers. Maintaining a high level of code quality means:

  • Developers can maintain velocity as the codebase grows.
  • QA team keeps a steady stream of features flowing from development into production.
  • Most importantly, it means your customers have a…

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