# cafyrei/lacrochet architecture

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

- Interactive diagram: https://gitdiagram.com/cafyrei/lacrochet
- Repository: https://github.com/cafyrei/lacrochet

## Overview

La Crochet is an online handmade-goods shop with a customer storefront and an owner back office. Customers browse products, maintain a cart, sign in, choose pickup or delivery, and place cash-on-delivery or PayRex orders; the backend persists shop and order data and can arrange Lalamove delivery. The site also provides Yarnie chat, contact messaging, and owner tools for products, orders, messages, and newsletters. Edges use README workflow statements or source-index references; several route and frontend implementations were not excerpted, so their internal links are omitted where unverified.

Main entry points: [`backend/main.py`](https://github.com/cafyrei/lacrochet/blob/master/backend/main.py) (FastAPI server), [`backend/routes/orderRoutes.py`](https://github.com/cafyrei/lacrochet/blob/master/backend/routes/orderRoutes.py) (Order handling), [`la-crochet-project/src/Router.jsx`](https://github.com/cafyrei/lacrochet/blob/master/la-crochet-project/src/Router.jsx) (Storefront routes), [`la-crochet-project/src/context/CartContext.jsx`](https://github.com/cafyrei/lacrochet/blob/master/la-crochet-project/src/context/CartContext.jsx) (Cart state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer storefront"]
  node_router["Storefront routes<br/>[Router.jsx]"]
  node_catalog["Product browsing<br/>[CatalogPage.jsx]"]
  node_cart["Cart state<br/>[CartContext.jsx]"]
  node_checkout["Checkout<br/>[CheckoutPage.jsx]"]
  node_authui["Login context<br/>[AuthContext.jsx]"]
  node_adminui["Back office<br/>[AdminLayout.jsx]"]
end

subgraph group_commerce["Commerce backend"]
  node_backend["FastAPI server<br/>[main.py]"]
  node_auth["Identity and roles<br/>[auth.py]"]
  node_orders["Order handling<br/>[orderRoutes.py]"]
  node_catalogapi["Product management<br/>[productRoutes.py]"]
  node_cartapi["Cart endpoints<br/>[cartRoutes.py]"]
  node_records[("Shop records<br/>[database.py]")]
  node_orderdata["Order records<br/>[orderModel.py]"]
end

subgraph group_operations["Shop operations"]
  node_adminapi["Owner operations<br/>[adminRoutes.py]"]
  node_contact["Contact inbox<br/>[contactRoutes.py]"]
  node_newsletter["Newsletter signup"]
  node_photos["Product photos<br/>[photoRoutes.py]"]
  node_chat["Yarnie chat<br/>[chatRoutes.py]"]
end

subgraph group_integrations["External services"]
  node_payrex{{"PayRex"}}
  node_lalamove{{"Lalamove riders"}}
  node_gemini{{"Google Gemini"}}
  node_supabase[("Supabase database")]
end

node_customer(("Customer"))
node_owner(("Shop owner"))

node_customer -->|"shops"| node_router
node_router -->|"routes to"| node_catalog
node_customer -->|"adds items"| node_cart
node_cart -->|"checks out"| node_checkout
node_checkout -->|"sends order"| node_backend
node_authui -->|"authenticates"| node_backend
node_backend -->|"registers routes"| node_orders
node_backend -->|"registers routes"| node_catalogapi
node_backend -->|"registers routes"| node_cartapi
node_orders -->|"persists orders"| node_orderdata
node_orders -->|"uses sessions"| node_records
node_auth -->|"loads users"| node_records
node_owner -->|"manages shop"| node_adminui
node_adminui -->|"uses backend"| node_backend
node_backend -->|"registers routes"| node_adminapi
node_backend -->|"registers routes"| node_contact
node_backend -->|"registers routes"| node_newsletter
node_backend -->|"registers routes"| node_photos
node_backend -->|"registers routes"| node_chat
node_orders -->|"creates payments"| node_payrex
node_orders -->|"arranges delivery"| node_lalamove
node_adminapi -->|"books riders"| node_lalamove
node_chat -->|"generates replies"| node_gemini
node_backend -->|"stores records"| node_supabase

click node_router "https://github.com/cafyrei/lacrochet/blob/master/la-crochet-project/src/Router.jsx"
click node_catalog "https://github.com/cafyrei/lacrochet/blob/master/la-crochet-project/src/pages/CatalogPage.jsx"
click node_cart "https://github.com/cafyrei/lacrochet/blob/master/la-crochet-project/src/context/CartContext.jsx"
click node_checkout "https://github.com/cafyrei/lacrochet/blob/master/la-crochet-project/src/pages/CheckoutPage.jsx"
click node_authui "https://github.com/cafyrei/lacrochet/blob/master/la-crochet-project/src/context/AuthContext.jsx"
click node_adminui "https://github.com/cafyrei/lacrochet/blob/master/la-crochet-project/src/components/admin/AdminLayout.jsx"
click node_backend "https://github.com/cafyrei/lacrochet/blob/master/backend/main.py"
click node_auth "https://github.com/cafyrei/lacrochet/blob/master/backend/auth.py"
click node_orders "https://github.com/cafyrei/lacrochet/blob/master/backend/routes/orderRoutes.py"
click node_catalogapi "https://github.com/cafyrei/lacrochet/blob/master/backend/routes/productRoutes.py"
click node_cartapi "https://github.com/cafyrei/lacrochet/blob/master/backend/routes/cartRoutes.py"
click node_records "https://github.com/cafyrei/lacrochet/blob/master/backend/database.py"
click node_orderdata "https://github.com/cafyrei/lacrochet/blob/master/backend/models/orderModel.py"
click node_adminapi "https://github.com/cafyrei/lacrochet/blob/master/backend/routes/adminRoutes.py"
click node_contact "https://github.com/cafyrei/lacrochet/blob/master/backend/routes/contactRoutes.py"
click node_newsletter "https://github.com/cafyrei/lacrochet/blob/master/backend/routes/newsletterRoutes.py"
click node_photos "https://github.com/cafyrei/lacrochet/blob/master/backend/routes/photoRoutes.py"
click node_chat "https://github.com/cafyrei/lacrochet/blob/master/backend/routes/chatRoutes.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_router,node_catalog,node_cart,node_checkout,node_authui,node_adminui toneBlue
class node_backend,node_auth,node_orders,node_catalogapi,node_cartapi,node_records,node_orderdata toneAmber
class node_adminapi,node_contact,node_newsletter,node_photos,node_chat toneMint
class node_payrex,node_lalamove,node_gemini,node_supabase toneRose
class node_customer,node_owner toneIndigo
```

## Components

### Customer storefront

- [Storefront routes](https://github.com/cafyrei/lacrochet/blob/master/la-crochet-project/src/Router.jsx): `la-crochet-project/src/Router.jsx`
- [Product browsing](https://github.com/cafyrei/lacrochet/blob/master/la-crochet-project/src/pages/CatalogPage.jsx): `la-crochet-project/src/pages/CatalogPage.jsx`
- [Cart state](https://github.com/cafyrei/lacrochet/blob/master/la-crochet-project/src/context/CartContext.jsx): `la-crochet-project/src/context/CartContext.jsx`
- [Checkout](https://github.com/cafyrei/lacrochet/blob/master/la-crochet-project/src/pages/CheckoutPage.jsx): `la-crochet-project/src/pages/CheckoutPage.jsx`
- [Login context](https://github.com/cafyrei/lacrochet/blob/master/la-crochet-project/src/context/AuthContext.jsx): `la-crochet-project/src/context/AuthContext.jsx`
- [Back office](https://github.com/cafyrei/lacrochet/blob/master/la-crochet-project/src/components/admin/AdminLayout.jsx): `la-crochet-project/src/components/admin/AdminLayout.jsx`

### Commerce backend

- [FastAPI server](https://github.com/cafyrei/lacrochet/blob/master/backend/main.py): `backend/main.py`
- [Identity and roles](https://github.com/cafyrei/lacrochet/blob/master/backend/auth.py): `backend/auth.py`
- [Order handling](https://github.com/cafyrei/lacrochet/blob/master/backend/routes/orderRoutes.py): `backend/routes/orderRoutes.py`
- [Product management](https://github.com/cafyrei/lacrochet/blob/master/backend/routes/productRoutes.py): `backend/routes/productRoutes.py`
- [Cart endpoints](https://github.com/cafyrei/lacrochet/blob/master/backend/routes/cartRoutes.py): `backend/routes/cartRoutes.py`
- [Shop records](https://github.com/cafyrei/lacrochet/blob/master/backend/database.py): `backend/database.py`
- [Order records](https://github.com/cafyrei/lacrochet/blob/master/backend/models/orderModel.py): `backend/models/orderModel.py`

### Shop operations

- [Owner operations](https://github.com/cafyrei/lacrochet/blob/master/backend/routes/adminRoutes.py): `backend/routes/adminRoutes.py`
- [Contact inbox](https://github.com/cafyrei/lacrochet/blob/master/backend/routes/contactRoutes.py): `backend/routes/contactRoutes.py`
- [Newsletter signup](https://github.com/cafyrei/lacrochet/blob/master/backend/routes/newsletterRoutes.py): `backend/routes/newsletterRoutes.py`
- [Product photos](https://github.com/cafyrei/lacrochet/blob/master/backend/routes/photoRoutes.py): `backend/routes/photoRoutes.py`
- [Yarnie chat](https://github.com/cafyrei/lacrochet/blob/master/backend/routes/chatRoutes.py): `backend/routes/chatRoutes.py`

### External services

- **PayRex**
- **Lalamove riders**
- **Google Gemini**
- **Supabase database**

### Other components

- **Customer**
- **Shop owner**

## Connections

- Customer → Storefront routes: shops (evidence: `README.md`)
- Storefront routes → Product browsing: routes to (evidence: `la-crochet-project/src/Router.jsx`)
- Customer → Cart state: adds items (evidence: `README.md`)
- Cart state → Checkout: checks out (evidence: `la-crochet-project/src/context/CartContext.jsx`)
- Checkout → FastAPI server: sends order (evidence: `README.md`)
- Login context → FastAPI server: authenticates (evidence: `README.md`)
- FastAPI server → Order handling: registers routes (evidence: `backend/main.py`)
- FastAPI server → Product management: registers routes (evidence: `backend/main.py`)
- FastAPI server → Cart endpoints: registers routes (evidence: `backend/main.py`)
- Order handling → Order records: persists orders (evidence: `backend/routes/orderRoutes.py`)
- Order handling → Shop records: uses sessions (evidence: `backend/routes/orderRoutes.py`)
- Identity and roles → Shop records: loads users (evidence: `backend/auth.py`)
- Shop owner → Back office: manages shop (evidence: `README.md`)
- Back office → FastAPI server: uses backend (evidence: `README.md`)
- FastAPI server → Owner operations: registers routes (evidence: `backend/main.py`)
- FastAPI server → Contact inbox: registers routes (evidence: `backend/main.py`)
- FastAPI server → Newsletter signup: registers routes (evidence: `backend/main.py`)
- FastAPI server → Product photos: registers routes (evidence: `backend/main.py`)
- FastAPI server → Yarnie chat: registers routes (evidence: `backend/main.py`)
- Order handling → PayRex: creates payments (evidence: `README.md`)
- Order handling → Lalamove riders: arranges delivery (evidence: `README.md`)
- Owner operations → Lalamove riders: books riders (evidence: `backend/routes/adminRoutes.py`)
- Yarnie chat → Google Gemini: generates replies (evidence: `backend/routes/chatRoutes.py`)
- FastAPI server → Supabase database: stores records (evidence: `README.md`)
