# gasdcoder07/pacifico-pi architecture

> Architecture diagram of the GitHub repository gasdcoder07/pacifico-pi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gasdcoder07/pacifico-pi
- Repository: https://github.com/gasdcoder07/pacifico-pi

## Overview

Pacífico POS is a web point-of-sale and business administration system. The principal workflow is staff authentication followed by product selection and cart-based checkout; the README also describes sales reporting, inventory, user, branch, and dashboard capabilities. The sampled code confirms login/session handling and selected API reads, but does not show the full checkout or most page-to-service wiring, so uncertain connections are omitted.

Main entry points: [`shared/lib/db.ts`](https://github.com/gasdcoder07/pacifico-pi/blob/main/shared/lib/db.ts) (PostgreSQL data), [`shared/lib/supabase.ts`](https://github.com/gasdcoder07/pacifico-pi/blob/main/shared/lib/supabase.ts) (Supabase auth), [`features/sell/components/ProductCatalog.tsx`](https://github.com/gasdcoder07/pacifico-pi/blob/main/features/sell/components/ProductCatalog.tsx) (Product catalog), [`features/auth/hooks/useAuth.ts`](https://github.com/gasdcoder07/pacifico-pi/blob/main/features/auth/hooks/useAuth.ts) (Auth session hook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_auth["Authentication"]
  node_loginpage["Login page<br/>[page.tsx]"]
  node_loginform["Login form<br/>[LoginForm.tsx]"]
  node_authhook["Auth session hook<br/>[useAuth.ts]"]
  node_authservice["Auth service<br/>[auth.service.ts]"]
  node_loginapi["Login endpoint<br/>[route.ts]"]
  node_registerapi["Registration endpoints<br/>[route.ts]"]
end

subgraph group_pos["Point of Sale"]
  node_sellpage["Sell page<br/>[page.tsx]"]
  node_catalog["Product catalog<br/>[ProductCatalog.tsx]"]
  node_search["Product search<br/>[ProductSearch.tsx]"]
  node_cart["Cart panel<br/>[CartPanel.tsx]"]
  node_cartstore["Cart state<br/>[cart-store.ts]"]
  node_productservice["Product service<br/>[product.service.ts]"]
  node_salespage["Sales history<br/>[page.tsx]"]
end

subgraph group_admin["Business Administration"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_inventory["Inventory management<br/>[page.tsx]"]
  node_inventoryapi["Inventory endpoints<br/>[route.ts]"]
  node_users["User management<br/>[page.tsx]"]
  node_usersapi["User endpoints<br/>[route.ts]"]
  node_branches["Branch management<br/>[page.tsx]"]
  node_branchesapi["Branch endpoints<br/>[route.ts]"]
end

subgraph group_infra["Backend and Data"]
  node_axios["API client<br/>[axios.ts]"]
  node_database[("PostgreSQL data<br/>[db.ts]")]
  node_supabase["Supabase auth<br/>[supabase.ts]"]
end

node_staff(("Staff member"))

node_staff -->|"opens"| node_loginpage
node_loginpage -->|"renders"| node_loginform
node_loginform -->|"submits credentials"| node_authhook
node_authhook -->|"calls login"| node_authservice
node_authservice -->|"sends request"| node_axios
node_axios -->|"posts credentials"| node_loginapi
node_loginapi -->|"authenticates"| node_supabase
node_loginapi -->|"reads profile"| node_database
node_authhook -->|"redirects after login"| node_sellpage
node_staff -->|"uses POS"| node_sellpage
node_sellpage -->|"renders"| node_catalog
node_catalog -->|"offers search"| node_search
node_catalog -->|"loads products"| node_productservice
node_catalog -->|"adds selections"| node_cartstore
node_cart -->|"reads cart"| node_cartstore
node_staff -->|"checks sales"| node_salespage
node_staff -->|"views summary"| node_dashboard
node_staff -->|"manages stock"| node_inventory
node_inventoryapi -->|"validates token"| node_supabase
node_inventoryapi -->|"reads inventory"| node_database
node_staff -->|"manages users"| node_users
node_usersapi -->|"validates token"| node_supabase
node_usersapi -->|"reads profiles"| node_database
node_staff -->|"manages branches"| node_branches
node_branchesapi -->|"validates token"| node_supabase
node_branchesapi -->|"reads branches"| node_database
node_registerapi -->|"creates account"| node_supabase
node_registerapi -->|"updates profile"| node_database

click node_loginpage "https://github.com/gasdcoder07/pacifico-pi/blob/main/app/(auth)/login/page.tsx"
click node_loginform "https://github.com/gasdcoder07/pacifico-pi/blob/main/features/auth/components/LoginForm.tsx"
click node_authhook "https://github.com/gasdcoder07/pacifico-pi/blob/main/features/auth/hooks/useAuth.ts"
click node_authservice "https://github.com/gasdcoder07/pacifico-pi/blob/main/features/auth/services/auth.service.ts"
click node_loginapi "https://github.com/gasdcoder07/pacifico-pi/blob/main/app/api/auth/login/route.ts"
click node_registerapi "https://github.com/gasdcoder07/pacifico-pi/blob/main/app/api/auth/register/admin/route.ts"
click node_sellpage "https://github.com/gasdcoder07/pacifico-pi/blob/main/app/(dashboard)/sell/page.tsx"
click node_catalog "https://github.com/gasdcoder07/pacifico-pi/blob/main/features/sell/components/ProductCatalog.tsx"
click node_search "https://github.com/gasdcoder07/pacifico-pi/blob/main/features/sell/components/ProductSearch.tsx"
click node_cart "https://github.com/gasdcoder07/pacifico-pi/blob/main/features/sell/components/CartPanel.tsx"
click node_cartstore "https://github.com/gasdcoder07/pacifico-pi/blob/main/features/sell/store/cart-store.ts"
click node_productservice "https://github.com/gasdcoder07/pacifico-pi/blob/main/features/sell/services/product.service.ts"
click node_salespage "https://github.com/gasdcoder07/pacifico-pi/blob/main/app/sales/page.tsx"
click node_dashboard "https://github.com/gasdcoder07/pacifico-pi/blob/main/app/(dashboard)/dashboard/page.tsx"
click node_inventory "https://github.com/gasdcoder07/pacifico-pi/blob/main/app/(dashboard)/inventory/page.tsx"
click node_inventoryapi "https://github.com/gasdcoder07/pacifico-pi/blob/main/app/api/inventory/route.ts"
click node_users "https://github.com/gasdcoder07/pacifico-pi/blob/main/app/(dashboard)/users/page.tsx"
click node_usersapi "https://github.com/gasdcoder07/pacifico-pi/blob/main/app/api/usuarios/route.ts"
click node_branches "https://github.com/gasdcoder07/pacifico-pi/blob/main/app/(dashboard)/branches/page.tsx"
click node_branchesapi "https://github.com/gasdcoder07/pacifico-pi/blob/main/app/api/sucursales/route.ts"
click node_axios "https://github.com/gasdcoder07/pacifico-pi/blob/main/shared/lib/axios.ts"
click node_database "https://github.com/gasdcoder07/pacifico-pi/blob/main/shared/lib/db.ts"
click node_supabase "https://github.com/gasdcoder07/pacifico-pi/blob/main/shared/lib/supabase.ts"

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_loginpage,node_loginform,node_authhook,node_authservice,node_loginapi,node_registerapi toneBlue
class node_sellpage,node_catalog,node_search,node_cart,node_cartstore,node_productservice,node_salespage toneAmber
class node_dashboard,node_inventory,node_inventoryapi,node_users,node_usersapi,node_branches,node_branchesapi toneMint
class node_axios,node_database,node_supabase toneRose
class node_staff toneIndigo
```

## Components

### Authentication

- [Login page](https://github.com/gasdcoder07/pacifico-pi/blob/main/app/(auth)/login/page.tsx): `app/(auth)/login/page.tsx`
- [Login form](https://github.com/gasdcoder07/pacifico-pi/blob/main/features/auth/components/LoginForm.tsx): `features/auth/components/LoginForm.tsx`
- [Auth session hook](https://github.com/gasdcoder07/pacifico-pi/blob/main/features/auth/hooks/useAuth.ts): `features/auth/hooks/useAuth.ts`
- [Auth service](https://github.com/gasdcoder07/pacifico-pi/blob/main/features/auth/services/auth.service.ts): `features/auth/services/auth.service.ts`
- [Login endpoint](https://github.com/gasdcoder07/pacifico-pi/blob/main/app/api/auth/login/route.ts): `app/api/auth/login/route.ts`
- [Registration endpoints](https://github.com/gasdcoder07/pacifico-pi/blob/main/app/api/auth/register/admin/route.ts): `app/api/auth/register/admin/route.ts`

### Point of Sale

- [Sell page](https://github.com/gasdcoder07/pacifico-pi/blob/main/app/(dashboard)/sell/page.tsx): `app/(dashboard)/sell/page.tsx`
- [Product catalog](https://github.com/gasdcoder07/pacifico-pi/blob/main/features/sell/components/ProductCatalog.tsx): `features/sell/components/ProductCatalog.tsx`
- [Product search](https://github.com/gasdcoder07/pacifico-pi/blob/main/features/sell/components/ProductSearch.tsx): `features/sell/components/ProductSearch.tsx`
- [Cart panel](https://github.com/gasdcoder07/pacifico-pi/blob/main/features/sell/components/CartPanel.tsx): `features/sell/components/CartPanel.tsx`
- [Cart state](https://github.com/gasdcoder07/pacifico-pi/blob/main/features/sell/store/cart-store.ts): `features/sell/store/cart-store.ts`
- [Product service](https://github.com/gasdcoder07/pacifico-pi/blob/main/features/sell/services/product.service.ts): `features/sell/services/product.service.ts`
- [Sales history](https://github.com/gasdcoder07/pacifico-pi/blob/main/app/sales/page.tsx): `app/sales/page.tsx`

### Business Administration

- [Dashboard](https://github.com/gasdcoder07/pacifico-pi/blob/main/app/(dashboard)/dashboard/page.tsx): `app/(dashboard)/dashboard/page.tsx`
- [Inventory management](https://github.com/gasdcoder07/pacifico-pi/blob/main/app/(dashboard)/inventory/page.tsx): `app/(dashboard)/inventory/page.tsx`
- [Inventory endpoints](https://github.com/gasdcoder07/pacifico-pi/blob/main/app/api/inventory/route.ts): `app/api/inventory/route.ts`
- [User management](https://github.com/gasdcoder07/pacifico-pi/blob/main/app/(dashboard)/users/page.tsx): `app/(dashboard)/users/page.tsx`
- [User endpoints](https://github.com/gasdcoder07/pacifico-pi/blob/main/app/api/usuarios/route.ts): `app/api/usuarios/route.ts`
- [Branch management](https://github.com/gasdcoder07/pacifico-pi/blob/main/app/(dashboard)/branches/page.tsx): `app/(dashboard)/branches/page.tsx`
- [Branch endpoints](https://github.com/gasdcoder07/pacifico-pi/blob/main/app/api/sucursales/route.ts): `app/api/sucursales/route.ts`

### Backend and Data

- [API client](https://github.com/gasdcoder07/pacifico-pi/blob/main/shared/lib/axios.ts): `shared/lib/axios.ts`
- [PostgreSQL data](https://github.com/gasdcoder07/pacifico-pi/blob/main/shared/lib/db.ts): `shared/lib/db.ts`
- [Supabase auth](https://github.com/gasdcoder07/pacifico-pi/blob/main/shared/lib/supabase.ts): `shared/lib/supabase.ts`

### Other components

- **Staff member**

## Connections

- Staff member → Login page: opens
- Login page → Login form: renders
- Login form → Auth session hook: submits credentials
- Auth session hook → Auth service: calls login
- Auth service → API client: sends request
- API client → Login endpoint: posts credentials
- Login endpoint → Supabase auth: authenticates
- Login endpoint → PostgreSQL data: reads profile
- Auth session hook → Sell page: redirects after login
- Staff member → Sell page: uses POS
- Sell page → Product catalog: renders
- Product catalog → Product search: offers search
- Product catalog → Product service: loads products
- Product catalog → Cart state: adds selections
- Cart panel → Cart state: reads cart
- Staff member → Sales history: checks sales
- Staff member → Dashboard: views summary
- Staff member → Inventory management: manages stock
- Inventory endpoints → Supabase auth: validates token
- Inventory endpoints → PostgreSQL data: reads inventory
- Staff member → User management: manages users
- User endpoints → Supabase auth: validates token
- User endpoints → PostgreSQL data: reads profiles
- Staff member → Branch management: manages branches
- Branch endpoints → Supabase auth: validates token
- Branch endpoints → PostgreSQL data: reads branches
- Registration endpoints → Supabase auth: creates account
- Registration endpoints → PostgreSQL data: updates profile
