# jinthan10/tide architecture

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

- Interactive diagram: https://gitdiagram.com/jinthan10/tide
- Repository: https://github.com/jinthan10/tide

## Overview

Pamban Tide is a seafood e-commerce application. Customers browse and search products, inspect product and packing details, manage a cart, validate a Tamil Nadu delivery address, and place and track orders; administrators can manage products and order status. The React interface calls an Express API backed by PostgreSQL via Prisma. The README documents the broader capabilities; some routes, including cart, and infrastructure details are unsampled, so their internal relationships are not inferred.

Main entry points: [`backend/src/server.ts`](https://github.com/jinthan10/tide/blob/main/backend/src/server.ts) (API Server), [`backend/src/lib/prisma.ts`](https://github.com/jinthan10/tide/blob/main/backend/src/lib/prisma.ts) (Prisma Client), [`frontend/src/main.tsx`](https://github.com/jinthan10/tide/blob/main/frontend/src/main.tsx) (Storefront UI), [`backend/src/routes/auth.ts`](https://github.com/jinthan10/tide/blob/main/backend/src/routes/auth.ts) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Storefront"]
  node_storefront["Storefront UI<br/>[main.tsx]"]
  node_packing["Packing Experience"]
  node_api_client["API Client<br/>[api.ts]"]
end

subgraph group_api["API and Commerce"]
  node_api_server["API Server<br/>[server.ts]"]
  node_product_routes["Product Catalog<br/>[products.ts]"]
  node_cart_routes["Cart<br/>[cart.ts]"]
  node_address_routes["Addresses<br/>[addresses.ts]"]
  node_order_routes["Orders<br/>[orders.ts]"]
  node_profile_routes["User Profile<br/>[me.ts]"]
  node_error_middleware["Error Handling<br/>[error.ts]"]
end

subgraph group_identity["Identity and Security"]
  node_auth_routes["Authentication<br/>[auth.ts]"]
  node_token_utils["Token Utilities<br/>[auth.ts]"]
  node_auth_middleware["Auth Middleware<br/>[auth.ts]"]
end

subgraph group_data["Persistence"]
  node_prisma_client["Prisma Client<br/>[prisma.ts]"]
  node_database[("PostgreSQL<br/>[schema.prisma]")]
end

node_customer(("Customer"))
node_admin(("Administrator"))

node_customer -->|"browses and buys"| node_storefront
node_admin -.->|"manages store"| node_storefront
node_storefront -->|"sends requests"| node_api_client
node_storefront -->|"shows packing steps"| node_packing
node_api_client -->|"calls API"| node_api_server
node_api_server -->|"mounts auth"| node_auth_routes
node_api_server -->|"mounts products"| node_product_routes
node_api_server -->|"mounts cart"| node_cart_routes
node_api_server -->|"mounts orders"| node_order_routes
node_api_server -->|"mounts addresses"| node_address_routes
node_api_server -->|"mounts profile"| node_profile_routes
node_api_server -->|"uses handlers"| node_error_middleware
node_auth_routes -->|"signs tokens"| node_token_utils
node_auth_middleware -->|"verifies tokens"| node_token_utils
node_auth_routes -->|"reads and writes users"| node_prisma_client
node_product_routes -->|"queries products"| node_prisma_client
node_address_routes -->|"manages addresses"| node_prisma_client
node_order_routes -->|"creates and reads orders"| node_prisma_client
node_profile_routes -->|"reads user profile"| node_prisma_client
node_api_server -->|"checks database health"| node_prisma_client
node_prisma_client -.->|"accesses database"| node_database

click node_storefront "https://github.com/jinthan10/tide/blob/main/frontend/src/main.tsx"
click node_packing "https://github.com/jinthan10/tide/tree/main/frontend/public/packing"
click node_api_client "https://github.com/jinthan10/tide/blob/main/frontend/src/lib/api.ts"
click node_api_server "https://github.com/jinthan10/tide/blob/main/backend/src/server.ts"
click node_auth_routes "https://github.com/jinthan10/tide/blob/main/backend/src/routes/auth.ts"
click node_token_utils "https://github.com/jinthan10/tide/blob/main/backend/src/lib/auth.ts"
click node_auth_middleware "https://github.com/jinthan10/tide/blob/main/backend/src/middleware/auth.ts"
click node_product_routes "https://github.com/jinthan10/tide/blob/main/backend/src/routes/products.ts"
click node_cart_routes "https://github.com/jinthan10/tide/blob/main/backend/src/routes/cart.ts"
click node_address_routes "https://github.com/jinthan10/tide/blob/main/backend/src/routes/addresses.ts"
click node_order_routes "https://github.com/jinthan10/tide/blob/main/backend/src/routes/orders.ts"
click node_profile_routes "https://github.com/jinthan10/tide/blob/main/backend/src/routes/me.ts"
click node_error_middleware "https://github.com/jinthan10/tide/blob/main/backend/src/middleware/error.ts"
click node_prisma_client "https://github.com/jinthan10/tide/blob/main/backend/src/lib/prisma.ts"
click node_database "https://github.com/jinthan10/tide/blob/main/backend/prisma/schema.prisma"

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_storefront,node_packing,node_api_client toneBlue
class node_api_server,node_product_routes,node_cart_routes,node_address_routes,node_order_routes,node_profile_routes,node_error_middleware toneAmber
class node_auth_routes,node_token_utils,node_auth_middleware toneMint
class node_prisma_client,node_database toneRose
class node_customer,node_admin toneIndigo
```

## Components

### Storefront

- [Storefront UI](https://github.com/jinthan10/tide/blob/main/frontend/src/main.tsx): `frontend/src/main.tsx`
- [Packing Experience](https://github.com/jinthan10/tide/tree/main/frontend/public/packing): `frontend/public/packing`
- [API Client](https://github.com/jinthan10/tide/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### API and Commerce

- [API Server](https://github.com/jinthan10/tide/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Product Catalog](https://github.com/jinthan10/tide/blob/main/backend/src/routes/products.ts): `backend/src/routes/products.ts`
- [Cart](https://github.com/jinthan10/tide/blob/main/backend/src/routes/cart.ts): `backend/src/routes/cart.ts`
- [Addresses](https://github.com/jinthan10/tide/blob/main/backend/src/routes/addresses.ts): `backend/src/routes/addresses.ts`
- [Orders](https://github.com/jinthan10/tide/blob/main/backend/src/routes/orders.ts): `backend/src/routes/orders.ts`
- [User Profile](https://github.com/jinthan10/tide/blob/main/backend/src/routes/me.ts): `backend/src/routes/me.ts`
- [Error Handling](https://github.com/jinthan10/tide/blob/main/backend/src/middleware/error.ts): `backend/src/middleware/error.ts`

### Identity and Security

- [Authentication](https://github.com/jinthan10/tide/blob/main/backend/src/routes/auth.ts): `backend/src/routes/auth.ts`
- [Token Utilities](https://github.com/jinthan10/tide/blob/main/backend/src/lib/auth.ts): `backend/src/lib/auth.ts`
- [Auth Middleware](https://github.com/jinthan10/tide/blob/main/backend/src/middleware/auth.ts): `backend/src/middleware/auth.ts`

### Persistence

- [Prisma Client](https://github.com/jinthan10/tide/blob/main/backend/src/lib/prisma.ts): `backend/src/lib/prisma.ts`
- [PostgreSQL](https://github.com/jinthan10/tide/blob/main/backend/prisma/schema.prisma): `backend/prisma/schema.prisma`

### Other components

- **Customer**
- **Administrator**

## Connections

- Customer → Storefront UI: browses and buys (evidence: `README.md`)
- Administrator → Storefront UI: manages store (evidence: `README.md`)
- Storefront UI → API Client: sends requests (evidence: `frontend/src/main.tsx`)
- Storefront UI → Packing Experience: shows packing steps (evidence: `README.md`)
- API Client → API Server: calls API (evidence: `frontend/src/lib/api.ts`)
- API Server → Authentication: mounts auth (evidence: `backend/src/server.ts`)
- API Server → Product Catalog: mounts products (evidence: `backend/src/server.ts`)
- API Server → Cart: mounts cart (evidence: `backend/src/server.ts`)
- API Server → Orders: mounts orders (evidence: `backend/src/server.ts`)
- API Server → Addresses: mounts addresses (evidence: `backend/src/server.ts`)
- API Server → User Profile: mounts profile (evidence: `backend/src/server.ts`)
- API Server → Error Handling: uses handlers (evidence: `backend/src/server.ts`)
- Authentication → Token Utilities: signs tokens (evidence: `backend/src/routes/auth.ts`)
- Auth Middleware → Token Utilities: verifies tokens (evidence: `backend/src/middleware/auth.ts`)
- Authentication → Prisma Client: reads and writes users (evidence: `backend/src/routes/auth.ts`)
- Product Catalog → Prisma Client: queries products (evidence: `backend/src/routes/products.ts`)
- Addresses → Prisma Client: manages addresses (evidence: `backend/src/routes/addresses.ts`)
- Orders → Prisma Client: creates and reads orders (evidence: `backend/src/routes/orders.ts`)
- User Profile → Prisma Client: reads user profile (evidence: `backend/src/routes/me.ts`)
- API Server → Prisma Client: checks database health (evidence: `backend/src/server.ts`)
- Prisma Client → PostgreSQL: accesses database
