# ivanmdzcn/front-pg architecture

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

- Interactive diagram: https://gitdiagram.com/ivanmdzcn/front-pg
- Repository: https://github.com/ivanmdzcn/front-pg

## Overview

1. **Overall shape**
   - This is an **Angular 19 single-page application** named `FrontPg`.
   - It is primarily a **front-end CRUD/admin UI** organized around feature pages, shared layout chrome, and cross-cutting auth/API infrastructure.

2. **Application shell and bootstrap**
   - The app starts in `src/main.ts` and is wired through `app.config.ts`, `app.routes.ts`, and `app.component.*`.
   - Routing is central: `app.routes.ts` likely defines the top-level navigation and applies protection to authenticated areas.

3. **Route boundaries**
   - The repository separates **public/auth routes** from **protected business routes**.
   - `src/app/core/auth.guard.ts` suggests route-level access control.
   - `src/app/pages/login` is the public entry point; the rest of the domain pages appear to live behind auth.

4. **Layout subsystem**
   - `src/app/layout` contains the reusable application chrome:
     - `header`
     - `sidebar`
     - `footer`
     - `main-layout`
   - `main-layout` is the shell that probably hosts the routed pages while keeping navigation and branding persistent.

5. **Feature domains**
   - The business UI is split into four main domains under `src/app/pages`:
     - `beneficiarios`
     - `causantes`
     - `nominas`
     - `reportes`
   - Each domain has dedicated list/detail/create/edit components, indicating a standard **list → detail/edit workflow**.

6. **CRUD-oriented page structure**
   - `beneficiarios` and `causantes` each have list, create, and edit pages.
   - `nominas` has list, new, and detail pages.
   - `reportes` has list and detail pages.
   - This suggests the app is designed around **entity management plus reporting**, likely backed by REST endpoints.

7. **Service layer**
   - `src/app/services` contains domain-specific services:
     - `auth.service.ts`
     - `beneficiario.service.ts`
     - `causante.service.ts`
     - `nomina.service.ts`
     - `reportes.service.ts`
   - These are the main data-access boundary between UI components and the backend API.

8. **HTTP and authentication cross-cutting concerns**
   - `src/app/core/auth.interceptor.ts` indicates outgoing API requests are probably augmented with auth credentials, such as a token.
   - Combined with the auth guard, this forms the standard **authenticated request pipeline**:
     UI action → service → HTTP interceptor → backend API.

9. **Shared confirmation flow**
   - `src/app/core/confirm` contains `confirm.service.ts` and a reusable `confirm-dialog` component.
   - This is a cross-feature interaction layer for destructive or sensitive actions, likely used by list/edit screens before delete or submit operations.

10. **Environment and deployment**
   - `src/app/environments/environment.ts` and `environment.prod.ts` indicate environment-specific configuration, likely including API base URLs.
   - `Dockerfile`, `docker-compose.yml`, and `nginx.conf` show the app is intended to be **built and served as static assets behind Nginx**, rather than run as a server-side Node app.

11. **Static assets and styling**
   - `public/assets` is the main asset bucket for images/icons/static files.
   - Global styles live in `src/styles.css`, with component-scoped CSS alongside each component.
   - This supports a typical Angular component-isolated styling model.

12. **Testing and project tooling**
   - Each component has a `.spec.ts`, so unit testing is part of the structure.
   - The repo uses standard Angular CLI tooling (`angular.json`, `tsconfig*.json`, `package.json`) and Karma-based unit tests per the README.

13. **Architecture diagram takeaway**
   - The key diagram should show:
     - a **browser-hosted Angular SPA**
     - a **layout shell**
     - **route-protected feature pages**
     - a **shared auth/confirm core layer**
     - a **domain service layer**
     - an **external backend API**
     - and a **static deployment path via Nginx/Docker**

