How boboiboy181/uitwiki-be works
Main Components
• Microservices – There are several services under the “apps” directory:
• Authentication Service (apps/auth): Manages user authentication, JWT strategies, and guards.
• Chatbot Service (apps/chatbot): Handles natural language processing queries and responses.
• Document Service (apps/document): Manages PDF document uploads and storage; likely used to update the knowledge base.
• Session Service (apps/session): Manages session data, probably storing conversation histories.
• Main Backend or Gateway (apps/uit-wiki-be): Seems to integrate the above services into a unified API endpoint interface.
• Shared Library – The “libs/common” folder provides common utilities, DTOs, decorators, shared database modules, logging, and integration with third-party tools (e.g., Redis, Pinecone). This module is used by multiple microservices.
• Infrastructure & Deployment – The Docker files for each app, docker-compose.yml, and Kubernetes manifests under the “k8s” directory (with Helm charts) represent how services are containerized and orchestrated.
• External Dependencies – MongoDB for persistent storage, Redis for caching or session storage, and possibly external API consumers via Swagger-documented endpoints.
Relationships and Interactions
• Clients (UIT students and admin/lecturers) access the system via web or mobile interfaces.
• Requests hit a Kubernetes Ingress or load balancer (if depicted) and then get routed to the “uit-wiki-be” gateway.
• The Gateway/Backend then directs requests internally or via API calls to the appropriate microservice:
– Authentication for login and token management.
– Chatbot for retrieving answers.
– Document Service for file upload and document querying.
– Session Service for maintaining conversation histories.
• Shared modules in “libs/common” are consumed by individual microservices for consistent business logic and common functionality.
• Data flows are bidirectional:
– HTTP requests from the client to a service.
– Internal service-to-service calls or shared database calls.
– Interactions with databases like MongoDB and caches like Redis.
Architectural Patterns and Design Principles
• Microservice Architecture: Each major function (auth, chatbot, document, session) is isolated as its own service.
• API Gateway/Backend Integration: The “uit-wiki-be” service appears to act as a centralized backend that integrates these microservices.
• Containerization and Orchestration: Docker is used for image build/deployment and Kubernetes manifests manage production deployments.
• Common Utility / Shared Libraries: “libs/common” encapsulates patterns (e.g., repository pattern, decorators, DTOs) that promote code reuse and consistency.
Relevant Technologies and Frameworks
• Nest.js framework across services.
• Docker for containerization (each service has its Dockerfile).
• Kubernetes with Helm charts (see k8s/uit-wiki-be) for deployments.
• MongoDB and Redis for storage and caching.
• Swagger for API documentation (from libs/common).
• Testing frameworks and e2e configurations (present under each app’s test directory).
Final Assembly
• Expand each microservice with internal details if needed (important files like controllers, services, and repositories can be abstracted as sub-components).
• That each component is clearly labeled with its role (for example, “Auth – handles user and JWT management”).
• Container and orchestration layers below or as an adjacent context, showing how Docker images feed into Kubernetes deployments.