This is a pet project aimed at gaining practical experience with GraphQL Federation. The project is built with a microservices architecture, where users can write posts and leave comments. The system consists of the following services:
all of which are subgraphs in the overall GraphQL federation supergraph.
- Kotlin
- Java (Version: 21)
- Spring Boot
- Netflix DGS (Domain Graph Service)
- AWS SNS/SQS (for messaging)
- Postgres (for database)
- Gradle (for build automation)
- TypeScript
- React.js
- React Material (for UI components)
- Apollo Client (for GraphQL client-side operations)
- Java Version: 21
- Gradle can work with any Java version from 8 to 17. Gradle will automatically download and use the required Java version (21) using the toolchain.
- Node Version: 18.20.2
- It is recommended to use NVM (Node Version Manager) for managing Node.js versions.
- Docker is used to set up the necessary infrastructure. Localstack is used to replicate AWS APIs locally, and Postgres is used directly.
-
Clone the Repository:
git clone <repository-url> cd <repository-directory>
-
Install JDK: You could use any way of installation, for an example SdkMan
-
Install NVM: Follow the instructions at NVM GitHub page ( or NVM for Windows GitHub page for Windows users) to install NVM.
-
Install Node.js:
nvm install 18.20.2 nvm use 18.20.2
-
Install Java: Ensure you have Java 8 to 17 installed. Gradle will manage the required version (21) using the toolchain.
-
Build and run the required service:
- Users service:
./gradlew :app-users-service:bootRun
- Posts service:
./gradlew :app-posts-service:bootRun
- Comments service:
./gradlew :app-comments-service:bootRun
- Scheduled Events service:
./gradlew :app-scheduled-events-service:bootRun
-
Change current directory:
cd app-gateway
-
Install Dependencies:
npm install
-
Run the gateway:
npm serve
NOTE: Using gateway UI to play with GraphQL unsure that cookies are enabled in settings.
-
Change current directory:
cd app-client-web
-
Install Dependencies:
npm install
-
Run the Frontend:
npm serve
-
Install Docker: Follow the instructions at Docker's official website to install Docker.
-
Start Docker Containers:
./start-supergraph
- add
--build
argument if you want to rebuild services (and Docker images as well) - add
--test
argument if you want to
- add
Feel free to fork this repository and submit pull requests. For major changes, please open an issue first to discuss what you would like to change.