How cristhianmorales19/sistema-gestion-agricola works
Project Type and Purpose
• This is a full-stack web application (“Sistema de Gestión Agrícola”) that provides an integrated platform for managing personnel, attendance, payroll, productivity, and reports in the agricultural sector.
• Frontend: React + TypeScript
• Backend: Node.js (Express) + TypeScript
• Database: MySQL
File Structure Analysis
• Top‐level folders:
• frontend/ – React app
• backend/ – Express API
• database/ – SQL schemas, migrations, seeds
• Each of frontend/src and backend/src uses “caracteristicas” subfolders, reflecting the Screaming Architecture (feature-first, domain-driven).
• Configuration and shared code are likely under infraestructura/ and compartido/ (per README—even if not shown in the snippet).
• A .env.example and package.json in backend; package.json in frontend.
README Insights
• Confirms Screaming Architecture: domains (“personal”, “asistencia”, “nomina”, “productividad”, “reportes”, “auth”) are first-class folders.
• Tech stack: React, Express, MySQL, JWT, Bcrypt, Winston, Axios, React Router, Material-UI/Tailwind, Jest, ESLint/Prettier, Nodemon.
• API endpoints are grouped by feature (e.g., /api/auth, /api/personal, /api/asistencia, /api/nomina).
a. Main Components
• Client Browser / Mobile App – hosts the React SPA
• Frontend (React) – UI layers divided by feature modules
• API Gateway (Express) – single HTTP entrypoint (/api)
• Backend Feature Modules – Auth, Personal, Asistencia, Nómina, Productividad, Reportes
• Database (MySQL) – data persistence, migrations, seeds
• External Services / Libraries – JWT service, Bcrypt encryption, Winston logging
b. Relationships & Data Flow
1. User → React UI (via React Router & Material-UI)
2. React UI → Axios HTTP calls → Express API (/api/*)
3. Express routes delegate to feature controllers → services → repositories
4. Backend → MySQL (via an ORM or query layer)
5. Auth flows: login/register endpoints generate JWT → returned to client → client stores token → included in Authorization header on subsequent requests
6. Logging: Winston captures request/response and errors → log files or external store
c. Architectural Patterns & Principles
• Screaming Architecture / Feature-First: directories named by business domain
• Layered / Clean Architecture: controllers → services → repositories → database
• Single Monolithic API with clear feature modules, not microservices
• JWT-based stateless authentication
• Migration/seed versioning for database schema
d. Technologies & Frameworks
• Frontend: React, React Router, Axios, TypeScript, Material-UI/Tailwind
• Backend: Node.js, Express.js, TypeScript, JWT, Bcrypt, Winston
• Database: MySQL (8.0+), migration scripts