--- title: How it works description: 'Learn the architecture of the project' --- Gitroom is a tool to convert private communication into public knowledge.
The entire project is built under [NX](https://nx.dev/) 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](https://railway.app) or [Heroku](https://heroku.com), you can use a shared environment variables for all the apps.

**At the moment it has 6 project:** - **Backend** - NestJS based system - **Panel** - NextJS based control panel. - **Tenants** - NextJS based multi-tenant website. - **Discord** - NestJS based Discord bot. - **Marketing** - NextJS based marketing website. - **Docs** - Mintlify based documentation website. Architecture of Gitroom ## Architecture ### Backend The project has a centralized backend that both the bots and the client interact with.
The backend is built with [NestJS](https://nestjs.com/) with a basic architecture of controllers, services, repositories and dtos.

It uses [Prisma](https://www.prisma.io/) as an ORM to interact with the database.
By default Prisma uses [Postgres](https://www.postgresql.org/) as a database, but it can be easily changed to any other database since there are no native queries.

The project doesn't have a control panel login, it works with an SSO using the different bots.
Once somebody uses a command like `/add` or `/signin` the backend will receive the server id and the internal user id from the bot.

The backend will auto-create an organization and a user if it doesn't exist.
It will return a URL with the JWT token embedded in the url to sign in into the control panel. ### Panel The panel is built with [NextJS](https://nextjs.org/) and [TailwindCSS](https://tailwindcss.com/).
The panel has 4 main pages: - The main control panel to create and manage the FAQ. - A style page to customize the FAQ. - A "Create an faq" page, it takes an entire conversation and converts it into an FAQ with OpenAI ChatGPT. - Domains page to manage the domains and subdomains that lead to the tenant website. - An integrations page to add bots to different platforms such as: Discord, Slack, Intercom, etc. ### Tenants The tenants is built with [NextJS](https://nextjs.org/) and [TailwindCSS](https://tailwindcss.com/).
It's the website for the end-users to see the FAQ.
It contains a simple search bar and a list of questions.
The search bar uses [Algolia](https://www.algolia.com/) to search through the questions.
It uses the style from the control panel to customize the website.
The tenants cache each pages on the `Gitroom.com/[domainName]` path, it uses a middleware to rewrite the Vercel apex domain or the custom domain to the route.
### Discord The Discord bot is built with [Discord.JS](https://discord.js.org/) and [NestJS](https://nestjs.com/).
It runs in a loop and listens to every message in every server it's in.
Once somebody runs a command such as `/add` or `/signin` it will send a request to the backend with the server id and the user id.
This is a simple server and in the future there will be many other bots for different platforms. ### Marketing The marketing website is built with [NextJS](https://nextjs.org/) and [TailwindCSS](https://tailwindcss.com/).
It's a simple static websites with a few pages. ### Docs The documentation website is built with [Mintlify](https://www.mintlify.com/).
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.