# erwan-p/patisserie architecture

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

- Interactive diagram: https://gitdiagram.com/erwan-p/patisserie
- Repository: https://github.com/erwan-p/patisserie

## Overview

La Maison Sucrée is a bakery storefront with customer accounts, pickup ordering, and an administration area. Customers browse products, keep a cart and pickup slot, authenticate, pay through Stripe, and have paid orders fulfilled and confirmed. Admins manage products, orders, dashboard views, settings, and protected media; account and admin authentication include email/password flows and an additional admin verification step. The graph preserves these major capabilities, while unsampled modules are included only where the tree or source index identifies them. Edges reflect shown calls or indexed references; several page-to-action relationships remain unconnected where their wiring was not inspected.

Main entry points: [`src/lib/prisma.ts`](https://github.com/erwan-p/patisserie/blob/master/src/lib/prisma.ts) (Prisma Database), [`src/lib/auth.ts`](https://github.com/erwan-p/patisserie/blob/master/src/lib/auth.ts) (Authentication), [`src/app/api/checkout/route.ts`](https://github.com/erwan-p/patisserie/blob/master/src/app/api/checkout/route.ts) (Checkout API), [`src/app/api/checkout/verify/route.ts`](https://github.com/erwan-p/patisserie/blob/master/src/app/api/checkout/verify/route.ts) (Payment Verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_storefront["Storefront Pages"]
  node_catalogue["Product Catalogue"]
  node_home["Bakery Home<br/>[HomeClient.tsx]"]
  node_profile["Customer Profile<br/>[ProfileClient.tsx]"]
end

subgraph group_commerce["Ordering and Payments"]
  node_cart[("Cart State<br/>[store.ts]")]
  node_cartpage["Cart and Pickup<br/>[PanierClient.tsx]"]
  node_checkout["Checkout API<br/>[route.ts]"]
  node_stripe{{"Stripe"}}
  node_verify["Payment Verification<br/>[route.ts]"]
  node_webhook["Stripe Webhook<br/>[route.ts]"]
  node_fulfillment["Order Fulfillment"]
  node_orders[("Order Database<br/>[prisma.ts]")]
  node_success["Order Success<br/>[SuccesClient.tsx]"]
end

subgraph group_admin["Administration"]
  node_adminpages["Admin Pages"]
  node_dashboard["Dashboard Actions<br/>[dashboard.ts]"]
  node_adminactions["Admin Actions<br/>[admin.ts]"]
  node_products["Product Actions<br/>[product.ts]"]
  node_settings["Settings Actions<br/>[settings.ts]"]
  node_upload["Media Upload API<br/>[route.ts]"]
end

subgraph group_platform["Identity and Services"]
  node_useractions["User Actions<br/>[user.ts]"]
  node_adminauth["Verified Admin Auth<br/>[admin-auth.ts]"]
  node_twofa["Admin 2FA<br/>[admin-2fa.ts]"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_email["Email Delivery<br/>[email.ts]"]
  node_database[("Prisma Database<br/>[prisma.ts]")]
  node_storage[("Supabase Storage<br/>[storage.ts]")]
  node_cleanup["Storage Cleanup<br/>[storage-cleanup.ts]"]
end

node_shopper(("Shopper"))

node_shopper -.->|"browses"| node_catalogue
node_catalogue -->|"updates"| node_cart
node_cartpage -->|"reads and updates"| node_cart
node_shopper -.->|"manages cart"| node_cartpage
node_cartpage -.->|"starts checkout"| node_checkout
node_checkout -->|"validates products"| node_database
node_checkout -->|"checks session"| node_auth
node_checkout -->|"creates session"| node_stripe
node_stripe -.->|"payment lookup"| node_verify
node_verify -->|"retrieves session"| node_stripe
node_verify -->|"fulfills paid order"| node_fulfillment
node_webhook -->|"fulfills payment"| node_fulfillment
node_fulfillment -->|"writes order and stock"| node_database
node_verify -->|"sends receipt"| node_email
node_webhook -->|"sends receipt"| node_email
node_success -->|"reads cart"| node_cart
node_adminpages -->|"uses dashboard data"| node_dashboard
node_adminpages -->|"reads dashboard data"| node_database
node_adminpages -->|"uses settings actions"| node_settings
node_products -->|"reads and writes"| node_database
node_products -->|"removes unused media"| node_cleanup
node_settings -->|"reads and writes"| node_database
node_profile -->|"uses account actions"| node_useractions
node_useractions -->|"checks session"| node_auth
node_useractions -->|"reads and writes"| node_database
node_adminactions -->|"checks session"| node_auth
node_adminactions -->|"verifies admin token"| node_twofa
node_adminauth -->|"gets session"| node_auth
node_adminauth -->|"verifies token"| node_twofa
node_auth -->|"uses adapter and queries"| node_database
node_upload -->|"checks admin"| node_adminauth
node_upload -->|"uploads media"| node_storage
node_cleanup -->|"checks references"| node_database
node_cleanup -->|"removes objects"| node_storage

click node_storefront "https://github.com/erwan-p/patisserie/tree/master/src/app"
click node_catalogue "https://github.com/erwan-p/patisserie/blob/master/src/app/catalogue/CatalogueClient.tsx"
click node_home "https://github.com/erwan-p/patisserie/blob/master/src/components/home/HomeClient.tsx"
click node_cart "https://github.com/erwan-p/patisserie/blob/master/src/lib/store.ts"
click node_cartpage "https://github.com/erwan-p/patisserie/blob/master/src/app/panier/PanierClient.tsx"
click node_checkout "https://github.com/erwan-p/patisserie/blob/master/src/app/api/checkout/route.ts"
click node_verify "https://github.com/erwan-p/patisserie/blob/master/src/app/api/checkout/verify/route.ts"
click node_webhook "https://github.com/erwan-p/patisserie/blob/master/src/app/api/webhook/stripe/route.ts"
click node_fulfillment "https://github.com/erwan-p/patisserie/blob/master/src/lib/order-fulfillment.ts"
click node_orders "https://github.com/erwan-p/patisserie/blob/master/src/lib/prisma.ts"
click node_success "https://github.com/erwan-p/patisserie/blob/master/src/app/commande/succes/SuccesClient.tsx"
click node_adminpages "https://github.com/erwan-p/patisserie/tree/master/src/app/admin"
click node_dashboard "https://github.com/erwan-p/patisserie/blob/master/src/actions/dashboard.ts"
click node_adminactions "https://github.com/erwan-p/patisserie/blob/master/src/actions/admin.ts"
click node_products "https://github.com/erwan-p/patisserie/blob/master/src/actions/product.ts"
click node_settings "https://github.com/erwan-p/patisserie/blob/master/src/actions/settings.ts"
click node_useractions "https://github.com/erwan-p/patisserie/blob/master/src/actions/user.ts"
click node_profile "https://github.com/erwan-p/patisserie/blob/master/src/app/profil/ProfileClient.tsx"
click node_adminauth "https://github.com/erwan-p/patisserie/blob/master/src/lib/admin-auth.ts"
click node_twofa "https://github.com/erwan-p/patisserie/blob/master/src/lib/admin-2fa.ts"
click node_auth "https://github.com/erwan-p/patisserie/blob/master/src/lib/auth.ts"
click node_email "https://github.com/erwan-p/patisserie/blob/master/src/lib/email.ts"
click node_database "https://github.com/erwan-p/patisserie/blob/master/src/lib/prisma.ts"
click node_upload "https://github.com/erwan-p/patisserie/blob/master/src/app/api/upload/route.ts"
click node_storage "https://github.com/erwan-p/patisserie/blob/master/src/lib/storage.ts"
click node_cleanup "https://github.com/erwan-p/patisserie/blob/master/src/lib/storage-cleanup.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_catalogue,node_home,node_profile toneBlue
class node_cart,node_cartpage,node_checkout,node_stripe,node_verify,node_webhook,node_fulfillment,node_orders,node_success toneAmber
class node_adminpages,node_dashboard,node_adminactions,node_products,node_settings,node_upload toneMint
class node_useractions,node_adminauth,node_twofa,node_auth,node_email,node_database,node_storage,node_cleanup toneRose
class node_shopper toneIndigo
```

## Components

### Storefront

- [Storefront Pages](https://github.com/erwan-p/patisserie/tree/master/src/app): `src/app`
- [Product Catalogue](https://github.com/erwan-p/patisserie/blob/master/src/app/catalogue/CatalogueClient.tsx): `src/app/catalogue/CatalogueClient.tsx`
- [Bakery Home](https://github.com/erwan-p/patisserie/blob/master/src/components/home/HomeClient.tsx): `src/components/home/HomeClient.tsx`
- [Customer Profile](https://github.com/erwan-p/patisserie/blob/master/src/app/profil/ProfileClient.tsx): `src/app/profil/ProfileClient.tsx`

### Ordering and Payments

- [Cart State](https://github.com/erwan-p/patisserie/blob/master/src/lib/store.ts): `src/lib/store.ts`
- [Cart and Pickup](https://github.com/erwan-p/patisserie/blob/master/src/app/panier/PanierClient.tsx): `src/app/panier/PanierClient.tsx`
- [Checkout API](https://github.com/erwan-p/patisserie/blob/master/src/app/api/checkout/route.ts): `src/app/api/checkout/route.ts`
- **Stripe**
- [Payment Verification](https://github.com/erwan-p/patisserie/blob/master/src/app/api/checkout/verify/route.ts): `src/app/api/checkout/verify/route.ts`
- [Stripe Webhook](https://github.com/erwan-p/patisserie/blob/master/src/app/api/webhook/stripe/route.ts): `src/app/api/webhook/stripe/route.ts`
- [Order Fulfillment](https://github.com/erwan-p/patisserie/blob/master/src/lib/order-fulfillment.ts): `src/lib/order-fulfillment.ts`
- [Order Database](https://github.com/erwan-p/patisserie/blob/master/src/lib/prisma.ts): `src/lib/prisma.ts`
- [Order Success](https://github.com/erwan-p/patisserie/blob/master/src/app/commande/succes/SuccesClient.tsx): `src/app/commande/succes/SuccesClient.tsx`

### Administration

- [Admin Pages](https://github.com/erwan-p/patisserie/tree/master/src/app/admin): `src/app/admin`
- [Dashboard Actions](https://github.com/erwan-p/patisserie/blob/master/src/actions/dashboard.ts): `src/actions/dashboard.ts`
- [Admin Actions](https://github.com/erwan-p/patisserie/blob/master/src/actions/admin.ts): `src/actions/admin.ts`
- [Product Actions](https://github.com/erwan-p/patisserie/blob/master/src/actions/product.ts): `src/actions/product.ts`
- [Settings Actions](https://github.com/erwan-p/patisserie/blob/master/src/actions/settings.ts): `src/actions/settings.ts`
- [Media Upload API](https://github.com/erwan-p/patisserie/blob/master/src/app/api/upload/route.ts): `src/app/api/upload/route.ts`

### Identity and Services

- [User Actions](https://github.com/erwan-p/patisserie/blob/master/src/actions/user.ts): `src/actions/user.ts`
- [Verified Admin Auth](https://github.com/erwan-p/patisserie/blob/master/src/lib/admin-auth.ts): `src/lib/admin-auth.ts`
- [Admin 2FA](https://github.com/erwan-p/patisserie/blob/master/src/lib/admin-2fa.ts): `src/lib/admin-2fa.ts`
- [Authentication](https://github.com/erwan-p/patisserie/blob/master/src/lib/auth.ts): `src/lib/auth.ts`
- [Email Delivery](https://github.com/erwan-p/patisserie/blob/master/src/lib/email.ts): `src/lib/email.ts`
- [Prisma Database](https://github.com/erwan-p/patisserie/blob/master/src/lib/prisma.ts): `src/lib/prisma.ts`
- [Supabase Storage](https://github.com/erwan-p/patisserie/blob/master/src/lib/storage.ts): `src/lib/storage.ts`
- [Storage Cleanup](https://github.com/erwan-p/patisserie/blob/master/src/lib/storage-cleanup.ts): `src/lib/storage-cleanup.ts`

### Other components

- **Shopper**

## Connections

- Shopper → Product Catalogue: browses
- Product Catalogue → Cart State: updates (evidence: `src/app/catalogue/CatalogueClient.tsx`)
- Cart and Pickup → Cart State: reads and updates (evidence: `src/lib/store.ts`)
- Shopper → Cart and Pickup: manages cart
- Cart and Pickup → Checkout API: starts checkout
- Checkout API → Prisma Database: validates products (evidence: `src/app/api/checkout/route.ts`)
- Checkout API → Authentication: checks session (evidence: `src/app/api/checkout/route.ts`)
- Checkout API → Stripe: creates session (evidence: `src/app/api/checkout/route.ts`)
- Stripe → Payment Verification: payment lookup
- Payment Verification → Stripe: retrieves session (evidence: `src/app/api/checkout/verify/route.ts`)
- Payment Verification → Order Fulfillment: fulfills paid order (evidence: `src/app/api/checkout/verify/route.ts`)
- Stripe Webhook → Order Fulfillment: fulfills payment (evidence: `src/app/api/webhook/stripe/route.ts`)
- Order Fulfillment → Prisma Database: writes order and stock (evidence: `src/lib/order-fulfillment.ts`)
- Payment Verification → Email Delivery: sends receipt (evidence: `src/app/api/checkout/verify/route.ts`)
- Stripe Webhook → Email Delivery: sends receipt (evidence: `src/app/api/webhook/stripe/route.ts`)
- Order Success → Cart State: reads cart (evidence: `src/app/commande/succes/SuccesClient.tsx`)
- Admin Pages → Dashboard Actions: uses dashboard data (evidence: `src/app/admin/page.tsx`)
- Admin Pages → Prisma Database: reads dashboard data (evidence: `src/app/admin/page.tsx`)
- Admin Pages → Settings Actions: uses settings actions (evidence: `src/app/admin/settings/SettingsClient.tsx`)
- Product Actions → Prisma Database: reads and writes (evidence: `src/actions/product.ts`)
- Product Actions → Storage Cleanup: removes unused media (evidence: `src/actions/product.ts`)
- Settings Actions → Prisma Database: reads and writes (evidence: `src/actions/settings.ts`)
- Customer Profile → User Actions: uses account actions (evidence: `src/app/profil/ProfileClient.tsx`)
- User Actions → Authentication: checks session (evidence: `src/actions/user.ts`)
- User Actions → Prisma Database: reads and writes (evidence: `src/actions/user.ts`)
- Admin Actions → Authentication: checks session (evidence: `src/actions/admin.ts`)
- Admin Actions → Admin 2FA: verifies admin token (evidence: `src/actions/admin.ts`)
- Verified Admin Auth → Authentication: gets session (evidence: `src/lib/admin-auth.ts`)
- Verified Admin Auth → Admin 2FA: verifies token (evidence: `src/lib/admin-auth.ts`)
- Authentication → Prisma Database: uses adapter and queries (evidence: `src/lib/auth.ts`)
- Media Upload API → Verified Admin Auth: checks admin (evidence: `src/app/api/upload/route.ts`)
- Media Upload API → Supabase Storage: uploads media (evidence: `src/app/api/upload/route.ts`)
- Storage Cleanup → Prisma Database: checks references (evidence: `src/lib/storage-cleanup.ts`)
- Storage Cleanup → Supabase Storage: removes objects (evidence: `src/lib/storage-cleanup.ts`)
