How tutortoise/backend works
Main Components
• API Server – Represent the Express.js server as the central “API Gateway”. This is where all incoming HTTP requests are handled.
• Middleware & Common Utilities – Include components for application-level middlewares (e.g., logging, validation, security, file handling with Multer) and shared utilities (e.g., helpers: JWT, image processing, OAuth service, etc.).
• Firebase Realtime Database (for real-time interactions and user messaging).
• Google Cloud Storage (for profile pictures and chat image storage).
• External APIs integrated for specialized functionality, such as:
• FACE_VALIDATION API,
• ABUSIVE_DETECTION API,
• RECOMMENDATION API.
• Testing & Documentation – Although not runtime components, note the use of Vitest and SuperTest (integration tests) and Swagger documentation, indicating a practice of comprehensive testing and documentation.
Representing the Relationships & Data Flow
• That each module communicates with the PostgreSQL database (via Drizzle ORM) for CRUD operations.
• Inter-module communication (if any exists) – for instance, if notifications are triggered after order completion or chat actions.
Architectural Patterns & Design Principles
• Modularity: The project’s layout, with a separate directory per domain (abusive-detection, auth, category, etc.), is indicative of a modular design – each module is isolated, keeps its own controllers, services, routes, and repositories.
• Separation of Concerns: Use labels to clearly distinguish between components such as middleware, controllers, services, and repositories.
Including Technologies and Frameworks
• Clearly label "Express.js" in the API Server component.
• "Drizzle ORM" next to the PostgreSQL database component.
• External services: “Firebase Realtime Database”, “Google Cloud Storage”, along with the external URLs like FACE_VALIDATION_URL, ABUSIVE_DETECTION_URL, and RECOMMENDATION_URL.
• Optionally denote the testing framework (Vitest & SuperTest) and mention Swagger for API documentation.