How dengue-proyecto/dengue-frontend works
Project Type and Purpose
• This is a single-page front-end application built with Angular (v19.2.7).
• It provides a UI for user onboarding (register/login), data entry (form/evaluations), and results display (result/result1), likely interacting with a back-end REST API.
File Structure Analysis
• Top-level: Angular CLI config files (angular.json, tsconfig.json), package.json, public/_redirects (Netlify or static hosting).
• src/app:
• app.module.ts + main.ts → application bootstrap
• app-routing.module.ts → central router
• auth.guard.ts, auth.interceptor.ts, auth.service.ts → authentication flow
• feature folders (landing, login, register, form, evaluations, result, result1) each containing Angular components (module, .ts/.html/.css/.spec.ts)
• shared components (navbar, footer)
• src/environments: environment.ts/prod.ts → API base URLs and feature flags
• External typings (html2pdf.d.ts) hint at a PDF-generation utility
a. User & Browser
b. Angular SPA (hosted as static site)
• Entry point: index.html → main.ts → AppModule
• RouterOutlet directing to feature modules:
• LandingModule
• AuthModule (LoginComponent, RegisterComponent)
• FormModule (FormComponent)
• EvaluationsModule (EvaluationsComponent)
• ResultModule(s) (ResultComponent, Result1Component)
• Shared: Navbar, Footer
• Services layer:
• AuthService (login/register tokens)
• HTTP Interceptor (attach JWT to outgoing requests)
• Utility: html2pdf integration
c. External REST API
• Hosted back-end (URL from environment.ts)
• Endpoints: /auth/login, /auth/register, /evaluations, /data/form, /results
d. Deployment/Hosting
• Static files served via CDN/Netlify (public folder + dist)
Interactions & Data Flow
• User clicks a route → Angular Router loads corresponding module/component
• Components call AuthService or other domain services → HTTPInterceptor attaches token → HTTP call to REST API
• API responses feed data back into components → UI updates
• Optionally generate PDF via html2pdf library in client
Architectural Patterns & Design Principles
• Modular structure: feature modules + lazy-loading where appropriate (explicit module.ts files)
• Separation of concerns: presentation (components) vs business logic (services) vs routing (guard/interceptor)
• Environment-based configuration for dev vs prod API endpoints
• HTTP interceptor pattern for cross-cutting concerns (authentication header injection)
Must-Include
• Callouts for environment configuration (dev vs prod)