Dyte's take home task for backend development.
- Uses Express as backend.
- Runs Moleculer API Gateway in middleware mode on express. [Link]
- Uses Prisma as the Database ORM with Postgres as the database.
- Has two Moleculer services: API Gateway and Webhooks.
- Batch size for concurrent requests [trigger route] can be configured by env variables
- In addition to JWTs, admins have to send
admin-id
as a header, which is cross-checked with the enviroment variable (can be a set of rotating uuids which is shared internally) - Written in TypeScript. (obv)
- Postman Collection(JSON) here
- Install dependencies
npm install
- Run Postgres (remember to set env vars!)
- Perform DB migrations with prisma
npx prisma migrate dev
npx prisma generate
- Start the server (also transpiles TS to dist/)
npm start
npm run build
: Transpiles TS to JSnpm run start
: starts the moleculer and express serversnpm run cli
: Start a CLI and connect to production. Don't forget to set production namespace with--ns
argument in scriptnpm run dc:up
: Start the stack with Docker Composenpm run dc:down
: Stop the stack with Docker Compose
- test retry logic properly (I'm sure interceptor method is wrong)
- dockerize
Made with ❤️ by Siddhartha Varma