Dockerize nodejs postgres app
It looks like we’ve got the first step, but the fun is just beginning. prettierrc), and the base structure of our application: You can see that Nest CLI created all structures including tests files (*.spec.ts), config files (eslintrc.js or. You should see that server is running, but this is only the beginning of our journey: After installation you can check if the base server is ok, so type: cd skeleton-app I will use npm but feel free to choose yarn if you prefer. This command will ask you about the package manager. If you have installed the NestJS CLI, you can just type: nest new skeleton-app Go to your terminal, create an appropriate directory and navigate to it.
Personally, I love the NestJS framework because it makes it easy to make a good API server and it uses TypeScript by default. You might want to check out the official documentation.
#DOCKERIZE NODEJS POSTGRES APP INSTALL#
Last but not least is to install the CLI for the NestJS framework. It’s not necessary to know everything that Docker offers.
#DOCKERIZE NODEJS POSTGRES APP HOW TO#
Here have prepared an article that shows how to create your first Docker application. If you know nothing about Docker, that’s not a problem. We will use PostgreSQL and, with Docker, we don’t have to install Postgres on the computer – we will create an appropriate container based on the official image. We have to somehow dockerize our API server and connect with the database.
In the end, we want to run this application in a Docker container. I strongly encourage you to visit the official documentation and install the LTS version (at the time of writing this article, the LTS version is 16.14.2) for your machine. Let’s go! Required Technologies Node.jsįirst of all, we need to install runtime to run our JavaScript code on a local machine. As a database, we will use PostgreSQL and we will run the application in a Docker container. We will make a skeleton for an API server.įor the backend, we will use Node.js with the NestJS framework (for building server-side applications). The main goal of this article is to deal with the initial configuration of a new application using four technologies: NestJS, TypeScript, Docker, and TypeORM.