BRO3886 / dyte-task

Backend task for dyte

Home Page:https://www.getpostman.com/collections/d6e6df0a246d12f7f4b5

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Backend task for dyte

https://www.getpostman.com/collections/d6e6df0a246d12f7f4b5


Languages

Language:TypeScript 97.0%Language:Dockerfile 2.4%Language:Shell 0.6%