docker-compose up
Run migrations:
docker-compose exec app npx prisma migrate dev
Seed with 2 accounts:
docker-compose cp ./db/seed.sql db:/seed.sql
docker-compose exec db psql postgres postgres -f /seed.sql
docker-compose up
Make transactions:
curl --request POST \
--url http://localhost:3000/v1/transfers \
--header 'content-type: application/json' \
--header 'idempotency-key: abcdef123456' \
--data '{"from_account": "cjld2cyuq0000t3rmniod1foy","to_account": "cldmt86vb0023356kz6cc10p0","amount": "0.000001"}'
Check the balance:
curl --request GET \
--url http://localhost:3000/v1/accounts/cjld2cyuq0000t3rmniod1foy
Get transactions:
curl --request GET \
--url 'http://localhost:3000/v1/transfers?account_id=cjld2cyuq0000t3rmniod1foy'
npm run tests
- Develop the plan
- Start timer 4h // 14:21
- Task definition // 14:27
- Tech stack: express.js, Prisma.io, docker, OpenApi spec, Vitest // 14:30
- Project structure + github repo + docker compose // 14:34
- Domain design // 14:49
- OpenApi specs // 15:19
- Data models design // 15:32
- Development // 17:22
- Test // 18:00
- Dockerize // 18:20
- Stop timer // 18:21 - 4h
- Documentation
- What is next?
- cuid -> cuid2
- errors mechanism
- transactions list paging: cursors or offset+limit
- Dockerfile security!
- Make code entities' names more consistent
- monitor & debug
- indexes