Article
Node.js TypeScript Docker MongoDB
November 09, 2023 - Rebaz Omar
Building a Node.js TypeScript Docker MongoDB Project
Introduction
Welcome to this blog post where we'll walk you through the process of building a Node.js TypeScript project integrated with MongoDB and Docker. This project aims to help you get started with modern web development using these powerful technologies.
We'll cover the essentials, prerequisites, and the step-by-step process to set up and run your project. So, let's dive in!
Prerequisites
Before we begin, you need to ensure that you have the following dependencies installed on your system:
Getting Started
Let's kick things off by setting up the project on your local machine. Follow these steps:
- Clone the repository:
- Navigate to the project directory:
- Install project dependencies:
- Configuration:
- Run the project In Development:
- Run the project In Production:
- Running with Docker:
- Run the container:
- Running with Docker Compose:
$ git clone --depth=1 https://github.com/rebazomar121/node-typescript-mongodb-starter your-project-name
$ cd your-project-name
$ npm install
$ cp .env.example .env
$ npm run dev
$ npm run build && npm start
$ docker build -t your-image-name .
$ docker run -p 8080:8080 -d your-image-name
$ docker-compose up
Note: You can change the configurations in the .env
file.