# brayan6072/mapeogestionresiduos architecture

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

- Interactive diagram: https://gitdiagram.com/brayan6072/mapeogestionresiduos
- Repository: https://github.com/brayan6072/mapeogestionresiduos

## Overview

##### Project type and purpose
- This is a single‑page, full‑stack‑style frontend application built with Angular (v18) and deployed via Firebase.
- It handles user authentication (including Google sign‑in), displays reports (last week/month), maps, manages “tasks” and “locations,” and presents a dashboard and home views.
- Firebase acts as the backend (Auth, Firestore/Database, Hosting).

##### File structure
- Top‑level config: angular.json, firebase.json, .firebaserc, package.json – points to an Angular build + Firebase deployment.
- src/app is organized into feature modules:
- auth (data‑access services, UI components, feature routes)
- dashboard (features & routes)
- home (features & routes)
- task (data‑access, features, UI)
- There is a core/auth.guard, shared (layout + auth‑state service), global styles and assets under public/.

##### README
- Standard Angular CLI instructions; no custom backend code – confirms that Firebase is the serverless backend.

##### Main components & their interactions
a. Frontend (Browser / Angular SPA)
- Layout & shared UI → loads at `/`
- Feature modules (Auth, Home, Dashboard, Task) controlled by app.routes.ts
- Components talk to data‑access services (e.g., auth.service.ts, reportes.service.ts, task.service.ts).
b. Backend / External Services
- Firebase Authentication (email/password, Google OAuth)
- Firestore or Realtime Database (for reports, tasks, ubicaciones)
- Firebase Hosting (serves the built Angular app)
- Google Maps API (used by MapaComponent)
c. Build & Deployment
- Angular CLI build pipeline → Webpack → dist/
- Firebase CLI deploy → Hosting + Rules

##### Architectural patterns & design principles
- Modular design: feature modules lazy‑loaded via routes.
- Separation of concerns:
- UI components (in feature/ui folders)
- Business logic/services (data‑access folders)
- Route definitions (feature/*.routes.ts)
- Guards (core/auth.guard.ts)
- Shared module provides cross‑cutting services (auth state) and layout.

##### Technologies & frameworks
- Angular (Router, Modules, Services, Guards)
- Firebase (Auth, Firestore/DB, Hosting)
- Google Maps JavaScript API (in MapaComponent)
- PNPM (lockfile)
- Karma/Jasmine for unit tests

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser / Angular SPA
    subgraph "Browser / Angular SPA"
        direction TB

        %% Core Module
        subgraph "Core Module"
            direction TB
            AuthGuard["Auth Guard"]:::frontend
        end

        %% Shared Module
        subgraph "Shared Module"
            direction TB
            Layout["Layout Component"]:::frontend
            AuthState["Auth-State Service"]:::frontend
        end

        %% Feature Modules
        subgraph "Auth Module"
            direction TB
            SignIn["Sign-In Component"]:::frontend
            SignUp["Sign-Up Component"]:::frontend
            Clasificaciones["Clasificaciones Component"]:::frontend
            GoogleBtn["Google Sign-In Button"]:::frontend
            Header["Header Component"]:::frontend
            Footer["Footer Component"]:::frontend
            LastWeek["Last-Week Reports"]:::frontend
            LastMonth["Last-Month Reports"]:::frontend
            Mapa["Mapa Component"]:::frontend
            UbicacionesList["Ubicaciones List"]:::frontend
            Sidebar["Sidebar Component"]:::frontend
            AuthService["Auth Service"]:::service
            ReportesRead["Reportes Read Service"]:::service
            ReportesPost["Reportes Post Service"]:::service
        end

        subgraph "Home Module"
            direction TB
            HomeShell["Home Shell"]:::frontend
            HomeReportes["Reportes View"]:::frontend
        end

        subgraph "Dashboard Module"
            direction TB
            DashboardShell["Dashboard Shell"]:::frontend
            FormUbic["Form-Ubicaciones"]:::frontend
            Historico["Histórico"]:::frontend
        end

        subgraph "Task Module"
            direction TB
            TaskForm["Task Form"]:::frontend
            TaskList["Task List"]:::frontend
            TableUI["Table UI"]:::frontend
            TaskService["Task Service"]:::service
        end

        %% App Shell & Routing
        AppComponent["App Component"]:::frontend
        AppConfig["App Config"]:::frontend
        AppRoutes["App Routes"]:::frontend
    end

    %% External Services
    subgraph "External Services"
        direction TB
        FirebaseAuth["Firebase Auth"]:::external
        FirestoreDB["Firestore/Realtime DB"]:::external
        GoogleMapsAPI["Google Maps API"]:::external
        FirebaseHosting["Firebase Hosting"]:::external
    end

    %% Build & Deploy Pipeline
    subgraph "Build & Deploy Pipeline"
        direction TB
        Source["src"]:::pipeline
        Build["ng build → dist"]:::pipeline
        Deploy["firebase deploy"]:::pipeline
    end

    %% Connections within SPA
    AuthGuard -->|guard| AppRoutes
    AppComponent -->|uses| Layout
    AppComponent -->|routes| AppRoutes

    %% Auth module connections
    SignIn -->|uses| AuthService
    SignUp -->|uses| AuthService
    Clasificaciones -->|uses| ReportesRead
    LastWeek -->|uses| ReportesRead
    LastMonth -->|uses| ReportesRead
    ReportesPost -->|writes| FirestoreDB
    Mapa -->|calls| GoogleMapsAPI
    UbicacionesList -->|uses| ReportesRead
    Sidebar -->|navigation| AppRoutes

    %% Home module
    HomeShell -->|displays| HomeReportes
    HomeReportes -->|reads| ReportesRead

    %% Dashboard module
    DashboardShell -->|hosts| FormUbic
    DashboardShell -->|hosts| Historico
    FormUbic -->|writes| FirestoreDB
    Historico -->|reads| FirestoreDB

    %% Task module
    TaskForm -->|uses| TaskService
    TaskList -->|uses| TaskService
    TableUI -->|renders| TaskList

    %% Services to external
    AuthService -->|OAuth tokens| FirebaseAuth
    ReportesRead -->|SDK call| FirestoreDB
    ReportesPost -->|SDK call| FirestoreDB
    TaskService -->|SDK call| FirestoreDB

    %% Pipeline connections
    Source -->|build| Build
    Build -->|deploy| Deploy
    Deploy -->|hosts| FirebaseHosting

    %% SPA hosted
    FirebaseHosting -->|serves| AppComponent

    %% Click Events
    click AuthGuard "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/core/auth.guard.ts"
    click Layout "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/shared/ui/layout.component.ts"
    click AuthState "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/shared/data-access/auth-state.service.ts"
    click AppComponent "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/app.component.ts"
    click AppConfig "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/app.config.ts"
    click AppRoutes "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/app.routes.ts"
    click SignIn "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/auth/features/sign-in/sign-in.component.ts"
    click SignUp "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/auth/features/sign-up/sign-up.component.ts"
    click Clasificaciones "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/auth/ui/clasificaciones/clasificaciones.component.ts"
    click GoogleBtn "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/auth/ui/google-button/google-button.component.ts"
    click Header "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/auth/ui/header/header.component.ts"
    click Footer "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/auth/ui/footer/footer.component.ts"
    click LastWeek "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/auth/ui/last-week-reports/last-week-reports.component.ts"
    click LastMonth "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/auth/ui/last-month-reports/last-month-reports.component.ts"
    click Mapa "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/auth/ui/mapa/mapa.component.ts"
    click UbicacionesList "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/auth/ui/ubicaciones/ubicaciones.component.ts"
    click AuthService "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/auth/data-access/auth.service.ts"
    click ReportesRead "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/auth/data-access/reportes.service.ts"
    click ReportesPost "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/auth/data-access/reportespost.service.ts"
    click TaskService "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/src/app/task/data-access/task.service.ts"
    click Source "https://github.com/brayan6072/mapeogestionresiduos/tree/frontend-mapa/src"
    click Build "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/angular.json"
    click Deploy "https://github.com/brayan6072/mapeogestionresiduos/blob/frontend-mapa/firebase.json"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,stroke-width:2px
    classDef service fill:#FFF4D0,stroke:#DAA520,stroke-width:2px
    classDef external fill:#D0FFD6,stroke:#228B22,stroke-width:2px
    classDef pipeline fill:#FFE4D0,stroke:#FF8C00,stroke-width:2px
```
