# jhosuereymundo/punto-venta-g architecture

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

- Interactive diagram: https://gitdiagram.com/jhosuereymundo/punto-venta-g
- Repository: https://github.com/jhosuereymundo/punto-venta-g

## Overview

##### Project type and purpose
- This is an Angular front‑end application named ControlVentasFront, generated with Angular CLI v18.2.12.
- It implements Universal (SSR) via server.ts and main.server.ts, serving dynamic HTML from a Node/Express host.
- The app’s purpose is to manage sales control workflows: authentication, dashboards, sales (venta), purchases (compra), loans (prestamo), clients, products, suppliers, roles, users, etc.

##### File structure
- Top‑level files:
- angular.json, tsconfig*.json, package.json: Angular and TypeScript config
- server.ts, main.server.ts: Node/Express entry for server‑side rendering (SSR)
- proxy.conf.json: dev proxy for backend API
- src/app subdivided into:
- business/: feature modules (login, dashboard, gcliente, gproducto, gventa, etc.) following a route‑per‑module pattern
- core/: cross‑cutting concerns – guards (auth, admin) and core services (AuthInterceptor, AuthService)
- services/: wrappers around HTTP calls to backend REST endpoints (cliente.service.ts, venta.service.ts, etc.)
- models/: TypeScript interfaces/models representing domain entities
- shared/: UI components and utilities (header, footer, sidebar, layout, confirmdialog, notification)
- src/assets: static assets
- src/main.ts: client bootstrap, src/main.server.ts: server bootstrap for SSR

##### README for additional insights
- Standard Angular CLI project: dev server via ng serve, build via ng build, tests via ng test.

