The entire project is built under NX to have a monorepo with multiple projects.

Unlike other NX project, this project has one .env file that is shared between all the apps.
It makes it easier to develop and deploy the project.

When deploying to websites like Railway or Heroku, you can use a shared environment variables for all the apps.

At the moment it has 6 project:

  • Backend - NestJS based system
  • Workers - NestJS based workers connected to a Redis Queue.
  • Cron - NestJS scheduler to run cron jobs.
  • Frontend - NextJS based control panel.
  • Docs - Mintlify based documentation website.
Architecture of Gitroom

Architecture

Frontend

The frontend is built with NextJS and TailwindCSS.
It works directly with the Backend to:

  • Show analytics
  • Schedule posts
  • Manage users

Backend

The backend is built with NestJS with a basic architecture of controllers, services, repositories and dtos.

It uses Prisma as an ORM to interact with the database.
By default Prisma uses Postgres as a database, but it can be easily changed to any other database since there are no native queries.

It uses Redis to schedule posts and run background jobs.

Cron

The backend is built with NestJS and share components with the backend.
At the moment the use of the cron is:

  • Refresh tokens from different social media platforms.
  • Check for trending change every hour and inform users about it.
  • Sync the amount of stars for every repository at the end of the day.

Worker

The backend is built with NestJS and share components with the backend.
At the moment the use of the worker is:

  • Post scheduled posts to social media platforms.
  • Perform multiple jobs coming from the cron.

Docs

The documentation website is built with Mintlify.
The reference in the documentation is being auto-generated by the backend.
NestJS has a built-in Swagger module that generates a JSON file with all the routes and their documentation.
It makes it very easy to track API changes and deploy them.