# christianjjc/teslo-shop architecture

> Architecture diagram of the GitHub repository christianjjc/teslo-shop, 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/christianjjc/teslo-shop
- Repository: https://github.com/christianjjc/teslo-shop

## Overview

This is a Next.js storefront for browsing apparel, managing a cart, checking out, paying for orders, and administering products, orders, and users. The main customer flow starts at the product catalog, continues through cart and address/checkout, and ends with an order and payment; the excerpts directly verify only selected parts of that flow. The graph retains the tree’s major domain areas, including authentication, admin, and seeded catalog data. Edges are limited to shown imports/calls or documented setup; unsampled links are omitted rather than inferred.

Main entry points: [`src/app/(shop)/page.tsx`](https://github.com/christianjjc/teslo-shop/blob/master/src/app/(shop)/page.tsx) (Product catalog), [`src/actions/order`](https://github.com/christianjjc/teslo-shop/tree/master/src/actions/order) (Order actions), [`src/app/(shop)/orders`](https://github.com/christianjjc/teslo-shop/tree/master/src/app/(shop)/orders) (Order pages), [`src/app/(shop)/admin`](https://github.com/christianjjc/teslo-shop/tree/master/src/app/(shop)/admin) (Admin pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_catalog_page["Product catalog<br/>[page.tsx]"]
  node_product_page["Product detail<br/>[page.tsx]"]
  node_product_actions["Catalog actions"]
  node_product_views["Product components"]
end

subgraph group_checkout["Checkout &amp; orders"]
  node_cart_page["Cart<br/>[page.tsx]"]
  node_cart_state["Cart state<br/>[cart-store.ts]"]
  node_checkout_pages["Checkout &amp; address"]
  node_order_actions["Order actions"]
  node_order_views["Order pages"]
  node_payments["Payment actions"]
  node_paypal["PayPal button<br/>[PaypalButton.tsx]"]
end

subgraph group_admin["Administration"]
  node_admin_pages["Admin pages"]
  node_admin_actions["Admin actions"]
  node_product_admin["Product management"]
end

subgraph group_platform["Shared services"]
  node_auth["Authentication<br/>[auth.config.ts]"]
  node_auth_pages["Sign-in pages"]
  node_database[("Prisma database<br/>[prisma.ts]")]
  node_seed["Sample catalog data<br/>[seed-database.ts]"]
end

node_customer(("Shopper"))

node_customer -->|"browses"| node_catalog_page
node_catalog_page -->|"loads products"| node_product_actions
node_catalog_page -->|"renders grid"| node_product_views
node_product_page -->|"loads product"| node_product_actions
node_customer -->|"reviews cart"| node_cart_page
node_cart_page -.->|"offers checkout"| node_checkout_pages
node_customer -->|"views orders"| node_order_views
node_order_views -->|"loads order"| node_order_actions
node_order_views -->|"renders payment"| node_paypal
node_paypal -->|"checks payment"| node_payments
node_customer -.->|"signs in"| node_auth_pages
node_auth_pages -.->|"uses auth"| node_auth
node_auth -->|"looks up user"| node_database
node_order_actions -->|"checks session"| node_auth
node_order_actions -->|"creates order"| node_database
node_customer -.->|"administers store"| node_admin_pages
node_admin_pages -.->|"manages users"| node_admin_actions
node_admin_pages -->|"manages products"| node_product_admin
node_seed -->|"seeds records"| node_database

click node_catalog_page "https://github.com/christianjjc/teslo-shop/blob/master/src/app/(shop)/page.tsx"
click node_product_page "https://github.com/christianjjc/teslo-shop/blob/master/src/app/(shop)/product/%5Bslug%5D/page.tsx"
click node_product_actions "https://github.com/christianjjc/teslo-shop/tree/master/src/actions/products"
click node_product_views "https://github.com/christianjjc/teslo-shop/tree/master/src/components/products/product-grid"
click node_cart_page "https://github.com/christianjjc/teslo-shop/blob/master/src/app/(shop)/cart/page.tsx"
click node_cart_state "https://github.com/christianjjc/teslo-shop/blob/master/src/store/cart/cart-store.ts"
click node_checkout_pages "https://github.com/christianjjc/teslo-shop/tree/master/src/app/(shop)/checkout"
click node_order_actions "https://github.com/christianjjc/teslo-shop/tree/master/src/actions/order"
click node_order_views "https://github.com/christianjjc/teslo-shop/tree/master/src/app/(shop)/orders"
click node_payments "https://github.com/christianjjc/teslo-shop/tree/master/src/actions/payments"
click node_paypal "https://github.com/christianjjc/teslo-shop/blob/master/src/components/paypal/PaypalButton.tsx"
click node_admin_pages "https://github.com/christianjjc/teslo-shop/tree/master/src/app/(shop)/admin"
click node_admin_actions "https://github.com/christianjjc/teslo-shop/tree/master/src/actions/users"
click node_product_admin "https://github.com/christianjjc/teslo-shop/blob/master/src/actions/products/create-update-product.ts"
click node_auth "https://github.com/christianjjc/teslo-shop/blob/master/src/auth.config.ts"
click node_auth_pages "https://github.com/christianjjc/teslo-shop/tree/master/src/app/auth"
click node_database "https://github.com/christianjjc/teslo-shop/blob/master/src/lib/prisma.ts"
click node_seed "https://github.com/christianjjc/teslo-shop/blob/master/src/seed/seed-database.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_catalog_page,node_product_page,node_product_actions,node_product_views toneBlue
class node_cart_page,node_cart_state,node_checkout_pages,node_order_actions,node_order_views,node_payments,node_paypal toneAmber
class node_admin_pages,node_admin_actions,node_product_admin toneMint
class node_auth,node_auth_pages,node_database,node_seed toneRose
class node_customer toneIndigo
```

## Components

### Storefront

- [Product catalog](https://github.com/christianjjc/teslo-shop/blob/master/src/app/(shop)/page.tsx): `src/app/(shop)/page.tsx`
- [Product detail](https://github.com/christianjjc/teslo-shop/blob/master/src/app/(shop)/product/%5Bslug%5D/page.tsx): `src/app/(shop)/product/[slug]/page.tsx`
- [Catalog actions](https://github.com/christianjjc/teslo-shop/tree/master/src/actions/products): `src/actions/products`
- [Product components](https://github.com/christianjjc/teslo-shop/tree/master/src/components/products/product-grid): `src/components/products/product-grid`

### Checkout & orders

- [Cart](https://github.com/christianjjc/teslo-shop/blob/master/src/app/(shop)/cart/page.tsx): `src/app/(shop)/cart/page.tsx`
- [Cart state](https://github.com/christianjjc/teslo-shop/blob/master/src/store/cart/cart-store.ts): `src/store/cart/cart-store.ts`
- [Checkout & address](https://github.com/christianjjc/teslo-shop/tree/master/src/app/(shop)/checkout): `src/app/(shop)/checkout`
- [Order actions](https://github.com/christianjjc/teslo-shop/tree/master/src/actions/order): `src/actions/order`
- [Order pages](https://github.com/christianjjc/teslo-shop/tree/master/src/app/(shop)/orders): `src/app/(shop)/orders`
- [Payment actions](https://github.com/christianjjc/teslo-shop/tree/master/src/actions/payments): `src/actions/payments`
- [PayPal button](https://github.com/christianjjc/teslo-shop/blob/master/src/components/paypal/PaypalButton.tsx): `src/components/paypal/PaypalButton.tsx`

### Administration

- [Admin pages](https://github.com/christianjjc/teslo-shop/tree/master/src/app/(shop)/admin): `src/app/(shop)/admin`
- [Admin actions](https://github.com/christianjjc/teslo-shop/tree/master/src/actions/users): `src/actions/users`
- [Product management](https://github.com/christianjjc/teslo-shop/blob/master/src/actions/products/create-update-product.ts): `src/actions/products/create-update-product.ts`

### Shared services

- [Authentication](https://github.com/christianjjc/teslo-shop/blob/master/src/auth.config.ts): `src/auth.config.ts`
- [Sign-in pages](https://github.com/christianjjc/teslo-shop/tree/master/src/app/auth): `src/app/auth`
- [Prisma database](https://github.com/christianjjc/teslo-shop/blob/master/src/lib/prisma.ts): `src/lib/prisma.ts`
- [Sample catalog data](https://github.com/christianjjc/teslo-shop/blob/master/src/seed/seed-database.ts): `src/seed/seed-database.ts`

### Other components

- **Shopper**

## Connections

- Shopper → Product catalog: browses (evidence: `src/app/(shop)/page.tsx`)
- Product catalog → Catalog actions: loads products (evidence: `src/app/(shop)/page.tsx`)
- Product catalog → Product components: renders grid (evidence: `src/app/(shop)/page.tsx`)
- Product detail → Catalog actions: loads product (evidence: `src/app/(shop)/product/[slug]/page.tsx`)
- Shopper → Cart: reviews cart (evidence: `src/app/(shop)/cart/page.tsx`)
- Cart → Checkout & address: offers checkout
- Shopper → Order pages: views orders (evidence: `src/app/(shop)/orders/[id]/page.tsx`)
- Order pages → Order actions: loads order (evidence: `src/app/(shop)/orders/[id]/page.tsx`)
- Order pages → PayPal button: renders payment (evidence: `src/app/(shop)/orders/[id]/page.tsx`)
- PayPal button → Payment actions: checks payment (evidence: `src/components/paypal/PaypalButton.tsx`)
- Shopper → Sign-in pages: signs in
- Sign-in pages → Authentication: uses auth
- Authentication → Prisma database: looks up user (evidence: `src/auth.config.ts`)
- Order actions → Authentication: checks session (evidence: `src/actions/order/place-order.ts`)
- Order actions → Prisma database: creates order (evidence: `src/actions/order/place-order.ts`)
- Shopper → Admin pages: administers store
- Admin pages → Admin actions: manages users
- Admin pages → Product management: manages products (evidence: `src/app/(shop)/admin/products/page.tsx`)
- Sample catalog data → Prisma database: seeds records (evidence: `src/seed/seed-database.ts`)
