# jomaroto/tani-front architecture

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

- Interactive diagram: https://gitdiagram.com/jomaroto/tani-front
- Repository: https://github.com/jomaroto/tani-front

## Overview

##### Project type and purpose
- This is a single‑page, full‑client Angular application (“FrontEnd TANI”) that provides the user interface for the TANI web system. It handles authentication, product browsing, shopping cart (“carrito”), order placement (“pasarela”), profile management, and an admin back‑office. It talks to a separate RESTful backend for data and persistence.

##### File structure
- Top‑level Angular configuration files (angular.json, tsconfig.json), environment configs (src/environments), and assets.
- src/app contains:
- _helpers: interceptors (JWT, error), guards, a fake‑backend initializer for local development.
- _models: domain objects (Account, Product, Pedido, etc.).
- _services: HTTP services mapping models to backend endpoints (account.service, product.service, pedido.service).
- _components: shared UI pieces (Alert).
- Feature modules:
– account (login/register flows)
– admin (accounts management, overview)
– home, product (listing & CRUD), carrito, pasarela, profile, terms
- App routing and root app.module.

## Diagram (Mermaid)

```mermaid
graph TB
    User["Browser / User"]:::external
    subgraph "UI Layer (Angular SPA)"
        direction TB
        AppComponent["App Component"]:::ui
        AccountModule["Account Module"]:::ui
        AdminModule["Admin Module"]:::ui
        HomeModule["Home Module"]:::ui
        ProductModule["Product Module"]:::ui
        CarritoComponent["Carrito Component"]:::ui
        PasarelaComponent["Pasarela Component"]:::ui
        ProfileModule["Profile Module"]:::ui
        TermsComponent["Terms Component"]:::ui
    end

    subgraph "Core & Services"
        direction TB
        AlertComponent["Alert Component"]:::shared
        subgraph "Helpers / Interceptors"
            JWTInterceptor["JWT Interceptor"]:::helper
            ErrorInterceptor["Error Interceptor"]:::helper
            AuthGuard["Auth Guard"]:::helper
            FakeBackend["Fake Backend"]:::helper
        end
        subgraph "Services"
            AccountService["Account Service"]:::service
            ProductService["Product Service"]:::service
            PedidoService["Pedido Service"]:::service
            AlertService["Alert Service"]:::service
        end
    end

    subgraph "External"
        direction TB
        API["REST API Backend"]:::api
        DB["Database"]:::db
    end

    User -->|navigates| AppComponent
    AppComponent -->|routes to| AccountModule
    AppComponent -->|routes to| AdminModule
    AppComponent -->|routes to| HomeModule
    AppComponent -->|routes to| ProductModule
    AppComponent -->|routes to| CarritoComponent
    AppComponent -->|routes to| PasarelaComponent
    AppComponent -->|routes to| ProfileModule
    AppComponent -->|routes to| TermsComponent

    AccountModule -->|uses| AccountService
    AdminModule -->|uses| AccountService
    HomeModule -->|uses| ProductService
    ProductModule -->|uses| ProductService
    CarritoComponent -->|uses| PedidoService
    PasarelaComponent -->|uses| PedidoService
    ProfileModule -->|uses| AccountService

    AccountService -->|HTTP| JWTInterceptor
    ProductService -->|HTTP| JWTInterceptor
    PedidoService -->|HTTP| JWTInterceptor
    AlertService -->|HTTP| JWTInterceptor

    JWTInterceptor -->|passes request| ErrorInterceptor
    ErrorInterceptor -->|passes request| FakeBackend
    FakeBackend -->|forwards| API

    API -->|fetch\/persist| DB

    click User "https://github.com/jomaroto/tani-front/blob/main/src/index.html"
    click User "https://github.com/jomaroto/tani-front/blob/main/src/main.ts"
    click User "https://github.com/jomaroto/tani-front/blob/main/src/styles.css"
    click AppComponent "https://github.com/jomaroto/tani-front/blob/main/src/app/app.component.ts"
    click AccountModule "https://github.com/jomaroto/tani-front/blob/main/src/app/account/account.module.ts"
    click AdminModule "https://github.com/jomaroto/tani-front/blob/main/src/app/admin/admin.module.ts"
    click HomeModule "https://github.com/jomaroto/tani-front/blob/main/src/app/home/home.component.ts"
    click ProductModule "https://github.com/jomaroto/tani-front/blob/main/src/app/product/product.module.ts"
    click CarritoComponent "https://github.com/jomaroto/tani-front/blob/main/src/app/carrito/carrito.component.ts"
    click PasarelaComponent "https://github.com/jomaroto/tani-front/blob/main/src/app/pasarela/pasarela.component.ts"
    click ProfileModule "https://github.com/jomaroto/tani-front/blob/main/src/app/profile/profile.module.ts"
    click TermsComponent "https://github.com/jomaroto/tani-front/blob/main/src/app/terms/terms.component.ts"
    click AlertComponent "https://github.com/jomaroto/tani-front/blob/main/src/app/_components/alert.component.ts"
    click JWTInterceptor "https://github.com/jomaroto/tani-front/blob/main/src/app/_helpers/jwt.interceptor.ts"
    click ErrorInterceptor "https://github.com/jomaroto/tani-front/blob/main/src/app/_helpers/error.interceptor.ts"
    click AuthGuard "https://github.com/jomaroto/tani-front/blob/main/src/app/_helpers/auth.guard.ts"
    click FakeBackend "https://github.com/jomaroto/tani-front/blob/main/src/app/_helpers/fake-backend.ts"
    click AccountService "https://github.com/jomaroto/tani-front/blob/main/src/app/_services/account.service.ts"
    click ProductService "https://github.com/jomaroto/tani-front/blob/main/src/app/_services/product.service.ts"
    click PedidoService "https://github.com/jomaroto/tani-front/blob/main/src/app/_services/pedido.service.ts"
    click AlertService "https://github.com/jomaroto/tani-front/blob/main/src/app/_services/alert.service.ts"

    classDef ui fill:#D6E4FF,stroke:#1E40AF
    classDef service fill:#DCFCE7,stroke:#166534
    classDef helper fill:#F3F4F6,stroke:#6B7280
    classDef shared fill:#FEF3C7,stroke:#92400E
    classDef api fill:#FFEDD5,stroke:#C2410C
    classDef db fill:#FFFBEB,stroke:#B45309
    classDef external fill:#E0F2FE,stroke:#0284C7
```
