# dharanidh75/croonfit architecture

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

- Interactive diagram: https://gitdiagram.com/dharanidh75/croonfit
- Repository: https://github.com/dharanidh75/croonfit

## Overview

#### Purpose and Top-Level Entry Points
Croonfit is a full-stack apparel-commerce application with a customer storefront, checkout/order flows, wishlist, and a separate admin interface. The frontend boots through `croonfit_web/frontend/src/main.jsx` and composes routes/application state in `croonfit_web/frontend/src/App.jsx`. The backend API application is entered at `croonfit_web/backend/app/main.py`.

#### Storefront Presentation and Navigation
The customer-facing SPA organizes commerce and marketing pages—home, listings/categories, product detail, cart, checkout, account, orders, and wishlist—under `croonfit_web/frontend/src/pages`. Reusable product presentation and selection behavior sit behind page boundaries in `croonfit_web/frontend/src/components/product/ProductCard.jsx`, `croonfit_web/frontend/src/components/product/ProductGallery.jsx`, and `croonfit_web/frontend/src/components/product/SizeSelector.jsx`. Catalogue imagery is served from `croonfit_web/frontend/public/images/catalogue`.

#### Frontend State and API Boundary
The frontend’s API integration is centralized in `croonfit_web/frontend/src/lib/api.js`; this is the primary boundary between browser UI/state and backend HTTP endpoints. Client-side shared state is rooted at `croonfit_web/frontend/src/store/index.js`. Checkout-specific UI collects customer/payment inputs and constructs order context through `croonfit_web/frontend/src/components/checkout/CheckoutForm.jsx` and `croonfit_web/frontend/src/components/checkout/PaymentForm.jsx`.

#### Backend API and Domain Services
The Python backend exposes domain-oriented API modules for authentication, catalog, orders, payments, wishlist, and administration: `croonfit_web/backend/app/api/auth.py`, `croonfit_web/backend/app/api/products.py`, and `croonfit_web/backend/app/api/orders.py`. `croonfit_web/backend/app/config.py` holds application configuration, while `croonfit_web/backend/app/core/security.py` and `croonfit_web/backend/app/core/admin_auth.py` establish customer/admin security boundaries. A payments endpoint exists at `croonfit_web/backend/app/api/payments.py`; no specific payment provider is identifiable from the tree.

#### Persistence and Business Data
Persistent business entities are modeled separately for users, products, orders, wishlists, and admins, including `croonfit_web/backend/app/models/user.py`, `croonfit_web/backend/app/models/product.py`, and `croonfit_web/backend/app/models/order.py`. The database access boundary is `croonfit_web/backend/app/database.py`; the committed `croonfit_web/backend/croonfit.db` indicates SQLite is the current material datastore. API payload contracts are represented in schema modules such as `croonfit_web/backend/app/schemas/product.py` and `croonfit_web/backend/app/schemas/order.py`. `croonfit_web/backend/seed.py` is the apparent catalog/data bootstrap path.

#### Administrative Surface
Administration is a distinct frontend area with protected routing/layout and operational pages for dashboard, products, orders, inventory, customers, billing, analytics, CMS, and discounts. Its primary shell and authorization gate are `croonfit_web/frontend/src/components/admin/AdminLayout.jsx` and `croonfit_web/frontend/src/components/admin/AdminProtectedRoute.jsx`; product management flows are under `croonfit_web/frontend/src/pages/admin/AdminProducts.jsx` and `croonfit_web/frontend/src/pages/admin/products/ProductForm.jsx`. This surface depends on the backend’s separate admin authentication and admin API boundary.

#### Runtime and Asset Pipeline
The browser application is a Vite-based React frontend, evidenced by `croonfit_web/frontend/package.json` and `croonfit_web/frontend/vite.config.js`. The backend is Python with dependencies declared in `croonfit_web/backend/requirements.txt`. An input apparel catalogue PDF, `Croon.fit - Blank Apparel Catalogue Oct 25.pdf`, plus `croonfit_web/frontend/extract_images.py`, suggests a local asset-extraction workflow that populates storefront catalogue images rather than an external product-information service.

