How painnha/tuyensinhthongminh-monorepo works
Main Components
• Backend API Server: Built with Node.js and Express, using MongoDB (Mongoose) for data storage. This includes routes, controllers (for authentication, universities, and subject combinations), models, middleware (for authentication), utility functions (such as OTP utilities), and script tools (to import CSV data and create admin users).
• Frontend Application: A React (with TypeScript) application using Material-UI, React Query, and structured into components such as authentication screens, dashboards, consultation, news, transcript calculators, and university details.
• Shared Package: Contains shared utilities and type definitions, ensuring consistency between the frontend and backend.
• External Services: As indicated by the usage of Infobip for OTP management and JWT for authentication. Also consider MongoDB as an external database.
Relationships and Interactions
• The frontend communicates with the backend via RESTful API calls. It consumes APIs for authentication (sending and verifying OTPs, login, register, password reset), fetching university data (/api/universities endpoints), and subject combinations.
• The backend interacts with MongoDB for data persistence. It employs a layered pattern where the routes pass requests to controllers, which then manage business logic and data via models.
• Shared utilities are used by both the frontend and backend to maintain consistency (e.g., type definitions, common logic).
Architectural Patterns and Design Principles
• Separation of Concerns: Clearly divided modules for controllers, models, middleware, and routes in the backend, as well as a component-based architecture in the frontend.
• API Driven: A RESTful API design for backend communication.
• Containerization: Docker is used to containerize both the frontend and backend, ensuring consistent and scalable deployments.
• Monorepo Structure: The three packages (backend, frontend, shared) are integrated, so drawing module interactions is important.
Relevant Technologies
• Backend: Node.js, Express, MongoDB, Mongoose, JWT, RESTful API.
• Frontend: React, TypeScript, Material-UI, React Query.
• Shared: TypeScript, utilities, type definitions.
• Additional: Docker for containerization, CI/CD pipelines as evident from the GitHub workflows.
Specific Elements
• Clear Labels: Use clear labels for each component (e.g., “React Frontend,” “Express API Server,” “MongoDB Database,” “Shared Utilities,” “External Infobip Service”).
Detailed Steps for the Principal Software Engineer
• Within the Backend block, further divide into sub-components (Authentication, API Controllers, Data Models, Business Logic, Middleware, Utility Scripts) and add a side note for Docker and GitHub workflow integrations.
• External services like Infobip for OTP and JWT for authentication flows.