DEV Community

Cover image for Building a Node.js TypeScript Docker MongoDB Project
rebaz omar
rebaz omar

Posted on

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:

  1. Clone the repository:
$ git clone --depth=1 https://github.com/rebazomar121/node-typescript-mongodb-starter your-project-name
Enter fullscreen mode Exit fullscreen mode
  1. Navigate to the project directory:
$ cd your-project-name
Enter fullscreen mode Exit fullscreen mode
  1. Install project dependencies:
$ npm install
Enter fullscreen mode Exit fullscreen mode
  1. Configuration:
$ cp .env.example .env
Enter fullscreen mode Exit fullscreen mode
  1. Run the project In Development:
$ npm run dev
Enter fullscreen mode Exit fullscreen mode
  1. Run the project In Production:
$ npm run build && npm start
Enter fullscreen mode Exit fullscreen mode
  1. Running with Docker:
$ docker build -t your-image-name .
Enter fullscreen mode Exit fullscreen mode
  1. Run the container:
$ docker run -p 8080:8080 -d your-image-name
Enter fullscreen mode Exit fullscreen mode
  1. Running with Docker Compose:
$ docker-compose up
Enter fullscreen mode Exit fullscreen mode

Note: You can change the configurations in the .env file.

Top comments (2)

Collapse
 
shakilahmed007 profile image
Shakil Ahmed

Exciting project! 👏 Combining the power of Node.js, TypeScript, Docker, and MongoDB sounds like a winning recipe

Collapse
 
rebazomar121 profile image
rebaz omar

Thanks i will try to add Prisma for the project