A Dev Container Template for TypeScript and Express.js

Learn how to create a template for a development container for TypeScript and Express.js. Plus a bonus for your npm-based projects!

Manfred Lange
11 min readApr 30

--

Github repository configured to be a template

Introduction

In previous articles I have described how to set up a dev container for TypeScript (see “Creating a Dev Container for TypeScript and VS Code”, “TypeScript Dev Container Revisited: The February 2023 Edition”). The result is a template repository on github that makes it easy to create and start up a dev container with the basic dev tools preinstalled that you may need.

In this article I will take the concept one step further. This time, I will add everything needed to get a basic express.js application running. This will also serve as a building block to build an OpenID Connect (OIDC) example in a future article.

The usual pre-requisites for this article are:

  1. VS Code
  2. VS Code Extension “Remote Development”
  3. Git CLI
  4. Docker Desktop

As always, the entire source code for this article is available under the generous MIT license at https://github.com/RimuTec/dev-container-express.js-2023

At the end of this article, we will have a new template that we can then use as a starting point for express.js based apps, either for a micro service or for serving a web application.

Also, as a bonus, I’ll share a technique for keeping npm packages up-to-date with the option to automate it.

Let us get started!

Using the TypeScript Dev Container Template

To get started quickly, I will not set up the dev container from scratch. Instead, I will use a template to create the initial source code. In this case I am going to use the template at https://github.com/RimuTec/dev-container-typescript This gives me most of the boilerplate code and requires just a few small adjustments before we can get to the meaty bits.

Go to the template repo on github, click on “Use this template” and then “Create a new repository”:

--

--

Manfred Lange

CTO at MacroActive https://www.macroactive.com. I write about improving flow of value in software engineering. LinkedIn https://www.linkedin.com/in/manfredlange