# lawlielowen/front_atc architecture

> Architecture diagram of the GitHub repository lawlielowen/front_atc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lawlielowen/front_atc
- Repository: https://github.com/lawlielowen/front_atc

## Overview

#### Purpose and Runtime
Front_ATC is an Angular/Ionic TypeScript frontend for ATC’s sales, inventory, and operational workflows. It runs primarily as a branch-hosted web application, consumes the separate Back_ATC API, and has Capacitor configuration for hybrid packaging. Bootstrap and global composition begin at `src/main.ts`, `src/app/app.module.ts`, and `src/app/app.component.ts`.

#### Application Shell and Navigation
The root router defines application navigation; `HomePage` provides the authenticated application shell, likely hosting shared header/sidebar layout and child views. Feature areas are organized as Angular page modules with their own route modules, supporting separation and likely lazy loading.
- `src/app/app-routing.module.ts`
- `src/app/home/home-routing.module.ts`
- `src/app/shared/components/layout/header/header.component.ts`
- `src/app/shared/components/layout/siderbar/siderbar.component.ts`

#### Identity, Authorization, and HTTP Boundary
Authentication is centralized in auth/login services, route guards, and HTTP interceptors. Requests cross the frontend/backend boundary through domain services; the token interceptor attaches credentials, while the auth-error interceptor handles authentication failures. Guards distinguish authenticated, unauthenticated, role-based, and admin-only access, redirecting blocked users to the unauthorized flow.
- `src/app/core/services/auth.service.ts`
- `src/app/core/guard/Authtoken.interceptor.ts`
- `src/app/core/guard/Auth error.interceptor.ts`
- `src/app/core/guard/auth.guard.ts`
- `src/app/core/guard/Role.guard.ts`

#### API and Domain Model Layer
`core/services` is the client-side API adapter layer, with a service per backend business resource. Shared models define the frontend’s domain contracts and are consumed by pages, services, and reusable UI. The backend base URL is environment-specific.
- `src/app/core/services/Productos.service.ts`
- `src/app/core/services/Cotizaciones.service.ts`
- `src/app/core/services/Pedidos.service.ts`
- `src/app/shared/model/productos.model.ts`
- `src/app/shared/model/cotizacion.model.ts`
- `src/environments/environment.ts`

#### Core Business Workflows
The main control flow is: routed feature page → domain service/API → model-backed response → list/detail/modal UI and optional transition to related workflow. Commercial workflows connect customers, quotes/POS, orders, and receipt uploads; inventory workflows cover products, stock, movements/history, vouchers, and receptions.
- `src/app/pages/cotizaciones/cotizaciones.page.ts`
- `src/app/pages/cotizaciones/pos/pos.page.ts`
- `src/app/pages/pedidos/detalle-pedido/detalle-pedido.page.ts`
- `src/app/pages/productos/existencias/existencias.page.ts`
- `src/app/pages/recepciones/confirmar-recepcion/confirmar-recepcion.page.ts`
- `src/app/pages/historial-es/historial-es.page.ts`

#### CRM, Service, and Field Operations
Customer and advisor records support sales activity. Separate feature modules manage demos, visits, tickets/incidents, and projects, each structured as list plus create/edit modal and/or detail/completion route. This makes each workflow independently navigable while sharing API, auth, layout, and UI layers.
- `src/app/pages/clientes/clientes.page.ts`
- `src/app/pages/asesores/detalles/detalles.page.ts`
- `src/app/pages/demos/detalles-demo/detalles-demo.page.ts`
- `src/app/pages/visitas/completar-visita/completar-visita.page.ts`
- `src/app/pages/tickets/detalle-ticket/detalle-ticket.page.ts`
- `src/app/pages/proyectos/detalles-proyecto/detalles-proyecto.page.ts`

#### Shared Presentation and Cross-Cutting UX
Reusable layout and UI components standardize headers, notifications, forms, tables, filters, pagination, cards, and modals across feature modules. Dashboard metrics are supplied by the metrics service; notification functionality has a service, header component, and local audio asset. SweetAlert-oriented domain utilities centralize operation feedback.
- `src/app/core/services/Metricas.service.ts`
- `src/app/core/services/Notificaciones.service.ts`
- `src/app/pages/dashboard/dashboard.page.ts`
- `src/app/shared/components/UI/table/table.component.ts`
- `src/app/shared/components/UI/modal/upload-modal/upload-modal.component.ts`
- `src/assets/Sound/notificacion.mp3`

