This project follows a microservice architecture with the following services:
- authentication-service: Manages user authentication and Firebase integration.
- user-service: Handles user-related operations.
- image-service: Manages image-related functionality.
- post-service: Handles blog posts creation and management.
- api-gateway: The entry point for routing API requests.
The project directory structure is as follows:
project/
|_ services/
|_ api-gateway/
|_ authentication-service/
|_ user-service/
|_ image-service/
|_ post-service/
|_ client/
|_ init-scripts/
- services: Contains all microservices and their respective code.
- client: Contains the front-end files, including an HTML page for obtaining the ID token.
- init-scripts: Contains scripts to set up the project environment.
- Sign up for a Firebase account and create a new project.
- Add a user with an email and password.
- Create a service account in Firebase and download the
firebase-service-account.json
file.
- Navigate to the
client
folder and open theclient-login.html
file. - Update the Firebase credentials in the file with your Firebase project details.
- Place the
firebase-service-account.json
file in theenvironments/auth/
folder.
-
From the root directory, run the following command to build and start the services using Docker Compose:
docker compose up --build -d
This will set up the containers, database, and networking.
docker compose down --volume
This will stop all contianer with the volume we've created for them.
- Import the
Devotel.postman_collection.json
file into Postman. - Create an environment in Postman and define a variable
{{token}}
. - In Postman, get the
idToken
by running theclient-login.html
file in your browser, then copy and paste the token into the{{token}}
variable.
- Use Postman to create a user by sending a POST request to
/users
.
- To create a post, the user must have the AUTHOR or ADMIN role.
The Postman collection Devotel.postman_collection.json
contains all the necessary API requests for interacting with the services. Make sure to set the appropriate headers and authentication token in your requests.