How umcignal/umcignal-server works
Project Type and Purpose
• This project is a backend API server built using Express and TypeScript. It is meant to serve as a well-structured RESTful API that connects with a MySQL database and leverages Redis for caching or session management.
• The code follows a layered architecture that separates concerns into configuration, middleware, routing, controllers, services, data models, and additional modules (e.g., authentication and security features).
File Structure
• The main application entry point is found in dist/index.ts.
• Core application logic is organized within the “dist” folder and is further subdivided by domain:
• Each domain such as healthCheck, idelType (likely a typo for idleType), operating, referralCode, search, serialCode, and user is separated into its own directory.
• Within each domain folder, there is a clear pattern: each module has a router (defining routes), a controller (handling request logic), a service (business logic), a model (database or ORM interactions), and sometimes data transfer objects (DTOs) for input validation or transformation.
• The project uses multiple layers of middleware stored under dist/middlware for error handling, authentication, validation, operating, and more.
• Configuration makes use of defined files such as dist/config/database/mysqlConnect.ts and a swagger.ts for API documentation, along with GitHub workflows for CI/CD in .github/workflows.
• Security features (JWT, mail sender, validation) are implemented in separate directories (dist/security), further emphasizing a modular architecture.
Final Steps and Details
• Do not oversimplify – break down each module as far as possible while ensuring clarity.