Main entry points: [`src/app/home/home-routing.module.ts`](https://github.com/lawlielowen/front_atc/blob/main/src/app/home/home-routing.module.ts) (Authenticated shell), [`src/app/core/services/Productos.service.ts`](https://github.com/lawlielowen/front_atc/blob/main/src/app/core/services/Productos.service.ts) (Domain API services), [`src/app/app-routing.module.ts`](https://github.com/lawlielowen/front_atc/blob/main/src/app/app-routing.module.ts) (Root router), [`src/app/core/guard/Authtoken.interceptor.ts`](https://github.com/lawlielowen/front_atc/blob/main/src/app/core/guard/Authtoken.interceptor.ts) (HTTP interceptors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime &amp; Shell"]
  node_bootstrap{{"Angular bootstrap<br/>entrypoint<br/>[main.ts]"}}
  node_app_module["App module<br/>composition<br/>[app.module.ts]"]
  node_root_router["Root router<br/>routing"]
  node_home_shell["Authenticated shell<br/>page shell"]
  node_layout["Header &amp; sidebar<br/>layout components"]
end

subgraph group_security["Security &amp; API"]
  node_auth["Authentication<br/>auth service<br/>[auth.service.ts]"]
  node_access_control["Guards<br/>route authorization<br/>[auth.guard.ts]"]
  node_http_interceptors["HTTP interceptors<br/>HTTP boundary"]
  node_domain_api["Domain API services<br/>API adapters"]
  node_environment["API environment<br/>runtime config<br/>[environment.ts]"]
  node_backend{{"Back_ATC API<br/>external backend"}}
end

subgraph group_workflows["Business Workflows"]
  node_commercial["Quotes &amp; POS<br/>sales workflow"]
  node_orders["Order detail<br/>order workflow"]
  node_inventory["Stock &amp; history<br/>inventory workflow"]
  node_receiving["Reception confirmation<br/>inventory workflow"]
  node_operations["CRM &amp; field operations<br/>feature workflows<br/>[clientes.page.ts]"]
end

subgraph group_shared["Shared UX"]
  node_models["Shared domain models<br/>TypeScript contracts<br/>[productos.model.ts]"]
  node_shared_ui["Reusable UI<br/>presentation components<br/>[table.component.ts]"]
  node_metrics["Dashboard metrics<br/>metrics service"]
  node_notifications["Notifications<br/>notification service"]
end

node_bootstrap -->|"boots"| node_app_module
node_app_module -->|"configures"| node_root_router
node_root_router -->|"protects routes with"| node_access_control
node_root_router -->|"loads authenticated area"| node_home_shell
node_home_shell -->|"renders"| node_layout
node_home_shell -->|"navigates to"| node_commercial
node_home_shell -->|"navigates to"| node_orders
node_home_shell -->|"navigates to"| node_inventory
node_home_shell -->|"navigates to"| node_receiving
node_home_shell -->|"navigates to"| node_operations
node_access_control -->|"checks session and roles"| node_auth
node_commercial -->|"uses"| node_domain_api
node_orders -->|"uses"| node_domain_api
node_inventory -->|"uses"| node_domain_api
node_receiving -->|"uses"| node_domain_api
node_operations -->|"uses"| node_domain_api
node_domain_api -->|"maps contracts"| node_models
node_domain_api -->|"sends requests through"| node_http_interceptors
node_http_interceptors -->|"attaches and refreshes auth state"| node_auth
node_http_interceptors -->|"requests"| node_backend
node_environment -.->|"supplies API base URL"| node_domain_api
node_commercial -->|"renders with"| node_shared_ui
node_inventory -->|"renders with"| node_shared_ui
node_operations -->|"renders with"| node_shared_ui
node_home_shell -->|"shows dashboard data"| node_metrics
node_layout -->|"presents"| node_notifications

click node_bootstrap "https://github.com/lawlielowen/front_atc/blob/main/src/main.ts"
click node_app_module "https://github.com/lawlielowen/front_atc/blob/main/src/app/app.module.ts"
click node_root_router "https://github.com/lawlielowen/front_atc/blob/main/src/app/app-routing.module.ts"
click node_home_shell "https://github.com/lawlielowen/front_atc/blob/main/src/app/home/home-routing.module.ts"
click node_layout "https://github.com/lawlielowen/front_atc/blob/main/src/app/shared/components/layout/header/header.component.ts"
click node_auth "https://github.com/lawlielowen/front_atc/blob/main/src/app/core/services/auth.service.ts"
click node_access_control "https://github.com/lawlielowen/front_atc/blob/main/src/app/core/guard/auth.guard.ts"
click node_http_interceptors "https://github.com/lawlielowen/front_atc/blob/main/src/app/core/guard/Authtoken.interceptor.ts"
click node_domain_api "https://github.com/lawlielowen/front_atc/blob/main/src/app/core/services/Productos.service.ts"
click node_environment "https://github.com/lawlielowen/front_atc/blob/main/src/environments/environment.ts"
click node_commercial "https://github.com/lawlielowen/front_atc/blob/main/src/app/pages/cotizaciones/cotizaciones.page.ts"
click node_orders "https://github.com/lawlielowen/front_atc/blob/main/src/app/pages/pedidos/detalle-pedido/detalle-pedido.page.ts"
click node_inventory "https://github.com/lawlielowen/front_atc/blob/main/src/app/pages/productos/existencias/existencias.page.ts"
click node_receiving "https://github.com/lawlielowen/front_atc/blob/main/src/app/pages/recepciones/confirmar-recepcion/confirmar-recepcion.page.ts"
click node_operations "https://github.com/lawlielowen/front_atc/blob/main/src/app/pages/clientes/clientes.page.ts"
click node_models "https://github.com/lawlielowen/front_atc/blob/main/src/app/shared/model/productos.model.ts"
click node_shared_ui "https://github.com/lawlielowen/front_atc/blob/main/src/app/shared/components/UI/table/table.component.ts"
click node_metrics "https://github.com/lawlielowen/front_atc/blob/main/src/app/core/services/Metricas.service.ts"
click node_notifications "https://github.com/lawlielowen/front_atc/blob/main/src/app/core/services/Notificaciones.service.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_bootstrap,node_app_module,node_root_router,node_home_shell,node_layout toneBlue
class node_auth,node_access_control,node_http_interceptors,node_domain_api,node_environment,node_backend toneAmber
class node_commercial,node_orders,node_inventory,node_receiving,node_operations toneMint
class node_models,node_shared_ui,node_metrics,node_notifications toneRose
```

## Components

### Runtime & Shell

- [Angular bootstrap](https://github.com/lawlielowen/front_atc/blob/main/src/main.ts): entrypoint · `src/main.ts`
- [App module](https://github.com/lawlielowen/front_atc/blob/main/src/app/app.module.ts): composition · `src/app/app.module.ts`
- [Root router](https://github.com/lawlielowen/front_atc/blob/main/src/app/app-routing.module.ts): routing · `src/app/app-routing.module.ts`
- [Authenticated shell](https://github.com/lawlielowen/front_atc/blob/main/src/app/home/home-routing.module.ts): page shell · Hosts shared navigation and child feature views. · `src/app/home/home-routing.module.ts`
- [Header & sidebar](https://github.com/lawlielowen/front_atc/blob/main/src/app/shared/components/layout/header/header.component.ts): layout components · `src/app/shared/components/layout/header/header.component.ts`

### Security & API

- [Authentication](https://github.com/lawlielowen/front_atc/blob/main/src/app/core/services/auth.service.ts): auth service · `src/app/core/services/auth.service.ts`
- [Guards](https://github.com/lawlielowen/front_atc/blob/main/src/app/core/guard/auth.guard.ts): route authorization · Authentication and role checks protect routes. · `src/app/core/guard/auth.guard.ts`
- [HTTP interceptors](https://github.com/lawlielowen/front_atc/blob/main/src/app/core/guard/Authtoken.interceptor.ts): HTTP boundary · Attaches tokens and handles authentication failures. · `src/app/core/guard/Authtoken.interceptor.ts`
- [Domain API services](https://github.com/lawlielowen/front_atc/blob/main/src/app/core/services/Productos.service.ts): API adapters · Resource services for products, quotes, orders, and other backend domains. · `src/app/core/services/Productos.service.ts`
- [API environment](https://github.com/lawlielowen/front_atc/blob/main/src/environments/environment.ts): runtime config · Provides environment-specific backend base URL. · `src/environments/environment.ts`
- **Back_ATC API**: external backend

### Business Workflows

- [Quotes & POS](https://github.com/lawlielowen/front_atc/blob/main/src/app/pages/cotizaciones/cotizaciones.page.ts): sales workflow · Creates commercial quotes and point-of-sale activity. · `src/app/pages/cotizaciones/cotizaciones.page.ts`
- [Order detail](https://github.com/lawlielowen/front_atc/blob/main/src/app/pages/pedidos/detalle-pedido/detalle-pedido.page.ts): order workflow · `src/app/pages/pedidos/detalle-pedido/detalle-pedido.page.ts`
- [Stock & history](https://github.com/lawlielowen/front_atc/blob/main/src/app/pages/productos/existencias/existencias.page.ts): inventory workflow · Shows stock, movements, and inventory history. · `src/app/pages/productos/existencias/existencias.page.ts`
- [Reception confirmation](https://github.com/lawlielowen/front_atc/blob/main/src/app/pages/recepciones/confirmar-recepcion/confirmar-recepcion.page.ts): inventory workflow · `src/app/pages/recepciones/confirmar-recepcion/confirmar-recepcion.page.ts`
- [CRM & field operations](https://github.com/lawlielowen/front_atc/blob/main/src/app/pages/clientes/clientes.page.ts): feature workflows · Customers, advisors, demos, visits, tickets, and projects. · `src/app/pages/clientes/clientes.page.ts`

### Shared UX

- [Shared domain models](https://github.com/lawlielowen/front_atc/blob/main/src/app/shared/model/productos.model.ts): TypeScript contracts · `src/app/shared/model/productos.model.ts`
- [Reusable UI](https://github.com/lawlielowen/front_atc/blob/main/src/app/shared/components/UI/table/table.component.ts): presentation components · Tables, forms, filters, pagination, cards, and modals. · `src/app/shared/components/UI/table/table.component.ts`
- [Dashboard metrics](https://github.com/lawlielowen/front_atc/blob/main/src/app/core/services/Metricas.service.ts): metrics service · `src/app/core/services/Metricas.service.ts`
- [Notifications](https://github.com/lawlielowen/front_atc/blob/main/src/app/core/services/Notificaciones.service.ts): notification service · Supports header notifications and alert audio. · `src/app/core/services/Notificaciones.service.ts`

## Connections

- Angular bootstrap → App module: boots
- App module → Root router: configures
- Root router → Guards: protects routes with
- Root router → Authenticated shell: loads authenticated area
- Authenticated shell → Header & sidebar: renders
- Authenticated shell → Quotes & POS: navigates to
- Authenticated shell → Order detail: navigates to
- Authenticated shell → Stock & history: navigates to
- Authenticated shell → Reception confirmation: navigates to
- Authenticated shell → CRM & field operations: navigates to
- Guards → Authentication: checks session and roles
- Quotes & POS → Domain API services: uses
- Order detail → Domain API services: uses
- Stock & history → Domain API services: uses
- Reception confirmation → Domain API services: uses
- CRM & field operations → Domain API services: uses
- Domain API services → Shared domain models: maps contracts
- Domain API services → HTTP interceptors: sends requests through
- HTTP interceptors → Authentication: attaches and refreshes auth state
- HTTP interceptors → Back_ATC API: requests
- API environment → Domain API services: supplies API base URL
- Quotes & POS → Reusable UI: renders with
- Stock & history → Reusable UI: renders with
- CRM & field operations → Reusable UI: renders with
- Authenticated shell → Dashboard metrics: shows dashboard data
- Header & sidebar → Notifications: presents
