Run these:
cd task-list-backend && pnpm i && cd ../task-list-frontend && pnpm i && cd ..
docker compose up
- go to http://localhost:3001 on your browser
- Update the backend's
.env
to use the production string forDATABASE_URL
- Run the following from the root folder:
docker build -f task-list-backend/Dockerfile-prod ./task-list-backend -t task-list:latest
docker run --env-file=./task-list-backend/.env -p "3000:3000" task-list:latest
docker build -f task-list-frontend/Dockerfile-prod ./task-list-frontend -t task-list-frontend:latest
docker run --env-file=./task-list-frontend/.env -p "3001:3001" task-list-frontend:latest
- Go to your browser at
localhost:3000
- I've commited the .env file to simplify running the application locally
docker exec -it task-list-backend-1 sh
db:migrate-dev
docker exec -it task-list-backend-1 sh
db:reset
- Uses Prisma as the ORM
- Personal preference. It allows for type-safe queries, easy management of the DB schema via the
schema.prisma
file - Improvement: It (still) doesn't support polymorphic relations prisma/prisma#1644
- Personal preference. It allows for type-safe queries, easy management of the DB schema via the
- Uses the standard Service pattern
- Improvement: The Service-Repository pattern would be preferred, where there would also be a repository layer to manage and isolate the data access logic for the data layer.
- Validation
- Validation is done using the class-validator package which has a innate integration with NestJS via the
@Body()
decorator - Improvement: validation should also be done in the service layer, as typically a service method may be called by another service method, or via another source other than the REST endpoint, e.g. a Kafka consumer
- Validation is done using the class-validator package which has a innate integration with NestJS via the
- Data separation layer between controller and service
- To separate the controller from the service, and provide standardized API into the service regardless of the caller - e.g. the (REST) controller, a kafka consumer or another service
- If a repository layer is used, there would also be the same separation of layers (i.e. different types in and out of the layer)