Skip to content

AidenLeeeee/nestjs-prisma-postgres

Repository files navigation

Instruction

🚀 Starter Template for NestJS, Prisma and PostgreSQL


Version

@nest core packages


prisma


typescript


lint


Features

🔥 Quick Start

  • You can quickly start your project and get started with development !

😻 Efficient Web Framework

  • Nest.js is a Node.js framework that supports efficient server-side application development !

🔷 The Next Generation ORM

  • Prisma is a modern ORM that makes it easy to access databases through a type-safe and intuitive API !

🐘 Advanced Open-source Relational Database

  • PostgreSQL is a powerful, open-source object-relational database system that provides reliability, data integrity, and correctness !

⚙️ TypeScript's Strict Mode

  • Improve type safety, reduce potential errors, and enhance code maintainability with TypeScript's strict mode !

📦 Using Fast Package Manager

  • pnpm is a fast and disk space efficient package manager for JavaScript projects !

🚛 Automated Linting and Formatting

  • Automated linting and formatting with ESLint, Prettier and Commit-Lint configurations.

Getting Started

1. Quick Start

To use this starter template, you can either clone this repository or use this template as the base of your project.

# Clone this repository
$ git clone https://github.com/AidenLeeeee/nestjs-prisma-postgres.git

# Navigate to the project directory
$ cd nestjs-prisma-postgres

# Install dependencies
$ pnpm install

# Start the development server
$ pnpm run start:dev

2. PostgreSQL with Docker

To utilize Docker to launch PostgreSQL in your local environment, please refer to the following instructions.

1) Please fill out the .env file as shown below.

# Environment file template

# 🚨 Do not upload this file to GitHub.
# 🚨 Make sure you have added this file to the .gitignore file.

# App
NODE_ENV=

# DB
POSTGRES_DB=myDb                                      # Whatever you want.
POSTGRES_USER=myUser                                  # Whatever you want.
POSTGRES_PASSWORD=myPassword                          # Whatever you want.
POSTGRES_HOME_DIR=/my/local/path/data/                # Your Local path to be linked with the docker volume.
POSTGRES_PORT=5432                                    # Whatever you want.
POSTGRES_URL=`postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${POSTGRES_PORT}/${POSTGRES_DB}?schema=public`

2) Navigate to .gitignore and uncomment the .env glob at the bottom of the file.

# Env files
# 🚨 Be sure to uncomment the comments below. (# .env -> .env)
.env

3) Run the command below to execute the docker-compose.db.yml file and quickly launch PostgreSQL locally.

$ docker compose -f docker-compose.db.yml up -d
# or
$ npm run docker:db

Caution

⚠️ Security

Be careful not to upload your created env file to GitHub.
Don't forget to uncomment the .env glob in the .gitignore file to prevent the env file from being uploaded to GitHub.

# Env files
# 🚨 Be sure to uncomment the comments below. (# .env -> .env)
.env

⚠️ Commit Lint Convention

This template comes with automatic commit linting, and please refer to the related links below for more information.
@commitlint/config-conventional

⬆ back to top

About

Starter template for Nest.js, Prisma and PostgreSQL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published