# coderblack25/veloura architecture

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

- Interactive diagram: https://gitdiagram.com/coderblack25/veloura
- Repository: https://github.com/coderblack25/veloura

## Overview

Veloura is a guest-checkout storefront and staff dashboard for a small product catalog. Shoppers browse product variants, maintain a client-side cart, and begin checkout; the checkout route revalidates price and stock before creating a Stripe session. Stripe’s webhook is the order-creation authority, updating inventory and triggering confirmation email. Separate branches cover guest order lookup and staff order/inventory management. Edges reflect README statements and shown imports/calls; unsampled admin and contact internals are represented conservatively.

Main entry points: [`src/app/api/checkout/session/route.ts`](https://github.com/coderblack25/veloura/blob/main/src/app/api/checkout/session/route.ts) (Checkout session), [`src/app/api/webhooks/stripe/route.ts`](https://github.com/coderblack25/veloura/blob/main/src/app/api/webhooks/stripe/route.ts) (Payment webhook), [`src/db/schema.ts`](https://github.com/coderblack25/veloura/blob/main/src/db/schema.ts) (Orders and inventory), [`src/lib/cart-service.ts`](https://github.com/coderblack25/veloura/blob/main/src/lib/cart-service.ts) (Stock validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_store["Storefront"]
  node_storefront["Store pages<br/>[page.tsx]"]
  node_product["Product detail<br/>[page.tsx]"]
  node_purchase["Purchase panel<br/>[purchase-panel.tsx]"]
  node_cart["Cart sheet<br/>[cart-sheet.tsx]"]
  node_cartstate["Cart state<br/>[cart-store.ts]"]
  node_lookupform["Lookup form"]
  node_contact["Contact form<br/>[contact-form.tsx]"]
  node_content["Editorial content<br/>[content.ts]"]
  node_about["About and FAQ<br/>[page.tsx]"]
  node_shippingreturns["Shipping information<br/>[page.tsx]"]
end

subgraph group_commerce["Commerce workflow"]
  node_cartaction["Cart actions<br/>[cart.ts]"]
  node_checkout["Checkout session<br/>[route.ts]"]
  node_cartservice["Stock validation<br/>[cart-service.ts]"]
  node_stripe["Stripe Checkout"]
  node_webhook["Payment webhook<br/>[route.ts]"]
  node_emailservice["Email delivery<br/>[email.ts]"]
  node_confirmation["Order email"]
  node_shippingemail["Shipping email"]
  node_success["Checkout success<br/>[page.tsx]"]
  node_lookup["Order lookup<br/>[route.ts]"]
  node_contactaction["Contact action<br/>[contact.ts]"]
end

subgraph group_operations["Staff operations"]
  node_adminlogin["Staff login<br/>[page.tsx]"]
  node_auth["Staff authentication<br/>[auth.ts]"]
  node_adminorders["Order management<br/>[page.tsx]"]
  node_adminorder["Order fulfillment<br/>[page.tsx]"]
  node_admininventory["Inventory management<br/>[page.tsx]"]
  node_adminactions["Admin actions<br/>[actions.ts]"]
end

subgraph group_platform["Shared platform"]
  node_catalog[("Catalog data<br/>[schema.ts]")]
  node_orders[("Orders and inventory<br/>[schema.ts]")]
  node_db["Database client<br/>[index.ts]"]
  node_rate["Rate limiting<br/>[rate-limit.ts]"]
  node_validation["Checkout validation<br/>[checkout.ts]"]
end

node_shopper(("Shopper"))
node_customer(("Customer"))

node_shopper -->|"browses"| node_storefront
node_shopper -->|"selects variant"| node_product
node_product -->|"reads catalog"| node_catalog
node_product -->|"renders"| node_purchase
node_purchase -->|"updates cart"| node_cartstate
node_cart -->|"reads cart"| node_cartstate
node_purchase -->|"calls"| node_cartaction
node_cartaction -->|"checks stock"| node_cartservice
node_cart -->|"starts checkout"| node_checkout
node_checkout -->|"validates payload"| node_validation
node_checkout -->|"limits requests"| node_rate
node_checkout -->|"revalidates items"| node_cartservice
node_cartservice -->|"queries"| node_db
node_db -->|"uses schema"| node_catalog
node_checkout -->|"creates session"| node_stripe
node_stripe -->|"sends payment event"| node_webhook
node_webhook -->|"verifies event"| node_stripe
node_webhook -->|"creates order, adjusts stock"| node_orders
node_webhook -->|"loads variants"| node_cartservice
node_webhook -->|"sends confirmation"| node_emailservice
node_emailservice -->|"renders"| node_confirmation
node_emailservice -->|"renders"| node_shippingemail
node_shopper -->|"views result"| node_success
node_success -->|"reads session"| node_stripe
node_shopper -->|"requests status"| node_lookupform
node_lookupform -->|"submits lookup"| node_lookup
node_lookup -->|"queries orders"| node_orders
node_customer -->|"sends inquiry"| node_contact
node_contact -.->|"submits"| node_contactaction
node_shopper -->|"reads"| node_about
node_shopper -->|"reads"| node_shippingreturns
node_about -->|"loads copy"| node_content
node_shippingreturns -->|"loads copy"| node_content
node_adminlogin -.->|"authenticates"| node_auth
node_adminorders -->|"reads orders"| node_orders
node_adminorder -.->|"fulfills order"| node_orders
node_admininventory -.->|"manages stock"| node_catalog
node_adminactions -->|"checks session and role"| node_auth
node_adminactions -.->|"updates records"| node_orders

click node_storefront "https://github.com/coderblack25/veloura/blob/main/src/app/page.tsx"
click node_product "https://github.com/coderblack25/veloura/blob/main/src/app/products/%5Bslug%5D/page.tsx"
click node_purchase "https://github.com/coderblack25/veloura/blob/main/src/components/purchase-panel.tsx"
click node_cart "https://github.com/coderblack25/veloura/blob/main/src/components/cart-sheet.tsx"
click node_cartstate "https://github.com/coderblack25/veloura/blob/main/src/store/cart-store.ts"
click node_catalog "https://github.com/coderblack25/veloura/blob/main/src/db/schema.ts"
click node_cartaction "https://github.com/coderblack25/veloura/blob/main/src/app/actions/cart.ts"
click node_checkout "https://github.com/coderblack25/veloura/blob/main/src/app/api/checkout/session/route.ts"
click node_cartservice "https://github.com/coderblack25/veloura/blob/main/src/lib/cart-service.ts"
click node_webhook "https://github.com/coderblack25/veloura/blob/main/src/app/api/webhooks/stripe/route.ts"
click node_orders "https://github.com/coderblack25/veloura/blob/main/src/db/schema.ts"
click node_emailservice "https://github.com/coderblack25/veloura/blob/main/src/lib/email.ts"
click node_confirmation "https://github.com/coderblack25/veloura/blob/main/emails/order-confirmation.tsx"
click node_shippingemail "https://github.com/coderblack25/veloura/blob/main/emails/shipping-confirmation.tsx"
click node_success "https://github.com/coderblack25/veloura/blob/main/src/app/checkout/success/page.tsx"
click node_lookup "https://github.com/coderblack25/veloura/blob/main/src/app/api/orders/lookup/route.ts"
click node_lookupform "https://github.com/coderblack25/veloura/blob/main/src/components/order-lookup-form.tsx"
click node_contact "https://github.com/coderblack25/veloura/blob/main/src/components/contact-form.tsx"
click node_contactaction "https://github.com/coderblack25/veloura/blob/main/src/app/actions/contact.ts"
click node_adminlogin "https://github.com/coderblack25/veloura/blob/main/src/app/admin/login/page.tsx"
click node_auth "https://github.com/coderblack25/veloura/blob/main/src/lib/auth.ts"
click node_adminorders "https://github.com/coderblack25/veloura/blob/main/src/app/admin/(dashboard)/orders/page.tsx"
click node_adminorder "https://github.com/coderblack25/veloura/blob/main/src/app/admin/(dashboard)/orders/%5Bid%5D/page.tsx"
click node_admininventory "https://github.com/coderblack25/veloura/blob/main/src/app/admin/(dashboard)/inventory/page.tsx"
click node_adminactions "https://github.com/coderblack25/veloura/blob/main/src/app/admin/actions.ts"
click node_db "https://github.com/coderblack25/veloura/blob/main/src/db/index.ts"
click node_content "https://github.com/coderblack25/veloura/blob/main/src/lib/content.ts"
click node_about "https://github.com/coderblack25/veloura/blob/main/src/app/about/page.tsx"
click node_shippingreturns "https://github.com/coderblack25/veloura/blob/main/src/app/shipping-returns/page.tsx"
click node_rate "https://github.com/coderblack25/veloura/blob/main/src/lib/rate-limit.ts"
click node_validation "https://github.com/coderblack25/veloura/blob/main/src/lib/validations/checkout.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_storefront,node_product,node_purchase,node_cart,node_cartstate,node_lookupform,node_contact,node_content,node_about,node_shippingreturns toneBlue
class node_cartaction,node_checkout,node_cartservice,node_stripe,node_webhook,node_emailservice,node_confirmation,node_shippingemail,node_success,node_lookup,node_contactaction toneAmber
class node_adminlogin,node_auth,node_adminorders,node_adminorder,node_admininventory,node_adminactions toneMint
class node_catalog,node_orders,node_db,node_rate,node_validation toneRose
class node_shopper,node_customer toneIndigo
```

## Components

### Storefront

- [Store pages](https://github.com/coderblack25/veloura/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Product detail](https://github.com/coderblack25/veloura/blob/main/src/app/products/%5Bslug%5D/page.tsx): `src/app/products/[slug]/page.tsx`
- [Purchase panel](https://github.com/coderblack25/veloura/blob/main/src/components/purchase-panel.tsx): `src/components/purchase-panel.tsx`
- [Cart sheet](https://github.com/coderblack25/veloura/blob/main/src/components/cart-sheet.tsx): `src/components/cart-sheet.tsx`
- [Cart state](https://github.com/coderblack25/veloura/blob/main/src/store/cart-store.ts): `src/store/cart-store.ts`
- [Lookup form](https://github.com/coderblack25/veloura/blob/main/src/components/order-lookup-form.tsx): `src/components/order-lookup-form.tsx`
- [Contact form](https://github.com/coderblack25/veloura/blob/main/src/components/contact-form.tsx): `src/components/contact-form.tsx`
- [Editorial content](https://github.com/coderblack25/veloura/blob/main/src/lib/content.ts): `src/lib/content.ts`
- [About and FAQ](https://github.com/coderblack25/veloura/blob/main/src/app/about/page.tsx): `src/app/about/page.tsx`
- [Shipping information](https://github.com/coderblack25/veloura/blob/main/src/app/shipping-returns/page.tsx): `src/app/shipping-returns/page.tsx`

### Commerce workflow

- [Cart actions](https://github.com/coderblack25/veloura/blob/main/src/app/actions/cart.ts): `src/app/actions/cart.ts`
- [Checkout session](https://github.com/coderblack25/veloura/blob/main/src/app/api/checkout/session/route.ts): `src/app/api/checkout/session/route.ts`
- [Stock validation](https://github.com/coderblack25/veloura/blob/main/src/lib/cart-service.ts): `src/lib/cart-service.ts`
- **Stripe Checkout**
- [Payment webhook](https://github.com/coderblack25/veloura/blob/main/src/app/api/webhooks/stripe/route.ts): `src/app/api/webhooks/stripe/route.ts`
- [Email delivery](https://github.com/coderblack25/veloura/blob/main/src/lib/email.ts): `src/lib/email.ts`
- [Order email](https://github.com/coderblack25/veloura/blob/main/emails/order-confirmation.tsx): `emails/order-confirmation.tsx`
- [Shipping email](https://github.com/coderblack25/veloura/blob/main/emails/shipping-confirmation.tsx): `emails/shipping-confirmation.tsx`
- [Checkout success](https://github.com/coderblack25/veloura/blob/main/src/app/checkout/success/page.tsx): `src/app/checkout/success/page.tsx`
- [Order lookup](https://github.com/coderblack25/veloura/blob/main/src/app/api/orders/lookup/route.ts): `src/app/api/orders/lookup/route.ts`
- [Contact action](https://github.com/coderblack25/veloura/blob/main/src/app/actions/contact.ts): `src/app/actions/contact.ts`

### Staff operations

- [Staff login](https://github.com/coderblack25/veloura/blob/main/src/app/admin/login/page.tsx): `src/app/admin/login/page.tsx`
- [Staff authentication](https://github.com/coderblack25/veloura/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Order management](https://github.com/coderblack25/veloura/blob/main/src/app/admin/(dashboard)/orders/page.tsx): `src/app/admin/(dashboard)/orders/page.tsx`
- [Order fulfillment](https://github.com/coderblack25/veloura/blob/main/src/app/admin/(dashboard)/orders/%5Bid%5D/page.tsx): `src/app/admin/(dashboard)/orders/[id]/page.tsx`
- [Inventory management](https://github.com/coderblack25/veloura/blob/main/src/app/admin/(dashboard)/inventory/page.tsx): `src/app/admin/(dashboard)/inventory/page.tsx`
- [Admin actions](https://github.com/coderblack25/veloura/blob/main/src/app/admin/actions.ts): `src/app/admin/actions.ts`

### Shared platform

- [Catalog data](https://github.com/coderblack25/veloura/blob/main/src/db/schema.ts): `src/db/schema.ts`
- [Orders and inventory](https://github.com/coderblack25/veloura/blob/main/src/db/schema.ts): `src/db/schema.ts`
- [Database client](https://github.com/coderblack25/veloura/blob/main/src/db/index.ts): `src/db/index.ts`
- [Rate limiting](https://github.com/coderblack25/veloura/blob/main/src/lib/rate-limit.ts): `src/lib/rate-limit.ts`
- [Checkout validation](https://github.com/coderblack25/veloura/blob/main/src/lib/validations/checkout.ts): `src/lib/validations/checkout.ts`

### Other components

- **Shopper**
- **Customer**

## Connections

- Shopper → Store pages: browses
- Shopper → Product detail: selects variant
- Product detail → Catalog data: reads catalog (evidence: `src/app/products/[slug]/page.tsx`)
- Product detail → Purchase panel: renders (evidence: `src/app/products/[slug]/page.tsx`)
- Purchase panel → Cart state: updates cart (evidence: `src/components/purchase-panel.tsx`)
- Cart sheet → Cart state: reads cart (evidence: `src/components/cart-sheet.tsx`)
- Purchase panel → Cart actions: calls (evidence: `src/components/purchase-panel.tsx`)
- Cart actions → Stock validation: checks stock (evidence: `src/components/purchase-panel.tsx`)
- Cart sheet → Checkout session: starts checkout
- Checkout session → Checkout validation: validates payload (evidence: `src/app/api/checkout/session/route.ts`)
- Checkout session → Rate limiting: limits requests (evidence: `src/app/api/checkout/session/route.ts`)
- Checkout session → Stock validation: revalidates items (evidence: `src/app/api/checkout/session/route.ts`)
- Stock validation → Database client: queries (evidence: `src/lib/cart-service.ts`)
- Database client → Catalog data: uses schema (evidence: `src/db/index.ts`)
- Checkout session → Stripe Checkout: creates session (evidence: `src/app/api/checkout/session/route.ts`)
- Stripe Checkout → Payment webhook: sends payment event
- Payment webhook → Stripe Checkout: verifies event (evidence: `src/app/api/webhooks/stripe/route.ts`)
- Payment webhook → Orders and inventory: creates order, adjusts stock (evidence: `src/app/api/webhooks/stripe/route.ts`)
- Payment webhook → Stock validation: loads variants (evidence: `src/app/api/webhooks/stripe/route.ts`)
- Payment webhook → Email delivery: sends confirmation (evidence: `src/app/api/webhooks/stripe/route.ts`)
- Email delivery → Order email: renders (evidence: `src/lib/email.ts`)
- Email delivery → Shipping email: renders (evidence: `src/lib/email.ts`)
- Shopper → Checkout success: views result
- Checkout success → Stripe Checkout: reads session (evidence: `src/app/checkout/success/page.tsx`)
- Shopper → Lookup form: requests status
- Lookup form → Order lookup: submits lookup (evidence: `src/components/order-lookup-form.tsx`)
- Order lookup → Orders and inventory: queries orders (evidence: `src/app/api/orders/lookup/route.ts`)
- Customer → Contact form: sends inquiry
- Contact form → Contact action: submits
- Shopper → About and FAQ: reads
- Shopper → Shipping information: reads
- About and FAQ → Editorial content: loads copy (evidence: `src/app/about/page.tsx`)
- Shipping information → Editorial content: loads copy (evidence: `src/app/shipping-returns/page.tsx`)
- Staff login → Staff authentication: authenticates
- Order management → Orders and inventory: reads orders (evidence: `src/app/admin/(dashboard)/orders/page.tsx`)
- Order fulfillment → Orders and inventory: fulfills order
- Inventory management → Catalog data: manages stock
- Admin actions → Staff authentication: checks session and role
- Admin actions → Orders and inventory: updates records