##### Detailed capture of essential elements
- AuthInterceptor intercepting outgoing HTTP calls and injecting JWT
- Guard flows (AuthGuard → allow/deny route activation)

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Client Browser"]:::ui
    SSR["SSR Server\n(Node/Express)"]:::infra
    App["Angular Application\n(src/app)"]:::logic
    BackendAPI["Backend REST API"]:::infra
    Assets["Static Assets\n(src/assets)"]:::infra

    Browser -->|"GET /"| SSR
    SSR -->|"HTML + JS Bundle"| Browser
    Browser -->|"Hydrate / Bootstrap\n(src/main.ts)"| App
    SSR -->|"Server Bootstrap\n(server.ts, main.server.ts)"| SSR

    App -->|"Loads Feature Modules"| FeatureModules
    App -->|"Uses Core Layer"| CoreLayer
    App -->|"Injects Services"| APIServices
    App -->|"References Models"| DomainModels
    App -->|"Renders Shared UI"| SharedComponents
    App -->|"Serves Assets"| Assets

    FeatureModules["Feature Modules"]:::group
    CoreLayer["Core Layer"]:::group
    APIServices["API Services"]:::group
    DomainModels["Domain Models"]:::group
    SharedComponents["Shared Components"]:::group

    FeatureModules --> Login
    FeatureModules --> Dashboard
    FeatureModules --> GCliente
    FeatureModules --> GVenta
    FeatureModules --> GCompra
    FeatureModules --> GCompraList
    FeatureModules --> GPrestamo
    FeatureModules --> GProducto
    FeatureModules --> GProveedor
    FeatureModules --> GRol
    FeatureModules --> GUsuario
    FeatureModules --> Inicio
    FeatureModules --> VentaList

    CoreLayer --> AuthGuard
    CoreLayer --> AdminGuard
    CoreLayer --> AuthenticatedGuard
    CoreLayer --> AuthInterceptor
    CoreLayer --> AuthService

    APIServices --> ClienteService
    APIServices --> CompraService
    APIServices --> DashboardService
    APIServices --> PrestamoService
    APIServices --> ProductoService
    APIServices --> ProveedorService
    APIServices --> RolService
    APIServices --> UsuarioService
    APIServices --> VentaService

    DomainModels --> ClienteModel
    DomainModels --> CompraModel
    DomainModels --> CompraConDetallesModel
    DomainModels --> DetalleCompraModel
    DomainModels --> DetalleVentaModel
    DomainModels --> PrestamoModel
    DomainModels --> ProductoModel
    DomainModels --> ProveedorModel
    DomainModels --> RolModel
    DomainModels --> UsuarioModel
    DomainModels --> VentaModel

    SharedComponents --> Header
    SharedComponents --> Footer
    SharedComponents --> Sidebar
    SharedComponents --> Layout
    SharedComponents --> ConfirmDialog
    SharedComponents --> Notification

    APIServices -->|"HTTP Calls"| BackendAPI
    AuthInterceptor -->|"Intercepts HTTP"| APIServices
    APIServices -->|"Map to"| DomainModels
    FeatureModules -->|"UI Composition"| SharedComponents

    click SSR "https://github.com/jhosuereymundo/punto-venta-g/blob/main/server.ts"
    click SSR "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/main.server.ts"
    click App "https://github.com/jhosuereymundo/punto-venta-g/tree/main/src/app"
    click App "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/app.component.ts"
    click App "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/app.component.html"
    click App "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/app.routes.ts"
    click App "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/app.config.ts"

    click Login "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/business/authentication/login/login.component.ts"
    click Dashboard "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/business/dashboard/dashboard.component.ts"
    click GCliente "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/business/gcliente/gcliente.component.ts"
    click GVenta "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/business/gventa/gventa.component.ts"
    click GCompra "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/business/gcompra/gcompra.component.ts"
    click GCompraList "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/business/gcompralist/gcompralist.component.ts"
    click GPrestamo "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/business/gprestamo/gprestamo.component.ts"
    click GProducto "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/business/gproducto/gproducto.component.ts"
    click GProveedor "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/business/gproveedor/gproveedor.component.ts"
    click GRol "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/business/grol/grol.component.ts"
    click GUsuario "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/business/gusuario/gusuario.component.ts"
    click Inicio "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/business/inicio/inicio.component.ts"
    click VentaList "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/business/ventalist/ventalist.component.ts"

    click AuthGuard "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/core/guards/auth.guard.ts"
    click AdminGuard "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/core/guards/admin.guard.ts"
    click AuthenticatedGuard "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/core/guards/authenticated.guard.ts"
    click AuthInterceptor "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/core/services/auth.interceptor.ts"
    click AuthService "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/core/services/auth.service.ts"

    click ClienteService "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/services/cliente.service.ts"
    click CompraService "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/services/compra.service.ts"
    click DashboardService "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/services/dashboard.service.ts"
    click PrestamoService "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/services/prestamo.service.ts"
    click ProductoService "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/services/producto.service.ts"
    click ProveedorService "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/services/proveedor.service.ts"
    click RolService "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/services/rol.service.ts"
    click UsuarioService "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/services/usuario.service.ts"
    click VentaService "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/services/venta.service.ts"

    click ClienteModel "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/models/cliente.model.ts"
    click CompraModel "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/models/compra.model.ts"
    click CompraConDetallesModel "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/models/compracondetalles.model.ts"
    click DetalleCompraModel "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/models/detallecompra.model.ts"
    click DetalleVentaModel "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/models/detalleventa.model.ts"
    click PrestamoModel "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/models/prestamo.model.ts"
    click ProductoModel "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/models/producto.model.ts"
    click ProveedorModel "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/models/proveedor.model.ts"
    click RolModel "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/models/rol.model.ts"
    click UsuarioModel "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/models/usuario.model.ts"
    click VentaModel "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/models/venta.model.ts"

    click Header "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/shared/components/header/header.component.ts"
    click Footer "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/shared/components/footer/footer.component.ts"
    click Sidebar "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/shared/components/sidebar/sidebar.component.ts"
    click Layout "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/shared/components/layout/layout.component.ts"
    click ConfirmDialog "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/shared/confirmdialog/confirmdialog.component.ts"
    click Notification "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/app/shared/notification/notification.component.ts"

    click Assets "https://github.com/jhosuereymundo/punto-venta-g/tree/main/src/assets"
    click Assets "https://github.com/jhosuereymundo/punto-venta-g/blob/main/src/assets/images.ts"

    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef logic fill:#90EE90,stroke:#333,stroke-width:1px
    classDef infra fill:#FFA500,stroke:#333,stroke-width:1px
    classDef group fill:#FFFFFF,stroke:#666,stroke-dasharray: 2 2,stroke-width:1px
```
