How jhpenag95/quickpoll works
Project Type and Purpose
• This is a monolithic, full-stack Laravel web application for creating, distributing, and reporting on surveys (encuestas).
• The file tree shows a typical Laravel MVC structure: controllers under app/Http/Controllers, Eloquent models under app/Models, Blade views under resources/views, public assets under public/, and database migrations for tables like encuestas, preguntas, respuesta_encuesta, reporte, and a WhatsApp integration table.
Main Components
a. Client Layer
• Web browser (renders HTML, CSS, JS)
• Frontend assets served from public/ (CSS, JS, images)
• Blade templates in resources/views
b. Web Server & Routing
• Apache/Nginx directs requests to public/index.php
• Laravel’s routing (routes/web.php) dispatches to controllers
c. Application Layer
• Controllers (app/Http/Controllers) implement HTTP endpoints: IndexController, LoginController, RegistroEmpresaController, encuestasController, PreguntasController, ReportesController, DashboardController, UserController
• Middleware (registered in app/Http/Kernel.php) for auth, session, CSRF
• Service Providers (app/Providers) boot services and bind dependencies
d. Domain & Data Layer
• Eloquent Models (app/Models): Encuestas, Preguntas, OpcionesRespuesta, RespuestaEncuesta, DetalleRespuesta, Reporte, IntegracionWhatsapp, User, registroEmpresa
• MySQL (or configured DB in config/database.php) with tables created by database/migrations
• Database seeds (database/seeders) for initial data
e. Infrastructure Services
• Cache and session storage (config/cache.php, config/session.php)
• Queue jobs (config/queue.php) for background tasks
• Mail (config/mail.php) and other external services (config/services.php)
• File storage (local, public) under storage/app and storage/app/public
• WhatsApp integration via a dedicated table and likely external API calls
Relationships and Data Flow
• Browser → HTTP request → Web server → public/index.php → Laravel Router → Controller action
• Controller uses Models to query/update DB → returns data to Controller → passes to Blade view or JSON response
• Blade view + assets → HTTP response → Browser
• Background jobs (queues) may run asynchronously for tasks like sending survey links via WhatsApp or email
• File uploads/downloads handled via Storage facade, pointing to storage/app/private or storage/app/public
Architectural Patterns and Principles
• MVC (Model–View–Controller) separation
• Eloquent ORM for data access and relationships
• Dependency Injection and Service Container (Service Providers)
• Configuration over convention via config/*.php and .env
• PSR-4 autoloading (composer.json)
• Asset bundling via Vite (vite.config.js)
• Database migrations for schema version control