# fgdiaz-jr/marckedplace-usc architecture

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

- Interactive diagram: https://gitdiagram.com/fgdiaz-jr/marckedplace-usc
- Repository: https://github.com/fgdiaz-jr/marckedplace-usc

## Overview

Marketplace USC is a role-based university marketplace: buyers browse products, manage a cart, check out and follow orders; sellers manage inventory and deliveries, while admins review accounting. The frontend integrates with Supabase and configured REST services, with a documented Supabase fallback. Runtime services cover notifications, delivery tracking, and accounting/escrow; the README also documents orders, payments, inventory, and catalog as external team services, not implementations in this tree. Source excerpts show tracking dispatching notification and escrow calls; other frontend and backend links rely on README statements, so unsampled runtime details are not assumed.

Main entry points: [`frontend/js/api.js`](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/js/api.js) (REST and fallback), [`backend/seguimiento/services.py`](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/seguimiento/services.py) (Delivery lifecycle), [`frontend/js/auth.js`](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/js/auth.js) (JWT auth), [`backend/seguimiento/main.py`](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/seguimiento/main.py) (Tracking API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Marketplace frontend"]
  node_login["Login and roles<br/>[login.html]"]
  node_auth["JWT auth<br/>[auth.js]"]
  node_catalog["Product catalog<br/>[catalog.html]"]
  node_catalog_logic["Catalog rendering<br/>[catalog.js]"]
  node_cart["Cart and tax<br/>[cart.html]"]
  node_cart_store["Cart state<br/>[cart-store.js]"]
  node_checkout["Checkout<br/>[checkout.html]"]
  node_orders_ui["Order history<br/>[orders.html]"]
  node_tracking_ui["Shipment view<br/>[tracking.html]"]
  node_seller_ui["Seller dashboard"]
  node_accounting_ui["Admin accounting"]
  node_notifications_ui["Notification inbox<br/>[notifications.html]"]
  node_api_client["REST and fallback<br/>[api.js]"]
  node_service_config["Service URLs<br/>[config.js]"]
end

subgraph group_commerce["Commerce integrations"]
  node_external_services["Team services"]
  node_supabase[("Supabase platform")]
  node_schema[("Marketplace schema")]
end

subgraph group_delivery["Delivery tracking"]
  node_tracking_api["Tracking API<br/>[main.py]"]
  node_tracking_logic["Delivery lifecycle<br/>[services.py]"]
  node_tracking_db["Tracking database access<br/>[database.py]"]
end

subgraph group_finance["Accounting and escrow"]
  node_accounting_api["Accounting API<br/>[main.py]"]
  node_accounting_logic["Escrow and ledger<br/>[services.py]"]
  node_accounting_db["Accounting database access<br/>[database.py]"]
end

subgraph group_notifications["Notifications"]
  node_notifications_api["Notifications API<br/>[main.py]"]
  node_notifications_logic["Notification service<br/>[services.py]"]
  node_notifications_db["Notification database access<br/>[database.py]"]
end

node_visitor(("Marketplace user"))

node_visitor -->|"signs in"| node_login
node_login -->|"uses auth"| node_auth
node_auth -->|"authenticates with"| node_supabase
node_auth -->|"routes by role"| node_catalog
node_catalog -->|"renders products"| node_catalog_logic
node_catalog_logic -.->|"loads catalog"| node_api_client
node_cart -->|"uses cart state"| node_cart_store
node_cart -->|"continues to"| node_checkout
node_checkout -->|"submits requests"| node_api_client
node_orders_ui -.->|"loads orders"| node_api_client
node_tracking_ui -.->|"loads tracking"| node_api_client
node_seller_ui -.->|"uses services"| node_api_client
node_accounting_ui -.->|"loads accounting"| node_api_client
node_notifications_ui -.->|"loads notices"| node_api_client
node_api_client -->|"reads endpoints"| node_service_config
node_api_client -->|"fallback queries"| node_supabase
node_service_config -->|"configures endpoints"| node_external_services
node_supabase -->|"hosts schema"| node_schema
node_external_services -.->|"creates shipment"| node_tracking_api
node_tracking_api -->|"dispatches operations"| node_tracking_logic
node_tracking_api -->|"checks health"| node_tracking_db
node_tracking_logic -->|"reads and writes"| node_tracking_db
node_tracking_db -->|"queries shipments"| node_supabase
node_tracking_logic -->|"sends notices"| node_notifications_api
node_tracking_logic -->|"updates escrow"| node_accounting_api
node_accounting_api -->|"dispatches operations"| node_accounting_logic
node_accounting_logic -->|"reads and writes"| node_accounting_db
node_accounting_db -.->|"queries ledger"| node_supabase
node_notifications_api -->|"dispatches operations"| node_notifications_logic
node_notifications_logic -->|"reads and writes"| node_notifications_db
node_notifications_db -.->|"queries messages"| node_supabase

click node_login "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/login.html"
click node_auth "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/js/auth.js"
click node_catalog "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/catalog.html"
click node_catalog_logic "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/js/modules/catalog.js"
click node_cart "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/cart.html"
click node_cart_store "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/js/cart-store.js"
click node_checkout "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/checkout.html"
click node_orders_ui "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/orders.html"
click node_tracking_ui "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/tracking.html"
click node_seller_ui "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/seller-dashboard.html"
click node_accounting_ui "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/admin-accounting.html"
click node_notifications_ui "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/notifications.html"
click node_api_client "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/js/api.js"
click node_service_config "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/js/config.js"
click node_schema "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/supabase_schema.sql"
click node_tracking_api "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/seguimiento/main.py"
click node_tracking_logic "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/seguimiento/services.py"
click node_tracking_db "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/seguimiento/database.py"
click node_accounting_api "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/contabilidad/main.py"
click node_accounting_logic "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/contabilidad/services.py"
click node_accounting_db "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/contabilidad/database.py"
click node_notifications_api "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/notificaciones/main.py"
click node_notifications_logic "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/notificaciones/services.py"
click node_notifications_db "https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/notificaciones/database.py"

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_login,node_auth,node_catalog,node_catalog_logic,node_cart,node_cart_store,node_checkout,node_orders_ui,node_tracking_ui,node_seller_ui,node_accounting_ui,node_notifications_ui,node_api_client,node_service_config,node_visitor toneBlue
class node_external_services,node_supabase,node_schema toneAmber
class node_tracking_api,node_tracking_logic,node_tracking_db toneMint
class node_accounting_api,node_accounting_logic,node_accounting_db toneRose
class node_notifications_api,node_notifications_logic,node_notifications_db toneIndigo
```

## Components

### Marketplace frontend

- [Login and roles](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/login.html): `frontend/login.html`
- [JWT auth](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/js/auth.js): `frontend/js/auth.js`
- [Product catalog](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/catalog.html): `frontend/catalog.html`
- [Catalog rendering](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/js/modules/catalog.js): `frontend/js/modules/catalog.js`
- [Cart and tax](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/cart.html): `frontend/cart.html`
- [Cart state](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/js/cart-store.js): `frontend/js/cart-store.js`
- [Checkout](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/checkout.html): `frontend/checkout.html`
- [Order history](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/orders.html): `frontend/orders.html`
- [Shipment view](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/tracking.html): `frontend/tracking.html`
- [Seller dashboard](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/seller-dashboard.html): `frontend/seller-dashboard.html`
- [Admin accounting](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/admin-accounting.html): `frontend/admin-accounting.html`
- [Notification inbox](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/notifications.html): `frontend/notifications.html`
- [REST and fallback](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/js/api.js): `frontend/js/api.js`
- [Service URLs](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/frontend/js/config.js): `frontend/js/config.js`

### Commerce integrations

- **Team services**
- **Supabase platform**
- [Marketplace schema](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/supabase_schema.sql): `supabase_schema.sql`

### Delivery tracking

- [Tracking API](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/seguimiento/main.py): `backend/seguimiento/main.py`
- [Delivery lifecycle](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/seguimiento/services.py): `backend/seguimiento/services.py`
- [Tracking database access](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/seguimiento/database.py): `backend/seguimiento/database.py`

### Accounting and escrow

- [Accounting API](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/contabilidad/main.py): `backend/contabilidad/main.py`
- [Escrow and ledger](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/contabilidad/services.py): `backend/contabilidad/services.py`
- [Accounting database access](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/contabilidad/database.py): `backend/contabilidad/database.py`

### Notifications

- [Notifications API](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/notificaciones/main.py): `backend/notificaciones/main.py`
- [Notification service](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/notificaciones/services.py): `backend/notificaciones/services.py`
- [Notification database access](https://github.com/fgdiaz-jr/marckedplace-usc/blob/main/backend/notificaciones/database.py): `backend/notificaciones/database.py`

### Other components

- **Marketplace user**

## Connections

- Marketplace user → Login and roles: signs in (evidence: `README.md`)
- Login and roles → JWT auth: uses auth (evidence: `README.md`)
- JWT auth → Supabase platform: authenticates with (evidence: `README.md`)
- JWT auth → Product catalog: routes by role (evidence: `README.md`)
- Product catalog → Catalog rendering: renders products (evidence: `README.md`)
- Catalog rendering → REST and fallback: loads catalog
- Cart and tax → Cart state: uses cart state (evidence: `README.md`)
- Cart and tax → Checkout: continues to (evidence: `README.md`)
- Checkout → REST and fallback: submits requests (evidence: `README.md`)
- Order history → REST and fallback: loads orders
- Shipment view → REST and fallback: loads tracking
- Seller dashboard → REST and fallback: uses services
- Admin accounting → REST and fallback: loads accounting
- Notification inbox → REST and fallback: loads notices
- REST and fallback → Service URLs: reads endpoints (evidence: `README.md`)
- REST and fallback → Supabase platform: fallback queries (evidence: `README.md`)
- Service URLs → Team services: configures endpoints (evidence: `README.md`)
- Supabase platform → Marketplace schema: hosts schema (evidence: `README.md`)
- Team services → Tracking API: creates shipment (evidence: `backend/seguimiento/main.py`)
- Tracking API → Delivery lifecycle: dispatches operations (evidence: `backend/seguimiento/main.py`)
- Tracking API → Tracking database access: checks health (evidence: `backend/seguimiento/main.py`)
- Delivery lifecycle → Tracking database access: reads and writes (evidence: `backend/seguimiento/services.py`)
- Tracking database access → Supabase platform: queries shipments (evidence: `backend/seguimiento/database.py`)
- Delivery lifecycle → Notifications API: sends notices (evidence: `backend/seguimiento/services.py`)
- Delivery lifecycle → Accounting API: updates escrow (evidence: `backend/seguimiento/services.py`)
- Accounting API → Escrow and ledger: dispatches operations (evidence: `backend/contabilidad/main.py`)
- Escrow and ledger → Accounting database access: reads and writes (evidence: `backend/contabilidad/services.py`)
- Accounting database access → Supabase platform: queries ledger
- Notifications API → Notification service: dispatches operations (evidence: `backend/notificaciones/main.py`)
- Notification service → Notification database access: reads and writes (evidence: `backend/notificaciones/services.py`)
- Notification database access → Supabase platform: queries messages
