- Node.js
- Docker
- Install dependencies:
npm install
- Run docker container with DB locally, this will also run the DB migrations
npm run db:start
- Start the development server:
npm run serve:dev
This application uses Prisma as an ORM. To make changes to the DB schema, you need to update the schema in prisma/schema.prisma
.
- For prototyping during development you can push the schema changes to the DB using:
npm run db:push-schema
- Once the schema changes are ready to deploy, you can generate and apply a prisma migration file with the change using:
prisma migrate dev --name <NAME_OF_YOUR_MIGRATION>
This application uses user defined functions in the PostgreSQL database. These functions are defined in the sql-functions
directory.
- For prototyping during development you can push the functions to the DB using:
npm run db:push-functions
- Once the functions are ready to deploy you have to manually create an empty prisma migration for them using:
Then, copy your sql code into the newly created migration file. Afterwards, apply the changes using
prisma migrate dev --create-only --name <NAME_OF_YOUR_MIGRATION>
prisma migrate dev
# unit tests
npm run test
# e2e tests
npm run test:e2e
# test coverage
npm run test:cov
# to start
npm run db:start
# to stop container
npm run db:stop
# to remove (will delete all db data)
npm run db:remove
# to reset (delete all data and recreate db)
npm run db:reset
# development
npm run serve
# watch mode
npm run serve:dev
# debug mode
npm run serve:debug
# production mode
npm run build
npm run serve:prod