# abeja01/ecommerce-grupo3-go architecture

> Architecture diagram of the GitHub repository abeja01/ecommerce-grupo3-go, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abeja01/ecommerce-grupo3-go
- Repository: https://github.com/abeja01/ecommerce-grupo3-go

## Overview

This is a modular e-commerce application: users manage a product catalog of simple products and composites, maintain promotions, and request decorated price quotes. The React UI calls a Go HTTP API, whose product and promotion modules provide the documented CRUD and pricing capabilities, backed by PostgreSQL or an in-memory fallback. The graph preserves the documented domain stages, but source excerpts do not establish most internal backend call relationships; those links are omitted. The separate `referencia-companeros/` examples are not part of the documented product workflow.

Main entry points: [`backend/cmd/api/main.go`](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/cmd/api/main.go) (Go API server), [`frontend/src/App.tsx`](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/frontend/src/App.tsx) (Catalog and admin UI), [`frontend/src/services/api.ts`](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/frontend/src/services/api.ts) (REST client), [`backend/internal/database/postgres.go`](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/database/postgres.go) (PostgreSQL connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Customer interface"]
  node_ui["Catalog and admin UI<br/>[App.tsx]"]
  node_client["REST client<br/>[api.ts]"]
  node_product_types["Product contracts<br/>[product.ts]"]
  node_promotion_types["Promotion contracts<br/>[promotion.ts]"]
end

subgraph group_api["HTTP application"]
  node_server["Go API server<br/>[main.go]"]
  node_config["Runtime configuration<br/>[config.go]"]
end

subgraph group_products["Product catalog"]
  node_product_handler["Product endpoints<br/>[handler.go]"]
  node_product_model["Product models<br/>[model.go]"]
  node_composite["Composite pricing<br/>[composite.go]"]
  node_product_repo["Product repository<br/>[repository.go]"]
end

subgraph group_promotions["Promotion pricing"]
  node_promotion_handler["Promotion endpoints<br/>[handler.go]"]
  node_promotion_model["Promotion models<br/>[model.go]"]
  node_decorator["Discount decorators<br/>[decorator.go]"]
  node_promotion_repo["Promotion repository<br/>[repository.go]"]
end

subgraph group_data["Persistence"]
  node_postgres[("PostgreSQL connection<br/>[postgres.go]")]
  node_database[("PostgreSQL")]
end

node_user(("User"))

node_user -->|"uses"| node_ui
node_ui -->|"invokes"| node_client
node_client -->|"HTTP requests"| node_server
node_server -->|"routes requests"| node_product_handler
node_server -->|"routes requests"| node_promotion_handler
node_postgres -->|"connects"| node_database

click node_ui "https://github.com/abeja01/ecommerce-grupo3-go/blob/main/frontend/src/App.tsx"
click node_client "https://github.com/abeja01/ecommerce-grupo3-go/blob/main/frontend/src/services/api.ts"
click node_product_types "https://github.com/abeja01/ecommerce-grupo3-go/blob/main/frontend/src/types/product.ts"
click node_promotion_types "https://github.com/abeja01/ecommerce-grupo3-go/blob/main/frontend/src/types/promotion.ts"
click node_server "https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/cmd/api/main.go"
click node_config "https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/config/config.go"
click node_product_handler "https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/products/handler.go"
click node_product_model "https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/products/model.go"
click node_composite "https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/products/composite.go"
click node_product_repo "https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/products/repository.go"
click node_promotion_handler "https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/promotions/handler.go"
click node_promotion_model "https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/promotions/model.go"
click node_decorator "https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/promotions/decorator.go"
click node_promotion_repo "https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/promotions/repository.go"
click node_postgres "https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/database/postgres.go"

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_ui,node_client,node_product_types,node_promotion_types,node_user toneBlue
class node_server,node_config toneAmber
class node_product_handler,node_product_model,node_composite,node_product_repo toneMint
class node_promotion_handler,node_promotion_model,node_decorator,node_promotion_repo toneRose
class node_postgres,node_database toneIndigo
```

## Components

### Customer interface

- [Catalog and admin UI](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [REST client](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Product contracts](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/frontend/src/types/product.ts): `frontend/src/types/product.ts`
- [Promotion contracts](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/frontend/src/types/promotion.ts): `frontend/src/types/promotion.ts`

### HTTP application

- [Go API server](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/cmd/api/main.go): `backend/cmd/api/main.go`
- [Runtime configuration](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/config/config.go): `backend/internal/config/config.go`

### Product catalog

- [Product endpoints](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/products/handler.go): `backend/internal/products/handler.go`
- [Product models](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/products/model.go): `backend/internal/products/model.go`
- [Composite pricing](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/products/composite.go): `backend/internal/products/composite.go`
- [Product repository](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/products/repository.go): `backend/internal/products/repository.go`

### Promotion pricing

- [Promotion endpoints](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/promotions/handler.go): `backend/internal/promotions/handler.go`
- [Promotion models](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/promotions/model.go): `backend/internal/promotions/model.go`
- [Discount decorators](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/promotions/decorator.go): `backend/internal/promotions/decorator.go`
- [Promotion repository](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/promotions/repository.go): `backend/internal/promotions/repository.go`

### Persistence

- [PostgreSQL connection](https://github.com/abeja01/ecommerce-grupo3-go/blob/main/backend/internal/database/postgres.go): `backend/internal/database/postgres.go`
- **PostgreSQL**

### Other components

- **User**

## Connections

- User → Catalog and admin UI: uses (evidence: `README.md`)
- Catalog and admin UI → REST client: invokes (evidence: `frontend/src/App.tsx`)
- REST client → Go API server: HTTP requests (evidence: `frontend/src/services/api.ts`)
- Go API server → Product endpoints: routes requests (evidence: `README.md`)
- Go API server → Promotion endpoints: routes requests (evidence: `README.md`)
- PostgreSQL connection → PostgreSQL: connects (evidence: `README.md`)
