Boilerplate Nest.js API with PostgreSQL database, Prisma ORM and JWT authentication.
- Run
npm install - Spin up a local PostgreSQL database
- Create a
.envfile and fill in the fields listed in.env.default - Run
npx prisma migrate resetto align your database with the Prisma schema - Run
npm run start:dev - Go to localhost:3000, you should see the swagger of your API
Run
cd database
docker-compose upBy default, the database is running following the below config:
- adress:
localhost:5432 - user:
postgres - password:
passwordYou can change this within thedocker-compose.yamlfile.
Connect to the container using
docker exec -it localdb_c bashThen run,
psql -U postgres # to connest to postgres user
\conninfo # to get connection info
\l # to get the DB list
CREATE DATABASE <DB_NAME>; # create a DB named nest
\c <DB_NAME>; # to connect to DBPress Ctrl+D twice to exit posgres and the container
- you might need to install
docker-composeindependently. - if
dockerdeamon is not running, usesudo systemctl start docker. - permission denied: use
sudobeforedockercommands. - depending on your
dockerengine anddocker-composeversion you might need to cahngeversion: "3.3"indocker-compose.yaml.