Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

BRO3886/dyte-task

Repository files navigation

Dyte Backend Task

Dyte's take home task for backend development.

Moleculer

Run in Postman

Info

  • 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

Instructions To Run

  • 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 scripts

  • npm run build: Transpiles TS to JS
  • npm run start: starts the moleculer and express servers
  • npm run cli: Start a CLI and connect to production. Don't forget to set production namespace with --ns argument in script
  • npm run dc:up: Start the stack with Docker Compose
  • npm run dc:down: Stop the stack with Docker Compose

TODOs:

  • test retry logic properly (I'm sure interceptor method is wrong)
  • dockerize
Made with ❤️ by Siddhartha Varma