# relic7663/productos-app_angular_jsonserver architecture

> Architecture diagram of the GitHub repository relic7663/productos-app_angular_jsonserver, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/relic7663/productos-app_angular_jsonserver
- Repository: https://github.com/relic7663/productos-app_angular_jsonserver

## Overview

##### Project type and purpose
- This is an Angular full-stack application with server-side rendering (Angular Universal) plus a mock JSON API.
- The “src” directory is the Angular app, the root “server” folder holds db.json (mock data store), and “src/server.ts” & “src/main.server.ts” bootstrap the SSR/Express server.

##### File structure
- Top-level:
- .vscode, .editorconfig, tsconfig*, angular.json, package.json – IDE/config/build files.
- core/ – global interceptors, guards, etc.
- public/ – static assets for production.
- server/db.json – mock REST API data file.
- src/:
- app/ – Angular application modules, components, services.
– app.config.ts/app.config.server.ts – environment‐specific config.
– app.routes.ts/app.routes.server.ts – browser vs server routing definitions.
– productos/ – feature module handling CRUD of “Producto” (components: create/edit/list + service).
– interceptors in core/ for error handling on HTTP calls.
- main.ts – client entry point.
- main.server.ts – server-side rendering entry point.
- server.ts – Express server that hosts SSR bundle + may proxy API requests to JSON server.

##### README for additional insights
- Standard Angular CLI instructions are provided.
- No explicit SSR instructions, but file names indicate Angular Universal usage and a mock JSON API.

##### Elements
- Clear labels: “Client Browser”, “Angular SSR Server”, “JSON API Server”, “db.json”, “Productos Module”
- Page load flow (Client ↔ SSR Server)
- API calls flow (Angular App → JSON API Server → db.json)

##### Detailed capture of essential architectural elements
- SSR entry point (main.server.ts → server.ts)
- Client entry point (main.ts → app.module.ts)
- Core module (interceptors) vs feature module (productos)
- Configuration layering (app.config.ts vs app.config.server.ts) at the boundary between server and client.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Server Side"
        SSRBundle["SSR Bundle\n(main.server.ts)"]:::server
        ExpressServer["Express Server\n(server.ts)"]:::server
        ConfigServer["Server Config\n(app.config.server.ts)"]:::config
        RoutingServer["Server Routing\n(app.routes.server.ts)"]:::config
        API["JSON API Server"]:::api
        DB["db.json"]:::db

        SSRBundle -->|uses config| ConfigServer
        SSRBundle -->|uses routing| RoutingServer
        SSRBundle -->|renders HTML| ExpressServer
        ExpressServer -->|serves initial HTML| ClientBrowser
        ExpressServer -->|proxies API requests| API
        API -->|reads/writes| DB
    end

    ClientBrowser["Client Browser"]:::client

    subgraph "Client Side"
        ClientApp["Angular Browser App\n(main.ts,\nindex.html,\nstyles.scss)"]:::client
        ConfigBrowser["Browser Config\n(app.config.ts)"]:::config
        RoutingClient["Client Routing\n(app.routes.ts)"]:::config
        CoreModule["Core Module\n(error.interceptor.ts)"]:::core

        subgraph "Productos Module"
            Crear["CrearProductoComponent"]:::module
            Editar["EditarProductoComponent"]:::module
            Listar["ListaProductosComponent"]:::module
            Service["ProductoService"]:::module

            Crear --> Service
            Editar --> Service
            Listar --> Service
        end

        ClientApp -->|bootstrap| ConfigBrowser
        ClientApp -->|bootstrap| RoutingClient
        RoutingClient --> CoreModule
        CoreModule -->|CRUD calls| API
        ClientApp --> Crear
    end

    ClientBrowser -->|initial GET /| ExpressServer
    ClientBrowser -->|boots client bundle| ClientApp

    click SSRBundle "https://github.com/relic7663/productos-app_angular_jsonserver/blob/master/src/main.server.ts"
    click ExpressServer "https://github.com/relic7663/productos-app_angular_jsonserver/blob/master/src/server.ts"
    click API "https://github.com/relic7663/productos-app_angular_jsonserver/blob/master/server/db.json"
    click DB "https://github.com/relic7663/productos-app_angular_jsonserver/blob/master/server/db.json"
    click ClientApp "https://github.com/relic7663/productos-app_angular_jsonserver/blob/master/src/main.ts"
    click ConfigServer "https://github.com/relic7663/productos-app_angular_jsonserver/blob/master/src/app/app.config.server.ts"
    click RoutingServer "https://github.com/relic7663/productos-app_angular_jsonserver/blob/master/src/app/app.routes.server.ts"
    click ConfigBrowser "https://github.com/relic7663/productos-app_angular_jsonserver/blob/master/src/app/app.config.ts"
    click RoutingClient "https://github.com/relic7663/productos-app_angular_jsonserver/blob/master/src/app/app.routes.ts"
    click CoreModule "https://github.com/relic7663/productos-app_angular_jsonserver/blob/master/core/interceptors/error.interceptor.ts"
    click Crear "https://github.com/relic7663/productos-app_angular_jsonserver/blob/master/src/app/productos/components/crear-producto/crear-producto.component.ts"
    click Editar "https://github.com/relic7663/productos-app_angular_jsonserver/blob/master/src/app/productos/components/editar-producto/editar-producto.component.ts"
    click Listar "https://github.com/relic7663/productos-app_angular_jsonserver/blob/master/src/app/productos/components/lista-productos/lista-productos.component.ts"
    click Service "https://github.com/relic7663/productos-app_angular_jsonserver/blob/master/src/app/productos/services/producto.ts"

    classDef server fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px
    classDef client fill:#bbdefb,stroke:#1565c0,stroke-width:2px
    classDef api fill:#ffe0b2,stroke:#e65100,stroke-width:2px
    classDef db fill:#d7ccc8,stroke:#4e342e,stroke-width:2px
    classDef config fill:#e1bee7,stroke:#6a1b9a,stroke-width:2px
    classDef core fill:#f8bbd0,stroke:#880e4f,stroke-width:2px
    classDef module fill:#c5e1a5,stroke:#33691e,stroke-width:2px
```
