Teguh Arief

NestJS with PostgreSQL, TypeORM, JWT auth, and Docker

Setting up NestJS with PostgreSQL, TypeORM, JWT auth, and Docker.

Teguh Arief

Published on: May 28, 2024

Share:

This guide outlines the comprehensive steps to get your NestJS application running with PostgreSQL, TypeORM, JWT authentication, and Docker, all from your Darwin Terminal. We'll cover everything from initial setup to deployment with Git.

Beyond just dependencies, you'll also find the essential commands for NestJS, Docker, and Git integration.

brew install node
npx @nestjs/cli new nestjs-postgresql-typeorm-jwt-auth
cd nestjs-postgresql-typeorm-jwt-auth

Configuring NestJS, PostgreSQL, TypeORM, and JWT Auth

npm install pg @nestjs/typeorm @nestjs/jwt @nestjs/config class-transformer class-validator
npx @nestjs/cli g resource users
npx @nestjs/cli g resource auth
npm install

Dockerizing Your NestJS Application

touch Dockerfile .dockerignore docker-compose.yml
docker compose build
docker compose up

Git Version Control for Your Project

git init
git add .
git commit -m “first commit”
git branch -M main
git remote add origin git@github.com:teguharifudin/fabrotech.git
git remote set-url origin https://github.com/teguharifudin/fabrotech.git
git push origin -u main

The complete project, demonstrating NestJS with PostgreSQL, TypeORM, JWT auth, and Docker, can be found and checked out on GitHub: https://github.com/teguharifudin/fabrotech. Feel free to grab a coffee while you explore it!

Related Posts

Building a NestJS CRUD application with MongoDB and Mongoose for a superior backend.

NestJS CRUD with MongoDB using Mongoose

Learn to build a robust backend with NestJS, covering CRUD operations using MongoDB and Mongoose, from setup to creating, reading, and updating.

Read More
An illustration demonstrating the process of running Nginx virtual host for Laravel sites using Docker.

Running Nginx Virtual Host for Laravel Sites Using Docker

Run Laravel sites on Nginx virtual hosts using Docker. Step-by-step guide for setting up your local development environment efficiently.

Read More
CI/CD pipeline for React.js deployment using Visual Studio Code, GitHub Actions, and cPanel FTP.

Streamline React.js Deployment: CI/CD with VS Code Integration

Learn to set up robust CI/CD for React.js with VS Code, GitHub Actions, and FTP on cPanel. This guide covers everything.

Read More