In this project, we are creating a backend for a frontend view provided in the case study document. This project is a proposed solution to improve the collaboration between teams and increase the speed.
- Nodejs
- Express
- Typescript
- PostgreSQL
- Prisma as an ORM
- Jest and Supertest for testing
With this small project, we have 3 data models (Company, Card, and Transaction).
- A company has only one card
- A card belongs to a company
- A card has multiple transactions
- Clone the repository
yarn
Create copy of .env.dist
:
cp .env.dist .env
Using docker to run a single instance postgres
docker run --name postgresql -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=password -p 5432:5432 postgres
After Postgresql has started, run following to update database schema. The db push command pushes the state of Prisma schema file to the database without using migrations. It creates the database if the database does not exist.
prisma db push
To seed the data in db run following
npx prisma db seed
Runs the server in watch-mode (restarts the server if anything changes in the source code).
yarn dev
Swagger UI is available on http://localhost:3010/api-docs
Runs the test with following command
yarn test