How it works

The entire project is built under NX (opens in a new tab) 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 (opens in a new tab) or Heroku (opens in a new tab), you can use a shared environment variables for all the apps.

At the moment it has 6 projects:

  • Frontend - Provides the Web user interface, talks to the Backend.
  • Backend - Does all the real work, provides an API for the frontend, and posts work to the redis queue.
  • Workers - Consumes work from the Redis Queue.
  • Cron - Run jobs at scheduled times.
  • Docs - This documentation site!
Architecture of Gitroom

Architecture

Frontend

The frontend is built with NextJS (opens in a new tab) and TailwindCSS (opens in a new tab).
It works directly with the Backend to:

  • Show analytics
  • Schedule posts
  • Manage users

Backend

The backend is built with NestJS (opens in a new tab) with a basic architecture of controllers, services, repositories and dtos.

It uses Prisma (opens in a new tab) as an ORM to interact with the database.
By default Prisma uses Postgres (opens in a new tab) 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 (opens in a new tab) 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 (opens in a new tab) 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 (opens in a new tab).
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.