# cnek00/4project architecture

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

- Interactive diagram: https://gitdiagram.com/cnek00/4project
- Repository: https://github.com/cnek00/4project

## Overview

3D Store is a React storefront backed by a Django REST API. Shoppers browse and inspect products—including GLB previews—then authenticate, manage a stock-validated cart, apply coupons, check out, and view orders. The README documents concurrency-safe checkout and JWT/Google OAuth; frontend page-to-service relationships and backend view-to-model/serializer relationships are also visible in the source index. Backend implementation details beyond the supplied excerpts are represented at their existing source paths, so finer internal control flow is not inferred.

Main entry points: [`3D Web Project/frontend/src/components/AppRoutes.jsx`](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/components/AppRoutes.jsx) (Page routes), [`3D Web Project/frontend/src/services/api.js`](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/services/api.js) (API client), [`3D Web Project/backend/store/views.py`](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/backend/store/views.py) (Store API), [`3D Web Project/frontend/src/context/AuthContext.jsx`](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/context/AuthContext.jsx) (Auth state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_app["App shell<br/>[App.jsx]"]
  node_routes["Page routes<br/>[AppRoutes.jsx]"]
  node_catalogue["Catalogue<br/>[Home.jsx]"]
  node_product["Product detail<br/>[ProductDetail.jsx]"]
  node_product_card["Product card<br/>[ProductCard.jsx]"]
  node_cart_page["Cart &amp; checkout<br/>[Cart.jsx]"]
  node_orders_page["Orders<br/>[Orders.jsx]"]
  node_about_page["About page<br/>[About.jsx]"]
end

subgraph group_identity["Identity &amp; UI"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
  node_auth_pages["Login &amp; register<br/>[Login.jsx]"]
  node_auth_context["Auth state<br/>[AuthContext.jsx]"]
  node_oauth_callback["OAuth callback<br/>[AuthCallback.jsx]"]
  node_theme["Theme state<br/>[ThemeContext.jsx]"]
end

subgraph group_commerce["Commerce API"]
  node_api_client["API client<br/>[api.js]"]
  node_store_api["Store API<br/>[views.py]"]
  node_serializers["API serializers<br/>[serializers.py]"]
  node_auth_api["Auth endpoints<br/>[urls.py]"]
end

subgraph group_persistence["Persistence"]
  node_user_model["User account<br/>[models.py]"]
  node_store_models["Commerce records<br/>[models.py]"]
  node_database[("PostgreSQL")]
end

node_shopper(("Shopper"))
node_google["Google OAuth"]

node_shopper -->|"browses"| node_routes
node_app -->|"renders"| node_routes
node_routes -->|"routes to"| node_catalogue
node_routes -->|"routes to"| node_product
node_routes -->|"routes to"| node_cart_page
node_routes -->|"routes to"| node_orders_page
node_routes -->|"routes to"| node_auth_pages
node_routes -->|"routes to"| node_about_page
node_catalogue -->|"fetches products"| node_api_client
node_catalogue -->|"renders"| node_product_card
node_product -->|"fetches &amp; adds"| node_api_client
node_cart_page -->|"manages cart"| node_api_client
node_orders_page -->|"fetches orders"| node_api_client
node_auth_pages -->|"uses auth"| node_auth_context
node_auth_context -->|"auth requests"| node_api_client
node_oauth_callback -->|"sets tokens"| node_auth_context
node_navbar -->|"reads auth"| node_auth_context
node_navbar -->|"toggles theme"| node_theme
node_api_client -->|"REST / JSON"| node_store_api
node_api_client -->|"requests auth"| node_auth_api
node_store_api -->|"uses serializers"| node_serializers
node_store_api -->|"queries records"| node_store_models
node_store_api -->|"ORM; locked checkout"| node_database
node_auth_api -.->|"authenticates users"| node_user_model
node_google -->|"returns JWT"| node_oauth_callback
node_auth_api -.->|"OAuth integration"| node_google

click node_app "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/App.jsx"
click node_routes "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/components/AppRoutes.jsx"
click node_catalogue "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/pages/Home.jsx"
click node_product "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/pages/ProductDetail.jsx"
click node_product_card "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/components/ProductCard.jsx"
click node_cart_page "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/pages/Cart.jsx"
click node_orders_page "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/pages/Orders.jsx"
click node_about_page "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/pages/About.jsx"
click node_navbar "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/components/Navbar.jsx"
click node_auth_pages "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/pages/Login.jsx"
click node_auth_context "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/context/AuthContext.jsx"
click node_oauth_callback "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/pages/AuthCallback.jsx"
click node_theme "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/context/ThemeContext.jsx"
click node_api_client "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/services/api.js"
click node_store_api "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/backend/store/views.py"
click node_serializers "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/backend/store/serializers.py"
click node_auth_api "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/backend/core/urls.py"
click node_user_model "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/backend/users/models.py"
click node_store_models "https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/backend/store/models.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_app,node_routes,node_catalogue,node_product,node_product_card,node_cart_page,node_orders_page,node_about_page toneBlue
class node_navbar,node_auth_pages,node_auth_context,node_oauth_callback,node_theme toneAmber
class node_api_client,node_store_api,node_serializers,node_auth_api toneMint
class node_user_model,node_store_models,node_database toneRose
class node_shopper,node_google toneIndigo
```

## Components

### Storefront

- [App shell](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/App.jsx): `3D Web Project/frontend/src/App.jsx`
- [Page routes](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/components/AppRoutes.jsx): `3D Web Project/frontend/src/components/AppRoutes.jsx`
- [Catalogue](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/pages/Home.jsx): `3D Web Project/frontend/src/pages/Home.jsx`
- [Product detail](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/pages/ProductDetail.jsx): `3D Web Project/frontend/src/pages/ProductDetail.jsx`
- [Product card](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/components/ProductCard.jsx): `3D Web Project/frontend/src/components/ProductCard.jsx`
- [Cart & checkout](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/pages/Cart.jsx): `3D Web Project/frontend/src/pages/Cart.jsx`
- [Orders](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/pages/Orders.jsx): `3D Web Project/frontend/src/pages/Orders.jsx`
- [About page](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/pages/About.jsx): `3D Web Project/frontend/src/pages/About.jsx`

### Identity & UI

- [Navigation](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/components/Navbar.jsx): `3D Web Project/frontend/src/components/Navbar.jsx`
- [Login & register](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/pages/Login.jsx): `3D Web Project/frontend/src/pages/Login.jsx`
- [Auth state](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/context/AuthContext.jsx): `3D Web Project/frontend/src/context/AuthContext.jsx`
- [OAuth callback](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/pages/AuthCallback.jsx): `3D Web Project/frontend/src/pages/AuthCallback.jsx`
- [Theme state](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/context/ThemeContext.jsx): `3D Web Project/frontend/src/context/ThemeContext.jsx`

### Commerce API

- [API client](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/frontend/src/services/api.js): `3D Web Project/frontend/src/services/api.js`
- [Store API](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/backend/store/views.py): `3D Web Project/backend/store/views.py`
- [API serializers](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/backend/store/serializers.py): `3D Web Project/backend/store/serializers.py`
- [Auth endpoints](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/backend/core/urls.py): `3D Web Project/backend/core/urls.py`

### Persistence

- [User account](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/backend/users/models.py): `3D Web Project/backend/users/models.py`
- [Commerce records](https://github.com/cnek00/4project/blob/main/3D%20Web%20Project/backend/store/models.py): `3D Web Project/backend/store/models.py`
- **PostgreSQL**

### Other components

- **Shopper**
- **Google OAuth**

## Connections

- Shopper → Page routes: browses
- App shell → Page routes: renders (evidence: `3D Web Project/frontend/src/App.jsx`)
- Page routes → Catalogue: routes to (evidence: `3D Web Project/frontend/src/components/AppRoutes.jsx`)
- Page routes → Product detail: routes to (evidence: `3D Web Project/frontend/src/components/AppRoutes.jsx`)
- Page routes → Cart & checkout: routes to (evidence: `3D Web Project/frontend/src/components/AppRoutes.jsx`)
- Page routes → Orders: routes to (evidence: `3D Web Project/frontend/src/components/AppRoutes.jsx`)
- Page routes → Login & register: routes to (evidence: `3D Web Project/frontend/src/components/AppRoutes.jsx`)
- Page routes → About page: routes to (evidence: `3D Web Project/frontend/src/components/AppRoutes.jsx`)
- Catalogue → API client: fetches products (evidence: `3D Web Project/frontend/src/pages/Home.jsx`)
- Catalogue → Product card: renders (evidence: `3D Web Project/frontend/src/pages/Home.jsx`)
- Product detail → API client: fetches & adds (evidence: `3D Web Project/frontend/src/pages/ProductDetail.jsx`)
- Cart & checkout → API client: manages cart (evidence: `3D Web Project/frontend/src/pages/Cart.jsx`)
- Orders → API client: fetches orders (evidence: `3D Web Project/frontend/src/pages/Orders.jsx`)
- Login & register → Auth state: uses auth (evidence: `3D Web Project/frontend/src/pages/Login.jsx`)
- Auth state → API client: auth requests (evidence: `3D Web Project/frontend/src/context/AuthContext.jsx`)
- OAuth callback → Auth state: sets tokens (evidence: `3D Web Project/frontend/src/pages/AuthCallback.jsx`)
- Navigation → Auth state: reads auth (evidence: `3D Web Project/frontend/src/components/Navbar.jsx`)
- Navigation → Theme state: toggles theme (evidence: `3D Web Project/frontend/src/components/Navbar.jsx`)
- API client → Store API: REST / JSON
- API client → Auth endpoints: requests auth (evidence: `3D Web Project/frontend/src/services/api.js`)
- Store API → API serializers: uses serializers (evidence: `3D Web Project/backend/store/views.py`)
- Store API → Commerce records: queries records (evidence: `3D Web Project/backend/store/views.py`)
- Store API → PostgreSQL: ORM; locked checkout
- Auth endpoints → User account: authenticates users
- Google OAuth → OAuth callback: returns JWT
- Auth endpoints → Google OAuth: OAuth integration