Main entry points: [`croonfit_web/frontend/src/pages`](https://github.com/dharanidh75/croonfit/tree/main/croonfit_web/frontend/src/pages) (Commerce pages), [`croonfit_web/frontend/src/App.jsx`](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/App.jsx) (App routes and state composition), [`croonfit_web/frontend/src/lib/api.js`](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/lib/api.js) (Frontend API client), [`croonfit_web/backend/app/main.py`](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/app/main.py) (API application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer storefront"]
  node_frontend_boot["React bootstrap<br/>Vite entry<br/>[main.jsx]"]
  node_app_shell["App routes and state composition<br/>React application<br/>[App.jsx]"]
  node_storefront_pages["Commerce pages<br/>page set"]
  node_product_components["Product presentation<br/>React components<br/>[ProductCard.jsx]"]
  node_checkout_forms["Checkout and payment forms<br/>React components<br/>[CheckoutForm.jsx]"]
  node_client_store["Client shared state<br/>state store<br/>[index.js]"]
  node_api_client{{"Frontend API client<br/>HTTP boundary<br/>[api.js]"}}
end

subgraph group_admin["Admin surface"]
  node_admin_shell["Admin protected shell<br/>React layout and guard<br/>[AdminLayout.jsx]"]
  node_admin_products["Admin product management<br/>admin pages<br/>[AdminProducts.jsx]"]
end

subgraph group_backend["Backend API"]
  node_backend_app["API application<br/>Python API entry<br/>[main.py]"]
  node_commerce_apis["Customer commerce APIs<br/>API modules<br/>[products.py]"]
  node_admin_api_security{{"Admin API security<br/>authorization boundary<br/>[admin_auth.py]"}}
  node_domain_models["Commerce domain models<br/>ORM models<br/>[product.py]"]
  node_api_schemas["API payload schemas<br/>contract models<br/>[product.py]"]
end

subgraph group_data["Data and assets"]
  node_database_access{{"Database access<br/>persistence boundary<br/>[database.py]"}}
  node_sqlite_database[("Croonfit SQLite database<br/>SQLite datastore<br/>[croonfit.db]")]
  node_catalogue_images["Catalogue images<br/>static assets"]
  node_asset_extraction["Catalogue asset extraction<br/>local Python workflow<br/>[extract_images.py]"]
  node_seed_data["Catalog data bootstrap<br/>seed script<br/>[seed.py]"]
end

node_frontend_boot -->|"mounts"| node_app_shell
node_app_shell -->|"routes to"| node_storefront_pages
node_app_shell -->|"uses"| node_client_store
node_storefront_pages -->|"renders"| node_product_components
node_storefront_pages -->|"uses"| node_checkout_forms
node_storefront_pages -->|"loads and mutates data"| node_api_client
node_checkout_forms -->|"submits orders and payments"| node_api_client
node_api_client -->|"HTTP requests"| node_backend_app
node_app_shell -->|"hosts admin routes"| node_admin_shell
node_admin_shell -->|"protects"| node_admin_products
node_admin_products -->|"manages via"| node_api_client
node_backend_app -->|"serves"| node_commerce_apis
node_backend_app -->|"enforces admin access"| node_admin_api_security
node_commerce_apis -->|"validates payloads"| node_api_schemas
node_commerce_apis -->|"operates on"| node_domain_models
node_admin_api_security -->|"authorizes administration"| node_domain_models
node_domain_models -->|"persists through"| node_database_access
node_database_access -->|"reads and writes"| node_sqlite_database
node_seed_data -->|"initializes"| node_database_access
node_asset_extraction -->|"populates"| node_catalogue_images
node_storefront_pages -->|"serves product imagery"| node_catalogue_images

click node_frontend_boot "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/main.jsx"
click node_app_shell "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/App.jsx"
click node_storefront_pages "https://github.com/dharanidh75/croonfit/tree/main/croonfit_web/frontend/src/pages"
click node_product_components "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/components/product/ProductCard.jsx"
click node_checkout_forms "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/components/checkout/CheckoutForm.jsx"
click node_client_store "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/store/index.js"
click node_api_client "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/lib/api.js"
click node_admin_shell "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/components/admin/AdminLayout.jsx"
click node_admin_products "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/pages/admin/AdminProducts.jsx"
click node_backend_app "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/app/main.py"
click node_commerce_apis "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/app/api/products.py"
click node_admin_api_security "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/app/core/admin_auth.py"
click node_domain_models "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/app/models/product.py"
click node_api_schemas "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/app/schemas/product.py"
click node_database_access "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/app/database.py"
click node_sqlite_database "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/croonfit.db"
click node_catalogue_images "https://github.com/dharanidh75/croonfit/tree/main/croonfit_web/frontend/public/images/catalogue"
click node_asset_extraction "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/extract_images.py"
click node_seed_data "https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/seed.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_frontend_boot,node_app_shell,node_storefront_pages,node_product_components,node_checkout_forms,node_client_store,node_api_client toneBlue
class node_admin_shell,node_admin_products toneAmber
class node_backend_app,node_commerce_apis,node_admin_api_security,node_domain_models,node_api_schemas toneMint
class node_database_access,node_sqlite_database,node_catalogue_images,node_asset_extraction,node_seed_data toneRose
```

## Components

### Customer storefront

- [React bootstrap](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/main.jsx): Vite entry · `croonfit_web/frontend/src/main.jsx`
- [App routes and state composition](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/App.jsx): React application · `croonfit_web/frontend/src/App.jsx`
- [Commerce pages](https://github.com/dharanidh75/croonfit/tree/main/croonfit_web/frontend/src/pages): page set · Home, catalogue, product, cart, checkout, account, orders, and wishlist. · `croonfit_web/frontend/src/pages`
- [Product presentation](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/components/product/ProductCard.jsx): React components · `croonfit_web/frontend/src/components/product/ProductCard.jsx`
- [Checkout and payment forms](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/components/checkout/CheckoutForm.jsx): React components · `croonfit_web/frontend/src/components/checkout/CheckoutForm.jsx`
- [Client shared state](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/store/index.js): state store · `croonfit_web/frontend/src/store/index.js`
- [Frontend API client](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/lib/api.js): HTTP boundary · `croonfit_web/frontend/src/lib/api.js`

### Admin surface

- [Admin protected shell](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/components/admin/AdminLayout.jsx): React layout and guard · `croonfit_web/frontend/src/components/admin/AdminLayout.jsx`
- [Admin product management](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/src/pages/admin/AdminProducts.jsx): admin pages · `croonfit_web/frontend/src/pages/admin/AdminProducts.jsx`

### Backend API

- [API application](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/app/main.py): Python API entry · `croonfit_web/backend/app/main.py`
- [Customer commerce APIs](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/app/api/products.py): API modules · Authentication, products, orders, payments, and wishlist endpoints. · `croonfit_web/backend/app/api/products.py`
- [Admin API security](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/app/core/admin_auth.py): authorization boundary · Separates administrator access from customer authentication. · `croonfit_web/backend/app/core/admin_auth.py`
- [Commerce domain models](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/app/models/product.py): ORM models · Users, products, orders, wishlists, and admins. · `croonfit_web/backend/app/models/product.py`
- [API payload schemas](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/app/schemas/product.py): contract models · `croonfit_web/backend/app/schemas/product.py`

### Data and assets

- [Database access](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/app/database.py): persistence boundary · `croonfit_web/backend/app/database.py`
- [Croonfit SQLite database](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/croonfit.db): SQLite datastore · `croonfit_web/backend/croonfit.db`
- [Catalogue images](https://github.com/dharanidh75/croonfit/tree/main/croonfit_web/frontend/public/images/catalogue): static assets · `croonfit_web/frontend/public/images/catalogue`
- [Catalogue asset extraction](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/frontend/extract_images.py): local Python workflow · Extracts imagery from the supplied apparel catalogue PDF. · `croonfit_web/frontend/extract_images.py`
- [Catalog data bootstrap](https://github.com/dharanidh75/croonfit/blob/main/croonfit_web/backend/seed.py): seed script · `croonfit_web/backend/seed.py`

## Connections

- React bootstrap → App routes and state composition: mounts
- App routes and state composition → Commerce pages: routes to
- App routes and state composition → Client shared state: uses
- Commerce pages → Product presentation: renders
- Commerce pages → Checkout and payment forms: uses
- Commerce pages → Frontend API client: loads and mutates data
- Checkout and payment forms → Frontend API client: submits orders and payments
- Frontend API client → API application: HTTP requests
- App routes and state composition → Admin protected shell: hosts admin routes
- Admin protected shell → Admin product management: protects
- Admin product management → Frontend API client: manages via
- API application → Customer commerce APIs: serves
- API application → Admin API security: enforces admin access
- Customer commerce APIs → API payload schemas: validates payloads
- Customer commerce APIs → Commerce domain models: operates on
- Admin API security → Commerce domain models: authorizes administration
- Commerce domain models → Database access: persists through
- Database access → Croonfit SQLite database: reads and writes
- Catalog data bootstrap → Database access: initializes
- Catalogue asset extraction → Catalogue images: populates
- Commerce pages → Catalogue images: serves product imagery
