The backend module built with NestJS and GraphQL.
Keadex Einaudi represents the backend module of Keadex. It is based on microservices built with NestJS, Apollo and GraphQL.
The API Gateway is exposed on: https://keadex.io/graphql
Keadex Einaudi workspace is a NestJS Monorepo, made up of different apps, one for each microservice.
For further details about the architecture, check the documentation.
- Microservice architecture & GraphQL
- Database per service pattern
- Event sourcing pattern
- NestJS
- Apollo Federation
- Apollo GraphQL Gateway
- Managed Federation
- Mongoose
- Apache Kafka
- Winston
- Winston Daily Rotate File
- Quotable - Thanks to the open source project https://github.com/lukePeavey/quotable
- Passport (Authentication Middleware)
- JWT
- GitHub Actions
- PM2 - Advanced process manager for production Node.js applications https://pm2.keymetrics.io/
- install and run Apache Kafka
- install and run MongoDB
- install Apollo Studio Rover CLI
- clone the repo:
git clone https://github.com/keadex/keadex-einaudi.git
- run
yarn install
under the root folder - check your environment variables under each microservice folder (
/apps/*
) - build all the microservices by running the following command under the root folder:
nest build MICROSERVICE_NAME_HERE
(e.g.nest build gateway
) - publish the GraphQL schemas into your Apollo Studio account by running the following command under the root folder:
yarn publish-graph --name MICROSERVICE_NAME_HERE --port MICROSERVICE_PORT_HERE
(e.g.yarn publish-graph --name gateway --port 3000
).
For further details about the publish schema script, check the/scripts/publish-graph.ts
file.
Microservices configurations (e.g. port number) are defined in the environment variables.
Nest.js has a bug when using code-first approach in building Microservices with GraphQL and Apollo Federation. Check the following issue and PR for the solution: