# david15barrera/frontend_reservationsystem architecture

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

- Interactive diagram: https://gitdiagram.com/david15barrera/frontend_reservationsystem
- Repository: https://github.com/david15barrera/frontend_reservationsystem

## Overview

##### Main Components
a. Frontend (Angular SPA): This is the heart of the project.
b. Feature Modules:
- Auth Module – handles login, register, MFA, password recovery and confirmation.
- Common User Module – includes components for appointments, dashboard, service details, reservation, and settings for everyday users.
- Manager Module – comprises administrative interfaces for appointments administration, billing, business settings, client management, graphics, reports, editing services/users, and more.
- Landing Module – contains the landing page and associated user navigation for entry into the system.
c. Shared Components and Layouts: Reusable navigation bars (auth-navbar, landing-navbar, navbar) and layouts (auth-layout, client-layout, landing-layout, manager-layout) that maintain the look and feel across modules.
d. Core Services and Interceptors:
- API configuration and upload services (located in src/app/config/services).
- Auth session service and guard logic (in src/app/core/) that govern authentication state and route protection.
- HTTP interceptors (aut.interceptor.ts) to manage token-based communication with backend APIs.
e. State Management:
- Using the store directory for managing session and preferences state (likely via NgRx or a similar pattern).

##### Relationships and Interactions
- The Angular entry point (main.ts and app.component) bootstraps the module which then loads routing configurations from app.routes.ts.
- The feature modules (auth, common-user, manager, landing) work in tandem using Angular routing; each module has its own routing module to define local navigation.
- Services like api-config.service and upload-img.service communicate with external or backend APIs.
- The authentication flow and state management services interact to control secured access and persist session information.
- Shared components (navbars, layout components) provide consistent UI and get reused across feature modules.
- Interceptors sit at the HTTP layer, intercepting outgoing API requests to add authentication tokens and handling errors.

##### Architectural Patterns/Design Principles
- Modular Design – Separation into distinct Angular modules (auth, common-user, manager, landing) emphasizes a modular design approach.
- Component-Based Architecture – Every view is encapsulated in components (with HTML, SCSS, TypeScript) ensuring separation of concerns.
- State Management – Use of a store (broken into session and preferences) for centralized state handling.
- Service-Oriented – Business logic is abstracted into services for API communication, authentication, and handling utility operations.
- Routing and Guards – Use of Angular’s routing along with guards for secure navigation.

##### Relevant Technologies and Frameworks
- Angular CLI (version 18.2.0) – the core framework.
- Tailwind (indicated by tailwind.config.js) for styling.
- Testing frameworks such as Karma for unit testing.
- The use of NgRx-like patterns for state management (action, reducer, selectors files in the store folder).

- A block for “Angular Frontend Application” which further decomposes into Modules:
- Auth Module (detailing components like login, register, MFA, etc.)
- Common-User Module (covering appointments, reservation, dashboard, settings, etc.)
- Manager Module (covering billing, business, reports, etc.)
- Landing Module (for the initial landing page experience)
- A block for “Shared Components & Layouts” to show navigation bars and layout templates.
- A block for “Core Services” showing API-config, upload-img service, and authentication/session services.
- A block labeled “HTTP Interceptor” to indicate its role in managing API requests.
- A block for “State Management” detailing session and preferences store components.
- Optionally, include a documentation block (from Proyecto2_AYD1_Documentacion) to reference architectural and database scripts that might be useful for overall system integration.

##### Detail Matters
- That each component, module, and service is clearly labeled so that its responsibility is immediately understandable.
- Role of Angular routing in connecting different modules.
- Separation of concerns — how authentication, user/manager functionality, and layout design are decoupled.
- Dependency flows: e.g., authentication components depend on core services; UI components depend on shared layouts.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A1("Angular Frontend Application"):::frontend
    subgraph "Modules"
        A2("Auth Module"):::module
        A3("Common User Module"):::module
        A4("Manager Module"):::module
        A5("Landing Module"):::module
    end
    subgraph "Shared Components & Layouts"
        B1("Shared Components"):::shared
        B2("Layouts"):::shared
    end
    subgraph "Core Services"
        C1("API & Upload Services"):::service
        C2("Auth Session Service"):::service
    end
    D("HTTP Interceptor"):::interceptor
    subgraph "Routing & Guards"
        E1("Angular Routing"):::routing
        E2("Auth Guard"):::routing
    end
    F("State Management"):::state
    G("Backend API"):::external

    %% Angular Frontend bootstraps modules
    A1 --> A2
    A1 --> A3
    A1 --> A4
    A1 --> A5

    %% Modules use Shared Components & Layouts
    A2 --> B1
    A2 --> B2
    A3 --> B1
    A4 --> B2
    A5 --> B1

    %% Modules interact with Routing & Core Services
    A2 --> E1
    A3 --> E1
    A4 --> E1
    A5 --> E1

    A2 --> C2
    A3 --> C1
    A4 --> C1
    A5 --> C1

    %% Auth module updates state management
    A2 --> F

    %% Core Services pass API calls through HTTP Interceptor to Backend API
    C1 --> D
    D --> G

    %% Routing configuration utilizes Auth Guard
    E1 --> E2
    E2 --> F

    %% Class Definitions
    classDef frontend fill:#D6EAF8,stroke:#1B4F72,stroke-width:2px;
    classDef module fill:#D5F5E3,stroke:#1D8348,stroke-width:2px;
    classDef shared fill:#D7BDE2,stroke:#6C3483,stroke-width:2px;
    classDef service fill:#FCF3CF,stroke:#B7950B,stroke-width:2px;
    classDef interceptor fill:#FAD7A0,stroke:#E67E22,stroke-width:2px;
    classDef routing fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
    classDef state fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef external fill:#EAECEE,stroke:#566573,stroke-width:2px;

    %% Click Events
    click A1 "https://github.com/david15barrera/frontend_reservationsystem/tree/main/src/"
    click A2 "https://github.com/david15barrera/frontend_reservationsystem/tree/main/src/app/core/auth"
    click A3 "https://github.com/david15barrera/frontend_reservationsystem/tree/main/src/app/modules/common-user"
    click A4 "https://github.com/david15barrera/frontend_reservationsystem/tree/main/src/app/modules/manager"
    click A5 "https://github.com/david15barrera/frontend_reservationsystem/tree/main/src/app/modules/landing"
    click B1 "https://github.com/david15barrera/frontend_reservationsystem/tree/main/src/app/shared/components"
    click B2 "https://github.com/david15barrera/frontend_reservationsystem/tree/main/src/app/shared/layouts"
    click C1 "https://github.com/david15barrera/frontend_reservationsystem/tree/main/src/app/config/services"
    click C2 "https://github.com/david15barrera/frontend_reservationsystem/tree/main/src/app/core/services"
    click D "https://github.com/david15barrera/frontend_reservationsystem/blob/main/src/app/interceptors/aut.interceptor.ts"
    click E1 "https://github.com/david15barrera/frontend_reservationsystem/blob/main/src/app/app.routes.ts"
    click E2 "https://github.com/david15barrera/frontend_reservationsystem/blob/main/src/app/core/guards/auth.guard.ts"
    click F "https://github.com/david15barrera/frontend_reservationsystem/tree/main/src/app/store"
```
