Node.js language-specific guide

Node.js is a JavaScript runtime for building web applications. This guide shows you how to containerize a TypeScript Node.js application with a React frontend and PostgreSQL database.

The sample application is a modern full-stack Todo application featuring:

  • Backend: Express.js with TypeScript, PostgreSQL database, and RESTful API
  • Frontend: React.js with Vite and Tailwind CSS 4

Acknowledgment

Docker extends its sincere gratitude to Kristiyan Velkov for authoring this guide. As a Docker Captain and experienced Full-stack engineer, his expertise in Docker, DevOps, and modern web development has made this resource invaluable for the community, helping developers navigate and optimize their Docker workflows.


What will you learn?

In this guide, you will learn how to:

  • Containerize and run a Node.js application using Docker.
  • Run tests inside a Docker container.
  • Set up a development container environment.
  • Configure GitHub Actions for CI/CD with Docker.
  • Deploy your Dockerized Node.js app to Kubernetes.

To begin, you’ll start by containerizing an existing Node.js application.


Prerequisites

Before you begin, make sure you're familiar with the following:

  • Basic understanding of JavaScript and TypeScript.
  • Basic knowledge of Node.js, npm, and React for modern web development.
  • Understanding of Docker concepts such as images, containers, and Dockerfiles. If you're new to Docker, start with the Docker basics guide.
  • Familiarity with Express.js for backend API development.

Once you've completed the Node.js getting started modules, you’ll be ready to containerize your own Node.js application using the examples and instructions provided in this guide.

Modules

  1. Containerize

    Learn how to containerize a Node.js application with Docker by creating an optimized, production-ready image using best practices for performance, security, and scalability.

  2. Develop your app

    Learn how to develop your Node.js application locally using containers.

  3. Run your tests

    Learn how to run your Node.js tests in a container.

  4. Automate your builds with GitHub Actions

    Learn how to configure CI/CD using GitHub Actions for your Node.js application.

  5. Deploy your app

    Learn how to deploy your containerized Node.js application to Kubernetes with production-ready configuration