Main entry points: [`src/app/app.routes.ts`](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/app.routes.ts) (Routes), [`src/app/pages/beneficiarios/beneficiarios-list/beneficiarios-list.component.ts`](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/beneficiarios/beneficiarios-list/beneficiarios-list.component.ts) (Beneficiarios), [`src/app/pages/causantes/causante-list/causante-list.component.ts`](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/causantes/causante-list/causante-list.component.ts) (Causantes), [`src/app/layout/main-layout/main-layout.component.ts`](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/layout/main-layout/main-layout.component.ts) (Main layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_app["App shell"]
  node_main_ts["main.ts<br/>bootstrap<br/>[main.ts]"]
  node_app_config["App config<br/>bootstrap config<br/>[app.config.ts]"]
  node_app_routes["Routes<br/>route map<br/>[app.routes.ts]"]
  node_app_component["App shell<br/>root component<br/>[app.component.ts]"]
  node_main_layout["Main layout<br/>layout shell"]
  node_header["Header"]
  node_sidebar["Sidebar<br/>layout nav"]
  node_footer["Footer"]
end

subgraph group_group_core["Core infra"]
  node_auth_guard{{"Auth guard<br/>route guard<br/>[auth.guard.ts]"}}
  node_auth_interceptor{{"Auth interceptor<br/>http interceptor"}}
  node_auth_service["Auth service<br/>session service<br/>[auth.service.ts]"]
  node_confirm_service["Confirm service<br/>dialog service<br/>[confirm.service.ts]"]
  node_confirm_dialog["Confirm dialog<br/>modal component"]
end

subgraph group_group_features["Feature pages"]
  node_login_page["Login<br/>auth page<br/>[login.component.ts]"]
  node_home_page["Home<br/>dashboard page<br/>[home.component.ts]"]
  node_beneficiarios_list["Beneficiarios<br/>entity list"]
  node_beneficiario_create["Beneficiario create<br/>entity form"]
  node_beneficiario_edit["Beneficiario edit<br/>entity form"]
  node_causante_list["Causantes<br/>entity list"]
  node_causante_create["Causante create<br/>entity form"]
  node_causante_edit["Causante edit<br/>entity form"]
  node_nominas_list["Nóminas<br/>entity list"]
  node_nomina_new["Nómina new<br/>entity form"]
  node_nomina_detail["Nómina detail<br/>detail page"]
  node_reportes_list["Reportes<br/>report list"]
  node_reporte_detalle["Reporte detalle<br/>report detail"]
end

subgraph group_group_deploy["Deployment"]
  node_dockerfile["Docker image<br/>build/deploy"]
  node_nginx_conf["Nginx config<br/>serve config<br/>[nginx.conf]"]
end

node_backend_api[("Backend API<br/>external api")]

node_main_ts -->|"bootstraps"| node_app_config
node_main_ts -->|"mounts"| node_app_component
node_app_config -->|"registers"| node_app_routes
node_app_routes -->|"protects"| node_auth_guard
node_app_routes -->|"public route"| node_login_page
node_app_routes -->|"shell route"| node_main_layout
node_app_routes -->|"entry page"| node_home_page
node_app_routes -->|"navigates to"| node_beneficiarios_list
node_app_routes -->|"navigates to"| node_causante_list
node_app_routes -->|"navigates to"| node_nominas_list
node_app_routes -->|"navigates to"| node_reportes_list
node_main_layout -->|"contains"| node_header
node_main_layout -->|"contains"| node_sidebar
node_main_layout -->|"contains"| node_footer
node_app_component -->|"hosts"| node_main_layout
node_login_page -->|"uses"| node_auth_service
node_auth_service -->|"calls"| node_backend_api
node_auth_interceptor -->|"guards requests"| node_backend_api
node_beneficiarios_list -->|"confirms actions"| node_confirm_service
node_beneficiarios_list -->|"creates"| node_beneficiario_create
node_beneficiarios_list -->|"edits"| node_beneficiario_edit
node_beneficiarios_list -->|"loads"| node_backend_api
node_beneficiario_create -->|"writes"| node_backend_api
node_beneficiario_edit -->|"writes"| node_backend_api
node_causante_list -->|"confirms actions"| node_confirm_service
node_causante_list -->|"creates"| node_causante_create
node_causante_list -->|"edits"| node_causante_edit
node_causante_list -->|"loads"| node_backend_api
node_causante_create -->|"writes"| node_backend_api
node_causante_edit -->|"writes"| node_backend_api
node_nominas_list -->|"creates"| node_nomina_new
node_nominas_list -->|"inspects"| node_nomina_detail
node_nominas_list -->|"loads"| node_backend_api
node_nomina_new -->|"writes"| node_backend_api
node_nomina_detail -->|"reads"| node_backend_api
node_reportes_list -->|"drills into"| node_reporte_detalle
node_reportes_list -->|"loads"| node_backend_api
node_reporte_detalle -->|"reads"| node_backend_api
node_dockerfile -->|"serves via"| node_nginx_conf

click node_main_ts "https://github.com/ivanmdzcn/front-pg/blob/main/src/main.ts"
click node_app_config "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/app.config.ts"
click node_app_routes "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/app.routes.ts"
click node_app_component "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/app.component.ts"
click node_main_layout "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/layout/main-layout/main-layout.component.ts"
click node_header "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/layout/header/header.component.ts"
click node_sidebar "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/layout/sidebar/sidebar.component.ts"
click node_footer "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/layout/footer/footer.component.ts"
click node_auth_guard "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/core/auth.guard.ts"
click node_auth_interceptor "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/core/auth.interceptor.ts"
click node_auth_service "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/services/auth.service.ts"
click node_confirm_service "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/core/confirm/confirm.service.ts"
click node_confirm_dialog "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/core/confirm/confirm-dialog/confirm-dialog.component.ts"
click node_login_page "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/login/login.component.ts"
click node_home_page "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/home/home.component.ts"
click node_beneficiarios_list "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/beneficiarios/beneficiarios-list/beneficiarios-list.component.ts"
click node_beneficiario_create "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/beneficiarios/beneficiario-create/beneficiario-create.component.ts"
click node_beneficiario_edit "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/beneficiarios/beneficiario-edit/beneficiario-edit.component.ts"
click node_causante_list "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/causantes/causante-list/causante-list.component.ts"
click node_causante_create "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/causantes/causante-create/causante-create.component.ts"
click node_causante_edit "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/causantes/causante-edit/causante-edit.component.ts"
click node_nominas_list "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/nominas/nominas-list/nominas-list.component.ts"
click node_nomina_new "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/nominas/nomina-new/nomina-new.component.ts"
click node_nomina_detail "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/nominas/nomina-detail/nomina-detail.component.ts"
click node_reportes_list "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/reportes/reportes-list/reportes-list.component.ts"
click node_reporte_detalle "https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/reportes/reportes-detalle/reportes-detalle.component.ts"
click node_dockerfile "https://github.com/ivanmdzcn/front-pg/tree/main/Dockerfile"
click node_nginx_conf "https://github.com/ivanmdzcn/front-pg/blob/main/nginx.conf"

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_main_ts,node_app_config,node_app_routes,node_app_component,node_main_layout,node_header,node_sidebar,node_footer toneBlue
class node_auth_guard,node_auth_interceptor,node_auth_service,node_confirm_service,node_confirm_dialog toneAmber
class node_login_page,node_home_page,node_beneficiarios_list,node_beneficiario_create,node_beneficiario_edit,node_causante_list,node_causante_create,node_causante_edit,node_nominas_list,node_nomina_new,node_nomina_detail,node_reportes_list,node_reporte_detalle toneMint
class node_dockerfile,node_nginx_conf toneRose
class node_backend_api toneNeutral
```

## Components

### App shell

Bootstrap, routing, and shared layout

- [main.ts](https://github.com/ivanmdzcn/front-pg/blob/main/src/main.ts): bootstrap · Angular entrypoint · `src/main.ts`
- [App config](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/app.config.ts): bootstrap config · Wires providers and app-wide setup · `src/app/app.config.ts`
- [Routes](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/app.routes.ts): route map · Top-level navigation and route protection · `src/app/app.routes.ts`
- [App shell](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/app.component.ts): root component · Root component hosting the application frame · `src/app/app.component.ts`
- [Main layout](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/layout/main-layout/main-layout.component.ts): layout shell · Persistent chrome around routed pages · `src/app/layout/main-layout/main-layout.component.ts`
- [Header](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/layout/header/header.component.ts): layout header · Top navigation and branding · `src/app/layout/header/header.component.ts`
- [Sidebar](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/layout/sidebar/sidebar.component.ts): layout nav · Primary navigation links · `src/app/layout/sidebar/sidebar.component.ts`
- [Footer](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/layout/footer/footer.component.ts): layout footer · Page footer chrome · `src/app/layout/footer/footer.component.ts`

### Core infra

Auth, HTTP, and confirmation cross-cutting concerns

- [Auth guard](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/core/auth.guard.ts): route guard · Protects authenticated routes · `src/app/core/auth.guard.ts`
- [Auth interceptor](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/core/auth.interceptor.ts): http interceptor · Adds auth context to outgoing requests · `src/app/core/auth.interceptor.ts`
- [Auth service](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/services/auth.service.ts): session service · Manages login and session state · `src/app/services/auth.service.ts`
- [Confirm service](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/core/confirm/confirm.service.ts): dialog service · Coordinates confirmation prompts · `src/app/core/confirm/confirm.service.ts`
- [Confirm dialog](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/core/confirm/confirm-dialog/confirm-dialog.component.ts): modal component · Reusable confirmation UI · `src/app/core/confirm/confirm-dialog/confirm-dialog.component.ts`

### Feature pages

Public and protected UI domains

- [Login](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/login/login.component.ts): auth page · Public sign-in entry point · `src/app/pages/login/login.component.ts`
- [Home](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/home/home.component.ts): dashboard page · Landing page inside the app shell · `src/app/pages/home/home.component.ts`
- [Beneficiarios](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/beneficiarios/beneficiarios-list/beneficiarios-list.component.ts): entity list · Beneficiary listing and actions · `src/app/pages/beneficiarios/beneficiarios-list/beneficiarios-list.component.ts`
- [Beneficiario create](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/beneficiarios/beneficiario-create/beneficiario-create.component.ts): entity form · Create beneficiary records · `src/app/pages/beneficiarios/beneficiario-create/beneficiario-create.component.ts`
- [Beneficiario edit](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/beneficiarios/beneficiario-edit/beneficiario-edit.component.ts): entity form · Edit beneficiary records · `src/app/pages/beneficiarios/beneficiario-edit/beneficiario-edit.component.ts`
- [Causantes](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/causantes/causante-list/causante-list.component.ts): entity list · Causant listing and actions · `src/app/pages/causantes/causante-list/causante-list.component.ts`
- [Causante create](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/causantes/causante-create/causante-create.component.ts): entity form · Create causant records · `src/app/pages/causantes/causante-create/causante-create.component.ts`
- [Causante edit](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/causantes/causante-edit/causante-edit.component.ts): entity form · Edit causant records · `src/app/pages/causantes/causante-edit/causante-edit.component.ts`
- [Nóminas](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/nominas/nominas-list/nominas-list.component.ts): entity list · Payroll listing and actions · `src/app/pages/nominas/nominas-list/nominas-list.component.ts`
- [Nómina new](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/nominas/nomina-new/nomina-new.component.ts): entity form · Create payroll entries · `src/app/pages/nominas/nomina-new/nomina-new.component.ts`
- [Nómina detail](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/nominas/nomina-detail/nomina-detail.component.ts): detail page · Inspect payroll entry details · `src/app/pages/nominas/nomina-detail/nomina-detail.component.ts`
- [Reportes](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/reportes/reportes-list/reportes-list.component.ts): report list · Report listing and navigation · `src/app/pages/reportes/reportes-list/reportes-list.component.ts`
- [Reporte detalle](https://github.com/ivanmdzcn/front-pg/blob/main/src/app/pages/reportes/reportes-detalle/reportes-detalle.component.ts): report detail · Report detail and drill-down · `src/app/pages/reportes/reportes-detalle/reportes-detalle.component.ts`

### Deployment

Static build and Nginx serving

- [Docker image](https://github.com/ivanmdzcn/front-pg/tree/main/Dockerfile): build/deploy · Containerized static app build · `Dockerfile`
- [Nginx config](https://github.com/ivanmdzcn/front-pg/blob/main/nginx.conf): serve config · Static asset hosting and routing · `nginx.conf`

### Other components

- **Backend API**: external api · Server-side data and auth endpoints

## Connections

- main.ts → App config: bootstraps · Starts the Angular application with app-wide providers
- main.ts → App shell: mounts · Renders the root component
- App config → Routes: registers · Supplies routing to the application
- Routes → Auth guard: protects · Applies access control to private routes
- Routes → Login: public route · Exposes the sign-in screen without protection
- Routes → Main layout: shell route · Wraps authenticated areas in the main layout
- Routes → Home: entry page · Loads the authenticated landing page
- Routes → Beneficiarios: navigates to · Routes into beneficiary management
- Routes → Causantes: navigates to · Routes into causant management
- Routes → Nóminas: navigates to · Routes into payroll management
- Routes → Reportes: navigates to · Routes into reporting
- Main layout → Header: contains · Persistent top bar
- Main layout → Sidebar: contains · Persistent navigation rail
- Main layout → Footer: contains · Persistent footer
- App shell → Main layout: hosts · Application frame renders routed content through the shell
- Login → Auth service: uses · Submits credentials and manages session
- Auth service → Backend API: calls · Authenticates against the server API
- Auth interceptor → Backend API: guards requests · Attaches auth context to API traffic
- Beneficiarios → Confirm service: confirms actions · Uses shared confirmation before sensitive operations
- Beneficiarios → Beneficiario create: creates · Links to beneficiary creation flow
- Beneficiarios → Beneficiario edit: edits · Links to beneficiary edit flow
- Beneficiarios → Backend API: loads · Reads and updates beneficiary data
- Beneficiario create → Backend API: writes · Creates beneficiary records through the API
- Beneficiario edit → Backend API: writes · Updates beneficiary records through the API
- Causantes → Confirm service: confirms actions · Uses shared confirmation before sensitive operations
- Causantes → Causante create: creates · Links to causant creation flow
- Causantes → Causante edit: edits · Links to causant edit flow
- Causantes → Backend API: loads · Reads and updates causant data
- Causante create → Backend API: writes · Creates causant records through the API
- Causante edit → Backend API: writes · Updates causant records through the API
- Nóminas → Nómina new: creates · Starts payroll entry creation
- Nóminas → Nómina detail: inspects · Opens payroll entry details
- Nóminas → Backend API: loads · Reads payroll data from the API
- Nómina new → Backend API: writes · Creates payroll records through the API
- Nómina detail → Backend API: reads · Fetches payroll detail data
- Reportes → Reporte detalle: drills into · Opens report detail views
- Reportes → Backend API: loads · Reads report summaries from the API
- Reporte detalle → Backend API: reads · Fetches report detail data
- Docker image → Nginx config: serves via · Container image is configured for Nginx delivery
