How afranklinromero/sidepo works
1. Overall shape
- This is a single Laravel monolith, not a multi-service system. The core architecture is the standard Laravel request lifecycle: HTTP request → middleware → controller → Eloquent model/database → Blade response or file output.
2. Primary domain
- The domain appears to be a Spanish-language complaint/case management system. The main business entities are Caso, Registro, Seguimiento, Archivo, Archivodenuncia, Departamento, Municipio, and User/Role.
3. Request entrypoints
- Web traffic is handled through routes/web.php and the Laravel HTTP kernel. The app also includes routes/api.php, but the repository structure suggests the main product is server-rendered web UI rather than a JSON API.
4. Controller layer
- Most application behavior is concentrated in feature controllers under app/Http/Controllers, especially CRUD-style controllers for each domain entity.
- There are also specialized controllers for auth, admin access, QR code generation, reports, and case follow-up. This indicates the controllers are the main orchestration boundary, with little evidence of a separate service layer.
5. Presentation layer
- Views are primarily Blade templates under resources/views, grouped by domain (caso, registro, seguimiento, archivo, municipio, etc.).
- Shared UI is in layouts/app.blade.php, with additional pages for login/register/password reset, menus, dashboards, and case-specific views such as conpdf, sinpdf, and ver.
6. Data model and persistence
- Persistence is handled through Eloquent models in app/Models and migrations in database/migrations.
- The migration set shows the key schema objects: cases, geography tables, follow-up records, denunciation archives, roles/permissions, and user auth tables. This suggests a relational database with normalized reference data for departments and municipalities.
7. Authorization model
- Authentication uses Laravel’s built-in auth stack, visible in the Auth controllers and middleware.
- Authorization is role-based: the presence of permission.php, create_permission_tables, create_roles, Role, and ModelHasRole indicates a permissions package/pattern similar to Spatie-style RBAC. There is also a custom AdminAuth middleware for admin-only access.
8. Document and file handling
- The app manages documents/files through Archivo, Archivodenuncia, and the storage/app/public area.
- config/dompdf.php and PDF-related case views strongly suggest server-side PDF generation for case records or printable reports.
- public/img and resources/views/caso/*pdf* indicate the UI supports generating/exporting case documents rather than only viewing records online.
9. Geography/reference data
- Departamento and Municipio are separate domain objects, likely used as lookup/reference data linked to complaints, registries, or users.
- This creates a hierarchical geographic boundary in the data model and likely drives form selection and filtering in the UI.
10. Reporting and operational views
- ReporteController plus resources/views/reporte/index.blade.php suggest a reporting dashboard or listing layer over the core case data.
- HomeController, AdminController, menu.blade.php, and administrator.blade.php indicate a role-specific landing/dashboard experience for operators and admins.
11. Frontend assets
- Frontend build tooling is present via Vite, with CSS/Sass and a small amount of JavaScript/Vue (resources/js, resources/sass, resources/js/components).
- The frontend is mostly server-rendered Blade, with modest asset bundling rather than a SPA architecture.
12. Infrastructure and runtime boundaries
- File storage is local and Laravel-managed (storage/, public/), not an external object store.
- The application relies on standard Laravel subsystems: sessions, cache, logging, mail, queue, broadcasting, and Sanctum are configured, but the repo structure does not indicate heavy use of async jobs or realtime features.
13. What to draw in an architecture diagram
- A browser/client boundary feeding a Laravel web app.
- Inside the app: auth/admin middleware, CRUD controllers, RBAC authorization, Eloquent models, Blade views, and document/PDF/file generation.
- Downstream: relational database for domain and auth tables, local filesystem for uploads/public assets, and optional PDF output generation.
Main entry points: web.php Web routes · Models Domain models · ArchivoController.php Archivos · caso Case views
Components 21
Entry & HTTP
Request entrypoints and HTTP middleware
- Web routes · Main browser entrypoints and route dispatch
routes/web.php - API routes · Secondary API surface
routes/api.php - HTTP kernel · Middleware pipeline for web requests
app/Http/Kernel.php - Admin auth · Admin-only access guard
app/Http/Middleware/AdminAuth.php
Application
Controllers, models, and authorization
- Auth flow · Login, register, password reset, verification
app/Http/Controllers/Auth - Home admin · Landing pages and operator/admin dashboard
app/Http/Controllers/HomeController.php - Casos · Core case lifecycle and case views
app/Http/Controllers/CasoController.php - Registros · Complaint/record CRUD
app/Http/Controllers/RegistroController.php - Seguimiento · Case follow-up and tracing
app/Http/Controllers/SeguimientoController.php - Archivos · File and document management
app/Http/Controllers/ArchivoController.php - Archivodenuncia · Complaint archive documents
app/Http/Controllers/ArchivodenunciaController.php - Geography · Departamento and municipio management
app/Http/Controllers/DepartamentoController.php - Roles & users · Users, roles, and role assignment admin
app/Http/Controllers/UserController.php - Reports & QR · Reporting and QR code generation
app/Http/Controllers/ReporterController.php - Domain models · Caso, Registro, Seguimiento, Archivo, geography, users, and RBAC models
app/Models
Presentation
Blade views and frontend assets
- Case views · Case, registry, follow-up, archive, and PDF pages
resources/views/caso - Shared UI · Layout, menu, dashboards, auth pages, and report screens
resources/views/layouts/app.blade.php - Frontend assets · Bundled CSS, Sass, JS, and Vue components
resources/js/app.js
Data & Storage
Database schema and file storage
- Schema migrations · Users, cases, geography, RBAC, seguimiento, and archivodenuncia tables
database/migrations - Relational DB · Primary persistence for domain, auth, and RBAC data
config/database.php - Local storage · Uploads, public files, logs, and generated documents
storage/app/public
Connections 32
- Web routes → HTTP kernel: dispatch · Web requests enter the middleware pipeline
- API routes → HTTP kernel: dispatch · API requests also pass through HTTP middleware
- HTTP kernel → Admin auth: protects · Admin routes use custom access control
- Web routes → Auth flow: auth pages · Login and registration routes map to auth controllers
- Web routes → Home admin: dashboard · Landing and operator pages are routed here
- Web routes → Casos: CRUD · Case management routes
- Web routes → Registros: CRUD · Record management routes
- Web routes → Seguimiento: CRUD · Follow-up routes
- Web routes → Archivos: CRUD · File management routes
- Web routes → Archivodenuncia: CRUD · Complaint archive document routes
- Web routes → Geography: CRUD · Geography management routes
- Web routes → Roles & users: admin · User and role administration routes
- Web routes → Reports & QR: ops · Reports and QR utilities
- Home admin → Domain models: reads · Dashboard aggregates domain data
- Casos → Domain models: uses · Case controller persists and loads Eloquent models
- Registros → Domain models: uses · Registry controller persists and loads Eloquent models
- Seguimiento → Domain models: uses · Follow-up controller persists and loads Eloquent models
- Archivos → Domain models: uses · File controller persists and loads Eloquent models
- Archivodenuncia → Domain models: uses · Complaint document controller persists and loads Eloquent models
- Geography → Domain models: uses · Geography controllers persist and load reference models
- Roles & users → Domain models: uses · Role and user admin relies on RBAC models
- Reports & QR → Domain models: reads · Reports and QR generation use case data
- Domain models → Schema migrations: defined by · Schema migrations define the persistent tables
- Domain models → Relational DB: persists · Eloquent models store data in the relational database
- Archivos → Local storage: files · Uploads and generated documents go to local storage
- Archivodenuncia → Local storage: files · Complaint archives are stored locally
- Case views → Archivos: renders · Case and document screens are served by CRUD controllers
- Shared UI → Home admin: renders · Shared dashboards and auth screens are rendered by controllers
- Casos → Case views: returns · Case controller returns Blade pages and PDF variants
- Registros → Case views: returns · Registry pages live with the domain views
- Seguimiento → Case views: returns · Follow-up pages live with the domain views
- Frontend assets → Shared UI: supports · Bundled frontend assets enhance Blade pages