How marcelochia/api-controle-gastos works
Main Components
a) Client Layer:
• External API consumers
• Supported HTTP methods (GET, POST, PUT, DELETE)
b) Application Layer:
• Authentication System (evident from LoginController and auth middleware)
• API Controllers Layer
• ExpensesController
• IncomesController
• SummaryController
• LoginController
• Request Validation Layer (HTTP/Requests folder)
• Resource Layer (for API responses)
• Models Layer
• User
• Expense
• Income
• Category
c) Database Layer:
• MySQL Database
• Key Tables:
• users
• expenses (despesas)
• incomes (receitas)
• categories (categorias)
[Client Layer]
• ↕
[Application Layer]
• ↕
[Database Layer]
Specific Elements
a) Security & Middleware Layer:
• Authentication flow
• CSRF protection
• API middleware stack
b) Core Business Logic:
• Expense management flow
• Income management flow
• Categorization system
• Summary generation
c) Data Flow:
• Request/response cycle
• Validation steps
• Resource transformation process
Important Relationships to Highlight
• Authentication flow between client and LoginController
• Request validation through FormRequests
• Model relationships (Category to Expense)
• Resource transformations for API responses
Technical Details
• PHP 8.1 environment
• Laravel 9 framework
• MySQL 8 database
• RESTful API endpoints
• Authentication mechanism
• Resource transformation layer