# mariasofiaa/capacitacion architecture

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

- Interactive diagram: https://gitdiagram.com/mariasofiaa/capacitacion
- Repository: https://github.com/mariasofiaa/capacitacion

## Overview

##### Project type and purpose
- This is a single‐page application (SPA) built with Angular (v13), intended to provide a product catalog, shopping cart and checkout flow.
- It uses a lightweight JSON server (server/db.json) as a mock backend—so from an architectural standpoint it behaves like a full-stack app (frontend + API), but all business logic lives in the Angular client and data persistence is faked by JSON server.

##### File structure
- Top-level tooling and config: angular.json, tsconfig*.json, karma.conf.js, package.json, etc.
- “src/app” holds the Angular code, organized into:
- app.module.ts & app-routing.module.ts as root module and router
- material.module.ts bundling Angular Material imports
- pages/ folder with two feature modules:
– products (listing, details, product component, ProductService)
– checkout (cart review, details, thank-you, each in its own module + routing)
- shared/ folder with cross-cutting concerns:
– components (header, cart)
– services (DataService for API calls, ShoppingCartService for cart state)
– interfaces (Order, Store, Product)
- server/db.json with mock data, and the JSON server startup described in Ejecutar.txt.

##### README for additional insights
- Confirms this is purely an Angular frontend with a development server and (by extension) the JSON server.

##### Be as detailed as possible
- Which shared component (HeaderComponent, CartComponent) subscribes to ShoppingCartService

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Application Core
    subgraph "Application Core"
        AppModule["AppModule\n(app.module.ts)"]:::module
        AppRoutingModule["AppRoutingModule\n(app-routing.module.ts)"]:::module
        MaterialModule["MaterialModule\n(material.module.ts)"]:::module
    end

    %% Feature Modules
    subgraph "Feature Modules"
        subgraph "Products Feature" 
            ProductsModule["ProductsModule\n(products.module.ts)"]:::module
            ProductsRoutingModule["ProductsRoutingModule\n(products-routing.module.ts)"]:::module
            ProductsComponent["ProductsComponent\n(products.component.ts)"]:::module
            ProductComponent["ProductComponent\n(product.component.ts)"]:::module
            ProductInterface["Product Interface\n(product.interface.ts)"]:::datastore
            ProductService["ProductService\n(product.service.ts)"]:::service
        end
        subgraph "Checkout Feature"
            CheckoutModule["CheckoutModule\n(checkout.module.ts)"]:::module
            CheckoutRoutingModule["CheckoutRoutingModule\n(checkout-routing.module.ts)"]:::module
            CheckoutComponent["CheckoutComponent\n(checkout.component.ts)"]:::module
            DetailsComponent["DetailsComponent\n(details.component.ts)"]:::module
            subgraph "Thank You"
                ThankYouPageModule["ThankYouPageModule\n(thank-you-page.module.ts)"]:::module
                ThankYouRoutingModule["ThankYouPageRoutingModule\n(thank-you-page-routing.module.ts)"]:::module
                ThankYouPageComponent["ThankYouPageComponent\n(thank-you-page.component.ts)"]:::module
            end
        end
    end

    %% Shared Layer
    subgraph "Shared Module"
        HeaderComponent["HeaderComponent\n(header.component.ts)"]:::module
        CartComponent["CartComponent\n(cart.component.ts)"]:::module
        DataService["DataService\n(data.service.ts)"]:::service
        ShoppingCartService["ShoppingCartService\n(shopping-cart.service.ts)"]:::service
        OrderInterface["Order Interface\n(order.interface.ts)"]:::datastore
        StoreInterface["Store Interface\n(stores.interface.ts)"]:::datastore
    end

    %% External API
    JSONServer["JSON Server\n(server/db.json)"]:::external
    DB["db.json\n(data store)"]:::datastore

    %% Connections
    User["User"] -->|"loads App"| AppModule
    AppModule --> AppRoutingModule
    AppModule --> MaterialModule
    AppRoutingModule -->|lazy load| ProductsModule
    AppRoutingModule -->|lazy load| CheckoutModule

    %% Products Flow
    ProductsModule --> ProductsRoutingModule
    ProductsModule --> ProductsComponent
    ProductsComponent -->|selects product| ProductComponent
    ProductComponent -->|calls| ProductService
    ProductService -->|GET /products| DataService

    %% Checkout Flow
    CheckoutModule --> CheckoutRoutingModule
    CheckoutModule --> CheckoutComponent
    CheckoutComponent -->|updates cart| ShoppingCartService
    CheckoutComponent --> DetailsComponent
    DetailsComponent -->|submits order| DataService
    DetailsComponent --> ShoppingCartService
    DetailsComponent --> ThankYouPageModule
    ThankYouPageModule --> ThankYouRoutingModule
    ThankYouPageModule --> ThankYouPageComponent

    %% Shared Components using ShoppingCartService
    HeaderComponent --> ShoppingCartService
    CartComponent --> ShoppingCartService

    %% Data flow
    DataService -->|HTTP GET/POST| JSONServer
    JSONServer -->|reads/writes| DB
    JSONServer -->|response| DataService
    DataService -->|provides data| ProductsComponent
    DataService -->|provides data| CheckoutComponent

    %% Click Events
    click AppModule "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/app.module.ts"
    click AppRoutingModule "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/app-routing.module.ts"
    click MaterialModule "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/material.module.ts"
    click ProductsModule "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/pages/products/products.module.ts"
    click ProductsRoutingModule "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/pages/products/products-routing.module.ts"
    click ProductsComponent "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/pages/products/products.component.ts"
    click ProductComponent "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/pages/products/product/product.component.ts"
    click ProductInterface "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/pages/products/product/interfaces/product.interface.ts"
    click ProductService "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/pages/products/services/product.service.ts"
    click CheckoutModule "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/pages/checkout/checkout.module.ts"
    click CheckoutRoutingModule "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/pages/checkout/checkout-routing.module.ts"
    click CheckoutComponent "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/pages/checkout/checkout.component.ts"
    click DetailsComponent "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/pages/checkout/details/details.component.ts"
    click ThankYouPageModule "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/pages/checkout/thank-you-page/thank-you-page.module.ts"
    click ThankYouRoutingModule "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/pages/checkout/thank-you-page/thank-you-page-routing.module.ts"
    click ThankYouPageComponent "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/pages/checkout/thank-you-page/thank-you-page.component.ts"
    click HeaderComponent "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/shared/componentes/header/header.component.ts"
    click CartComponent "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/shared/componentes/cart/cart.component.ts"
    click DataService "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/shared/services/data.service.ts"
    click ShoppingCartService "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/shared/services/shopping-cart.service.ts"
    click OrderInterface "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/shared/interfaces/order.interface.ts"
    click StoreInterface "https://github.com/mariasofiaa/capacitacion/blob/master/src/app/shared/interfaces/stores.interface.ts"
    click JSONServer "https://github.com/mariasofiaa/capacitacion/blob/master/server/db.json"
    click DB "https://github.com/mariasofiaa/capacitacion/blob/master/server/db.json"

    %% Styles
    classDef module fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef service fill:#90EE90,stroke:#000,stroke-width:1px
    classDef external fill:#FFA500,stroke:#000,stroke-width:1px
    classDef datastore fill:#D3D3D3,stroke:#000,stroke-width:1px
```
