How luc-ribeiro/task-manager works
Main Components
• Frontend: Represents the User Interface, built with HTML, CSS, JavaScript (with Bootstrap for responsiveness), and supports communication with the backend via the Fetch API.
• Backend: A RESTful API built with Node.js, Express, and TypeScript. Its structure is organized into several layers:
• Controllers: Handle HTTP requests and responses (located in backend/src/controllers). Specifically, components for task creation, deletion, update, and retrieval.
• Routes: Define the endpoints (e.g., backend/src/routes/task-routes.ts).
• Middleware: Contains error handling and other middleware functionalities (backend/src/middleware).
• Validators: Enforces business rules and sanitizes input data (backend/src/validators).
• Repositories: Handle data persistence and database interactions (backend/src/repositories).
• Database: The application uses MySQL, with configuration and connection handled in backend/db/database.ts.
• External and Supporting Services:
• Documentation: Swagger is used for API documentation (backend/config/swagger.ts).
• Containerization: Docker is used (see Dockerfile, docker-compose.yml) for both backend (and possibly database via docker-compose).
Relationships and Interactions Between Components
• Data Flow:
• The frontend sends HTTP requests (using JavaScript’s Fetch API) to the backend API endpoints.
• The backend receives these requests through its routes, passes them to the controllers, and uses middleware for error handling and validations.
• Controller logic utilizes repository functions for database operations (create, read, update, delete tasks).
• Results are returned to the frontend, displaying task data and statuses.
• Inter-component Communication:
• Within the backend, illustrate the flow from routes → controllers → repositories → MySQL database.
• A separate annotation for Docker, showing how containerized components (backend server and MySQL) interact, with external access points (e.g., host ports).
Architectural Patterns and Design Principles
• MVC (or a similar separation of concerns):
• Controllers encapsulate business logic,
• Separately organized middleware for cross-cutting concerns,
• Validators enforce data integrity.
• Layered Architecture: Clear separation between presentation (frontend), application logic (backend controllers/routes/middleware), and data persistence (repositories and database).
• Containerization: The Docker and docker-compose components indicate that the application is designed for isolated and consistent deployment environments.
Relevant Technologies
• Frontend: HTML5, CSS3, JavaScript (ES6+), Bootstrap 5.
• Backend: Node.js with Express, TypeScript.
• Database: MySQL.
• Documentation: Swagger.
• Testing Tools: Jest (as seen with configuration in backend/jest.config.js) for unit testing controllers and routes.
• Containerization: Docker and Docker Compose.