# andres9703/gourmet101-client architecture

> Architecture diagram of the GitHub repository andres9703/gourmet101-client, 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/andres9703/gourmet101-client
- Repository: https://github.com/andres9703/gourmet101-client

## Overview

##### Main Components – Identify and List
a. Presentation Layer:
- This folder (“src/app/presentation”) contains all the UI components and pages for different parts of the app, such as login, feed, profile, error pages, and shared components (e.g., navbar).
- Individual UI modules (like login, feed, profile) as self-contained blocks that interact with other layers through defined interfaces.

b. Domain Layer:
- This layer is where the business logic resides, including definitions for the user entity and the use case functions (for example, “get-user.usecase”).
- It forms the heart of the application where rules and logic are decoupled from framework specifics.

c. Data Layer:
- Located under “src/app/data,” this layer includes models, datasources (with remote API calls), mappers, and repository implementations.
- It acts as an adapter between the domain layer and external data sources or web APIs.

d. Core / Authentication:
- “src/app/core/auth” contains authentication guards and services, ensuring that access control is handled properly across the application.

e. Configuration / Bootstrapping:
- Entry points such as “src/main.ts”, “src/server.ts”, “angular.json”, and various TypeScript configurations are responsible for bootstrapping and configuring the Angular application.

##### Architect the Relationships and Data Flow
a. The Presentation Layer (UI) interacts with the Domain Layer to execute user-intended actions. For instance, a user action in a presentation component like “login” or “feed-home” dispatches a use case from the Domain layer.
b. The Domain Layer communicates with repository interfaces; these define contracts that the Data Layer fulfills.
c. The Data Layer implements these repository interfaces and also handles communication with any external data sources (like remote APIs), performing necessary mapping between API formats and domain objects.
d. Authentication services in the Core layer are used by both Presentation (to protect routes) and Domain (to validate user interactions).

##### Architectural Patterns & Design Principles
a. Clean Architectural separation: Each layer is isolated—Presentation depends on Domain abstractions; Domain remains agnostic to data access implementations.
b. Dependency Injection: Angular’s dependency injection can be represented to show how components receive instances of services (e.g., auth or repository classes).
c. Use of Guards & Routes: The “auth-guard” files in the Core layer indicate that route protection is employed to restrict access to certain presentation components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Configuration/Bootstrapping"
        AC["angular.json"]:::config
        MT["src/main.ts"]:::config
        ST["src/server.ts"]:::config
        TC["tsconfig.json"]:::config
        AC --> MT
        MT --> ST
        ST --> TC
    end

    TC --> Pres["Presentation Layer (UI Components)"]:::presentation
    Pres -->|"triggers_usecases"| Dom["Domain Layer (Business Logic)"]:::domain
    Dom -->|"calls_repository"| Dat["Data Layer (Repository Implementations)"]:::data
    Dat -->|"fetches_data"| Ext["External APIs/Data Sources"]:::external

    Pres -->|"route_protection"| Auth["Core/Authentication Services"]:::core
    Dom -->|"auth_validation"| Auth
    Auth -->|"auth_response"| Pres

    click AC "https://github.com/andres9703/gourmet101-client/blob/main/angular.json"
    click MT "https://github.com/andres9703/gourmet101-client/blob/main/src/main.ts"
    click ST "https://github.com/andres9703/gourmet101-client/blob/main/src/server.ts"
    click TC "https://github.com/andres9703/gourmet101-client/blob/main/tsconfig.json"
    click Pres "https://github.com/andres9703/gourmet101-client/tree/main/src/app/presentation"
    click Dom "https://github.com/andres9703/gourmet101-client/tree/main/src/app/domain"
    click Dat "https://github.com/andres9703/gourmet101-client/tree/main/src/app/data"
    click Auth "https://github.com/andres9703/gourmet101-client/tree/main/src/app/core/auth"

    classDef presentation fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef domain fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef data fill:#FFFF99,stroke:#000,stroke-width:2px;
    classDef core fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef config fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef external fill:#E0FFFF,stroke:#000,stroke-width:2px,stroke-dasharray: 5 5;
```
