How gustavofringgg/todolist-backend works
Main Components
A. API Layer
• Entry Point (app.js)
• Route Handlers (/routes)
• Controllers Layer (/controllers)
• Authentication/Authorization Layer (/utils)
B. Data Layer
• Models Layer (/model)
• Database Connection Layer (/connections)
• Sequelize ORM
C. Supporting Infrastructure
• Error Handling System
• Success Response Handler
• JWT Authentication System
• Swagger Documentation
[Client Applications] → [API Gateway Layer]
• ↑ ↓
• [Auth Layer]──┘
• ↓
• [Controllers Layer (Business Logic)]
• ↓
• [Data Access Layer (Models)]
• ↓
• [Database Connection Layer (Sequelize)]
• ↓
• [Database (SQL Database)]
Component Details
a. API Gateway Layer (Blue)
• Routes: /todo and /users
• Swagger documentation integration
• To error handling middleware
b. Authentication Layer (Yellow)
• JWT Token handling (JwtToken.js)
• Token verification (TokenCheck.js)
• To protected routes
c. Controllers Layer (Green)
• TodoController
• UserController
• Connection to error handling (handleErrorAsync.js)
• Success response handling (handleSuccess.js)
d. Data Layer (Purple)
• Todo Model
• User Model
• Sequelize connection
• Model associations
Important Flows to Highlight
• Authentication Flow:
Request → TokenCheck → Controller → Response
• CRUD Operations Flow:
Request → Route → Controller → Model → Database
Technical Details
• Node.js/Express.js as the main framework
• Sequelize ORM for database operations
• JWT for authentication
• Swagger for API documentation
Specific Implementation Notes
• Error handling flows with red lines
• Middleware chain in the request processing pipeline