🚀 Starter Template for NestJS, Prisma and PostgreSQL
@nest core packages
- @nestjs/common 9.4.0
- @nestjs/core 9.4.0
- @nestjs/platform-express 9.4.0
- @nestjs/cli 9.4.0
- @nestjs/schematics 9.1.0
prisma
- prisma 4.12.x
typescript
- typescript 4.7.x
lint
- eslint 8.0.x
- prettier 2.3.x
- husky 8.0.x
- lint-staged 13.2.x
- @commitlint/cli 17.6.x
- @commitlint/config-conventional 17.6.x
- You can quickly start your project and get started with development !
- Nest.js is a Node.js framework that supports efficient server-side application development !
- Prisma is a modern ORM that makes it easy to access databases through a type-safe and intuitive API !
- PostgreSQL is a powerful, open-source object-relational database system that provides reliability, data integrity, and correctness !
- Improve type safety, reduce potential errors, and enhance code maintainability with TypeScript's strict mode !
- pnpm is a fast and disk space efficient package manager for JavaScript projects !
- Automated linting and formatting with ESLint, Prettier and Commit-Lint configurations.
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
To utilize Docker to launch PostgreSQL in your local environment, please refer to the following instructions.
# 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`
# 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
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
This template comes with automatic commit linting, and please refer to the related links below for more information.
@commitlint/config-conventional