How jjaracanales/desarrollo_software_web_i_ev2 works
Project Type and Purpose
– This is a monolithic full-stack web application (Laravel 12 with PHP 8.2) providing a JWT-protected CRUD for “Proyectos” (projects) plus public home and authentication pages. Data is stored in MySQL. It also exposes the same functionality via an API.
File Structure Analysis
– Top-level folders:
• app/
– Http/Controllers (AuthController, HomeController, ProyectoController)
– Http/Middleware (JWTAuthMiddleware)
– Models (User, Proyecto)
– Services (UFService – external UF data fetch)
• bootstrap/ (Laravel bootstrap, middleware aliases)
• config/ (app, auth, database, etc.)
• database/ (migrations, factories, seeders)
• public/ (index.php front controller, static assets)
• resources/ (Blade views, JS bootstrap)
• routes/ (web.php for UI, api.php for REST)
• storage/ (logs, cache, sessions, file storage)
– Build/deploy scripts: build.sh, vercel-*.json, init-db.php, phpunit.xml.
– Composer files define PHP dependencies.
README Insights
– Describes features (JWT auth, protected CRUD).
– Tech stack: Laravel 12, PHP 8.2.29, MySQL.
– Authentication via JWT in cookie or Bearer header.
– No seeders used in EV2.
Main Components
1) Client (Browser)
• Displays Blade views (login, register, proyectos pages)
• Stores JWT cookie or includes Bearer token for API calls
2) Web Server / Front Controller
• Apache/Nginx → public/index.php → bootstrap/app.php
3) Laravel Application
– Routing Layer
• routes/web.php (UI)
• routes/api.php (JSON API)
– Middleware Layer
• JWTAuthMiddleware (protects routes)
– Controller Layer
• AuthController (register/login, JWT issuance)
• HomeController (public home)
• ProyectoController (CRUD)
– Service Layer
• UFService (fetch Unidad de Fomento from external API for display component)
– Model Layer (Eloquent ORM)
• User (users table)
• Proyecto (proyectos table)
– View Layer
• Blade templates (resources/views) and JS bootstrap
4) Database
• MySQL (tables: users, proyectos, cache, jobs)
5) Storage & Cache
• File‐based cache, sessions, logs in storage/
6) External Services
• UF external API (via UFService)
Relationships & Data Flows
– Browser → HTTP request → public/index.php → Laravel Router
– Router → Middleware (JWTAuthMiddleware on protected routes)
– Middleware → Controllers →
• on CRUD/actions: Controllers use Models → MySQL
• on UF display: Controller (or view component) invokes UFService → external UF API
– Controllers return Views (HTML) or JSON (API routes) → Browser
– Views embed JS bootstrap and Blade components; respond to user actions
– Laravel uses storage/ for session state and caching
Architectural Patterns & Principles
– MVC (Model-View-Controller)
– Layered architecture (Routing → Middleware → Controllers → Services → Models → DB)
– Separation of concerns:
• Auth logic in AuthController + JWTAuthMiddleware
• Business logic in Services (UFService)
• Data access via Eloquent Models
– RESTful API layering on top of same controllers