How teo-information/entregable works
Project Type and Purpose
• This is a full-stack CRUD web application (“Sistema de Gestión de Vendedores”) built with Node.js, Express and MySQL.
• It follows the classic MVC pattern to let users Create, Read, Update and Delete “vendedores” and their “contactos.”
File Structure Analysis
• Top-level:
• Dockerfile & GitHub Actions workflow (CI/CD)
• package.json / package-lock.json (Node dependencies, scripts)
• ventas.sql & crud-vendedores/database/*.sql (DB schema & stored procedures)
• crud-vendedores/: Main Express app
• app.js (entry point, middleware setup)
• config/db.js (MySQL connection)
• routes/ (Express routes)
• controllers/ (business logic)
• models/ (data models mapping to DB)
• public/ (static assets: HTML/CSS/JS)
• views/ (EJS templates)
README Insights
• Confirms Node v14+, MySQL 5.7+, and use of express, mysql2, ejs, body-parser.
• Describes DB initialization (ventas.sql import) and env-specific DB credentials in config/db.js.
• Shows project start scripts (npm start, npm run dev).
Main Components
a. Client Layer (Browser)
• Static UI (HTML/CSS/JS in public/) served by Express
• EJS templates (views/) rendered server-side
b. Application Layer (Express Server inside Docker container)
• Routes (contacto.routes.js, vendedores.js)
• Controllers (contacto.controller.js, vendedor.controller.js)
• Models (contacto.model.js, vendedor.model.js)
• Config (db.js establishing MySQL connection)
c. Data Layer (MySQL Database)
• Schema & tables defined in tables.sql
• Stored procedures in procedures.sql
d. Infrastructure / DevOps
• Docker container hosting the Node.js app
• GitHub Actions workflow for deployment
• Environment variables for DB credentials
Relationships and Data Flow
• Browser → HTTP Request → Express Route
• Route → Controller → Model (constructs SQL queries)
• Model → MySQL Server (executes SQL) → returns data
• Controller → selects view template or JSON → Response to Browser
• Static assets served directly from public/ folder
• Docker networking between App container and MySQL (could be in another container or managed service)
• CI/CD pipeline triggers Docker build & deploy via .github/workflows/deploy.yml
Architectural Patterns & Design Principles
• MVC separation:
• Models isolate data access
• Controllers encapsulate business logic, coordinate Models + Views
• Views (EJS) handle presentation logic
• Layered architecture: Presentation → Application → Data
• 12-factor app principles: config in environment, portability via Docker
• Use of stored procedures centralizes complex DB logic
Essential Elements
• Component names and brief descriptions (e.g., “vendedor.controller.js – business logic”)
• Methods of communication (HTTP, SQL queries)
• External services or tools (Docker, GitHub Actions, environment variables)
• Database schema overview: tables for vendedores/contactos, stored procedures