How arquisoft/wichat_es6b works
Main Components
• Frontend – Webapp (React): Represents the client side where users log in, register, and interact with the application.
• API Gateway – Gateway Service (Express): Exposed publicly and acts as a reverse proxy, forwarding requests to the appropriate back-end services.
• Back-end Services (Express-based):
• Auth Service: Handles user authentication.
• User Service: Manages user registration and profile data (sharing the MongoDB database).
• LLM Service: Acts as an intermediary with the Large Language Model API using the configured API key.
• (Optional) Question Service: Manages question generation and related functionalities (it includes routines for interacting with Wikidata and performing database operations).
• Additional “users” sub-services: Under the “users” directory, there are also a history service and a userservice which add to the modular design.
• Database – MongoDB: Used by both the auth and user services (and possibly the question service depending on design), accessed via mongoose.
• CI/CD & Deployment: GitHub Actions (with workflows under .github/workflows) automate testing, building, and deploying via SSH and Docker Compose.
• Monitoring & Logging: Integrated monitoring for the gateway service through Prometheus and Grafana, as seen in the gatewayservice/monitoring directory.
Component Relationships and Interactions
• Data Flow:
• The Webapp sends requests (e.g., login, registration, or LLM queries) to the Gateway Service.
• The Gateway Service acts as a proxy, routing requests to the respective microservices (Auth, User, LLM, and optionally Question Services).
• The Auth and User services interact with the shared MongoDB database to manage user information.
• External Integrations:
• The LLM Service communicates with external LLM providers, secured by API keys (provided via .env files).
• Monitoring components (Prometheus and Grafana) connect with the Gateway Service for observability.
• Deployment Pipeline:
• The CI/CD system builds and tests individual services using GitHub Actions. On release, images are pushed and updated using a docker-compose file executed on a remote virtual machine via SSH.
Architectural Patterns and Technologies
• Microservices Architecture: Separate Express-based services each handling a distinct set of responsibilities.
• API Gateway Pattern: Encapsulating the microservices behind a single entry point.
• Containerization: Each service is containerized with Docker (see respective Dockerfiles, .dockerignore files, and docker-compose.yml).
• Continuous Integration/Continuous Deployment: Automated pipelines ensure only validated builds are deployed.
• Monitoring: Use of Prometheus and Grafana – this is an additional architectural concern for production-readiness.
• Communication: Likely RESTful APIs among the services with JSON payloads.