# dengue-proyecto/dengue-frontend architecture

> Architecture diagram of the GitHub repository dengue-proyecto/dengue-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dengue-proyecto/dengue-frontend
- Repository: https://github.com/dengue-proyecto/dengue-frontend

## Overview

##### 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)

## Diagram (Mermaid)

```mermaid
flowchart TB
    EndUser["End User"]:::user
    Browser["Browser"]:::browser
    EndUser --> Browser
    Browser --> SPA["Angular SPA"]:::spa

    subgraph "Angular SPA (src/app)"
        direction TB
        Entry["index.html\nmain.ts"]:::entry
        Router["app-routing.module.ts"]:::config
        Entry --> Router

        subgraph "Feature Modules"
            direction TB
            Landing["LandingComponent"]:::feature
            Login["LoginComponent"]:::feature
            Register["RegisterComponent"]:::feature
            Form["FormComponent"]:::feature
            Evaluations["EvaluationsComponent"]:::feature
            Result["ResultComponent"]:::feature
            Result1["Result1Component"]:::feature
        end

        subgraph "Shared Components"
            direction TB
            Navbar["NavbarComponent"]:::shared
            Footer["FooterComponent"]:::shared
        end

        subgraph "Services & Guards"
            direction TB
            AuthService["AuthService"]:::service
            AuthGuard["AuthGuard"]:::service
            AuthInterceptor["AuthInterceptor"]:::service
        end

        subgraph "Utilities & Models"
            direction TB
            HTML2PDF["html2pdf.d.ts"]:::util
            DatosCmp["DatosCmp Model"]:::util
        end
    end

    SPA --> Hosting["CDN / Netlify"]:::host
    SPA --> API["External REST API"]:::api
    Hosting --> Browser

    Router --> Landing
    Router --> Login
    Router --> Register
    Router --> Form
    Router --> Evaluations
    Router --> Result
    Router --> Result1

    Form -->|Protected by| AuthGuard
    Evaluations -->|Protected by| AuthGuard
    Result -->|Protected by| AuthGuard
    Result1 -->|Protected by| AuthGuard

    Login -->|calls| AuthService
    Register -->|calls| AuthService

    Landing -->|uses| Navbar
    Login -->|uses| Navbar
    Register -->|uses| Navbar
    Form -->|uses| Navbar
    Evaluations -->|uses| Navbar
    Result -->|uses| Navbar
    Result1 -->|uses| Navbar
    Landing -->|uses| Footer
    Login -->|uses| Footer
    Register -->|uses| Footer
    Form -->|uses| Footer
    Evaluations -->|uses| Footer
    Result -->|uses| Footer
    Result1 -->|uses| Footer

    AuthService -->|POST /auth/login, POST /auth/register| API
    Form -->|GET /data/form| API
    Evaluations -->|GET /evaluations| API
    Result -->|GET /results| API
    Result1 -->|GET /results| API

    AuthInterceptor -->|intercepts| API

    HTML2PDF --> Form
    HTML2PDF --> Result
    DatosCmp --> Form
    DatosCmp --> Evaluations

    classDef user fill:#FFE599,stroke:#333,stroke-width:1px;
    classDef browser fill:#FFF2CC,stroke:#333,stroke-width:1px;
    classDef spa fill:#D9EAD3,stroke:#333,stroke-width:1px;
    classDef entry fill:#C9DAF8,stroke:#333,stroke-width:1px;
    classDef config fill:#C9DAF8,stroke:#333,stroke-width:1px;
    classDef feature fill:#9FC5E8,stroke:#333,stroke-width:1px;
    classDef shared fill:#A4C2F4,stroke:#333,stroke-width:1px;
    classDef service fill:#B6D7A8,stroke:#333,stroke-width:1px;
    classDef util fill:#D5A6BD,stroke:#333,stroke-width:1px;
    classDef api fill:#CCCCCC,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5;
    classDef host fill:#F9CB9C,stroke:#333,stroke-width:1px;

    click SPA "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/app.module.ts"
    click Entry "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/index.html"
    click Router "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/app-routing.module.ts"
    click Landing "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/landing/landing.component.ts"
    click Login "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/login/login.component.ts"
    click Register "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/register/register.module.ts"
    click Register "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/register/register.component.ts"
    click Form "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/form/form.module.ts"
    click Form "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/form/form.component.ts"
    click Evaluations "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/evaluations/evaluations.module.ts"
    click Evaluations "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/evaluations/evaluations.component.ts"
    click Result "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/result/result.component.ts"
    click Result1 "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/result1/result1.component.ts"
    click Navbar "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/navbar/navbar.component.ts"
    click Footer "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/footer/footer.component.ts"
    click AuthService "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/auth.service.ts"
    click AuthGuard "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/auth.guard.ts"
    click AuthInterceptor "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/auth.interceptor.ts"
    click DatosCmp "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/app/models/datos-cmp.ts"
    click HTML2PDF "https://github.com/dengue-proyecto/dengue-frontend/blob/main/src/html2pdf.d.ts"
    click Hosting "https://github.com/dengue-proyecto/dengue-frontend/tree/main/public/_redirects"
```
