# bharath-appu/babycon architecture

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

- Interactive diagram: https://gitdiagram.com/bharath-appu/babycon
- Repository: https://github.com/bharath-appu/babycon

## Overview

Babycon is a Next.js commerce storefront with a staff administration studio. The customer journey runs from catalog discovery through cart and server-validated checkout to payment confirmation and order status; staff manage catalog, orders, and store operations separately. The graph preserves README-documented capabilities, including accounts, wishlist, SEO, and analytics. Some routes and admin subsystems are unsampled, so their documented links are cited to the README rather than presented as inspected implementation details.

Main entry points: [`app/(store)/checkout/page.tsx`](https://github.com/bharath-appu/babycon/blob/main/app/(store)/checkout/page.tsx) (Checkout form), [`lib/db.ts`](https://github.com/bharath-appu/babycon/blob/main/lib/db.ts) (PostgreSQL data), [`app/(store)`](https://github.com/bharath-appu/babycon/tree/main/app/(store)) (Storefront pages), [`app/api/checkout/route.ts`](https://github.com/bharath-appu/babycon/blob/main/app/api/checkout/route.ts) (Order creation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_store["Storefront pages"]
  node_home["Home experience<br/>[page.tsx]"]
  node_catalog["Catalog queries<br/>[catalog.ts]"]
  node_product["Product browsing<br/>[page.tsx]"]
  node_search["Shop and search<br/>[page.tsx]"]
  node_collections["Collections<br/>[page.tsx]"]
  node_wishlist["Wishlist<br/>[wishlist.tsx]"]
end

subgraph group_commerce["Commerce"]
  node_cart["Cart state<br/>[cart.tsx]"]
  node_cartapi["Cart session API<br/>[route.ts]"]
  node_checkout["Checkout form<br/>[page.tsx]"]
  node_checkoutapi["Order creation<br/>[route.ts]"]
  node_payments["Payment verification<br/>[payments.ts]"]
  node_verify["Payment verify route<br/>[route.ts]"]
  node_webhook["Payment webhook<br/>[route.ts]"]
  node_success["Order status<br/>[page.tsx]"]
end

subgraph group_admin["Admin studio"]
  node_admin["Admin studio"]
  node_adminactions["Admin mutations<br/>[actions.ts]"]
end

subgraph group_platform["Identity and platform"]
  node_database[("PostgreSQL data<br/>[db.ts]")]
  node_account["Customer accounts"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_authapi["Auth handlers<br/>[route.ts]"]
  node_seo["SEO endpoints<br/>[sitemap.ts]"]
end

node_customer(("Customer"))
node_razorpay["Razorpay"]
node_adminuser(("Staff user"))

node_customer -->|"browses"| node_store
node_store -->|"renders"| node_home
node_home -->|"loads catalog"| node_catalog
node_customer -->|"finds products"| node_search
node_customer -->|"browses"| node_collections
node_customer -->|"views details"| node_product
node_customer -->|"saves items"| node_wishlist
node_customer -->|"adds items"| node_cart
node_cart -->|"syncs session"| node_cartapi
node_cartapi -->|"reads and writes"| node_database
node_customer -->|"submits order"| node_checkout
node_checkout -->|"reads items"| node_cart
node_checkout -->|"sends checkout"| node_checkoutapi
node_checkoutapi -->|"validates and creates order"| node_database
node_checkoutapi -->|"creates payment order"| node_razorpay
node_checkout -->|"submits signature"| node_verify
node_verify -.->|"verifies payment"| node_payments
node_webhook -->|"marks paid"| node_payments
node_webhook -->|"looks up order"| node_database
node_razorpay -->|"sends events"| node_webhook
node_checkout -->|"shows status"| node_success
node_customer -->|"manages account"| node_account
node_account -.->|"authenticates"| node_auth
node_authapi -.->|"dispatches handlers"| node_auth
node_adminuser -->|"manages store"| node_admin
node_admin -->|"submits changes"| node_adminactions
node_adminactions -.->|"updates commerce data"| node_database
node_admin -.->|"reads reports and records"| node_database
node_store -->|"publishes sitemap"| node_seo

click node_store "https://github.com/bharath-appu/babycon/tree/main/app/(store)"
click node_home "https://github.com/bharath-appu/babycon/blob/main/app/(store)/page.tsx"
click node_catalog "https://github.com/bharath-appu/babycon/blob/main/lib/catalog.ts"
click node_product "https://github.com/bharath-appu/babycon/blob/main/app/(store)/products/%5Bslug%5D/page.tsx"
click node_search "https://github.com/bharath-appu/babycon/blob/main/app/(store)/shop/page.tsx"
click node_collections "https://github.com/bharath-appu/babycon/blob/main/app/(store)/collections/%5Bslug%5D/page.tsx"
click node_wishlist "https://github.com/bharath-appu/babycon/blob/main/lib/store/wishlist.tsx"
click node_cart "https://github.com/bharath-appu/babycon/blob/main/lib/store/cart.tsx"
click node_cartapi "https://github.com/bharath-appu/babycon/blob/main/app/api/cart/route.ts"
click node_checkout "https://github.com/bharath-appu/babycon/blob/main/app/(store)/checkout/page.tsx"
click node_checkoutapi "https://github.com/bharath-appu/babycon/blob/main/app/api/checkout/route.ts"
click node_payments "https://github.com/bharath-appu/babycon/blob/main/app/api/razorpay/payments.ts"
click node_verify "https://github.com/bharath-appu/babycon/blob/main/app/api/razorpay/verify/route.ts"
click node_webhook "https://github.com/bharath-appu/babycon/blob/main/app/api/razorpay/webhook/route.ts"
click node_success "https://github.com/bharath-appu/babycon/blob/main/app/(store)/checkout/success/page.tsx"
click node_database "https://github.com/bharath-appu/babycon/blob/main/lib/db.ts"
click node_account "https://github.com/bharath-appu/babycon/tree/main/app/(store)/account"
click node_auth "https://github.com/bharath-appu/babycon/blob/main/auth.ts"
click node_authapi "https://github.com/bharath-appu/babycon/blob/main/app/api/auth/%5B...nextauth%5D/route.ts"
click node_admin "https://github.com/bharath-appu/babycon/tree/main/app/admin/(panel)"
click node_adminactions "https://github.com/bharath-appu/babycon/blob/main/app/admin/(panel)/actions.ts"
click node_seo "https://github.com/bharath-appu/babycon/blob/main/app/sitemap.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_store,node_home,node_catalog,node_product,node_search,node_collections,node_wishlist,node_adminuser toneBlue
class node_cart,node_cartapi,node_checkout,node_checkoutapi,node_payments,node_verify,node_webhook,node_success toneAmber
class node_admin,node_adminactions toneMint
class node_database,node_account,node_auth,node_authapi,node_seo toneRose
class node_customer,node_razorpay toneIndigo
```

## Components

### Storefront

- [Storefront pages](https://github.com/bharath-appu/babycon/tree/main/app/(store)): `app/(store)`
- [Home experience](https://github.com/bharath-appu/babycon/blob/main/app/(store)/page.tsx): `app/(store)/page.tsx`
- [Catalog queries](https://github.com/bharath-appu/babycon/blob/main/lib/catalog.ts): `lib/catalog.ts`
- [Product browsing](https://github.com/bharath-appu/babycon/blob/main/app/(store)/products/%5Bslug%5D/page.tsx): `app/(store)/products/[slug]/page.tsx`
- [Shop and search](https://github.com/bharath-appu/babycon/blob/main/app/(store)/shop/page.tsx): `app/(store)/shop/page.tsx`
- [Collections](https://github.com/bharath-appu/babycon/blob/main/app/(store)/collections/%5Bslug%5D/page.tsx): `app/(store)/collections/[slug]/page.tsx`
- [Wishlist](https://github.com/bharath-appu/babycon/blob/main/lib/store/wishlist.tsx): `lib/store/wishlist.tsx`

### Commerce

- [Cart state](https://github.com/bharath-appu/babycon/blob/main/lib/store/cart.tsx): `lib/store/cart.tsx`
- [Cart session API](https://github.com/bharath-appu/babycon/blob/main/app/api/cart/route.ts): `app/api/cart/route.ts`
- [Checkout form](https://github.com/bharath-appu/babycon/blob/main/app/(store)/checkout/page.tsx): `app/(store)/checkout/page.tsx`
- [Order creation](https://github.com/bharath-appu/babycon/blob/main/app/api/checkout/route.ts): `app/api/checkout/route.ts`
- [Payment verification](https://github.com/bharath-appu/babycon/blob/main/app/api/razorpay/payments.ts): `app/api/razorpay/payments.ts`
- [Payment verify route](https://github.com/bharath-appu/babycon/blob/main/app/api/razorpay/verify/route.ts): `app/api/razorpay/verify/route.ts`
- [Payment webhook](https://github.com/bharath-appu/babycon/blob/main/app/api/razorpay/webhook/route.ts): `app/api/razorpay/webhook/route.ts`
- [Order status](https://github.com/bharath-appu/babycon/blob/main/app/(store)/checkout/success/page.tsx): `app/(store)/checkout/success/page.tsx`

### Admin studio

- [Admin studio](https://github.com/bharath-appu/babycon/tree/main/app/admin/(panel)): `app/admin/(panel)`
- [Admin mutations](https://github.com/bharath-appu/babycon/blob/main/app/admin/(panel)/actions.ts): `app/admin/(panel)/actions.ts`

### Identity and platform

- [PostgreSQL data](https://github.com/bharath-appu/babycon/blob/main/lib/db.ts): `lib/db.ts`
- [Customer accounts](https://github.com/bharath-appu/babycon/tree/main/app/(store)/account): `app/(store)/account`
- [Authentication](https://github.com/bharath-appu/babycon/blob/main/auth.ts): `auth.ts`
- [Auth handlers](https://github.com/bharath-appu/babycon/blob/main/app/api/auth/%5B...nextauth%5D/route.ts): `app/api/auth/[...nextauth]/route.ts`
- [SEO endpoints](https://github.com/bharath-appu/babycon/blob/main/app/sitemap.ts): `app/sitemap.ts`

### Other components

- **Customer**
- **Razorpay**
- **Staff user**

## Connections

- Customer → Storefront pages: browses
- Storefront pages → Home experience: renders (evidence: `app/(store)/page.tsx`)
- Home experience → Catalog queries: loads catalog (evidence: `app/(store)/page.tsx`)
- Customer → Shop and search: finds products
- Customer → Collections: browses
- Customer → Product browsing: views details
- Customer → Wishlist: saves items
- Customer → Cart state: adds items
- Cart state → Cart session API: syncs session
- Cart session API → PostgreSQL data: reads and writes
- Customer → Checkout form: submits order
- Checkout form → Cart state: reads items (evidence: `app/(store)/checkout/page.tsx`)
- Checkout form → Order creation: sends checkout (evidence: `app/(store)/checkout/page.tsx`)
- Order creation → PostgreSQL data: validates and creates order (evidence: `app/api/checkout/route.ts`)
- Order creation → Razorpay: creates payment order (evidence: `app/api/checkout/route.ts`)
- Checkout form → Payment verify route: submits signature (evidence: `app/(store)/checkout/page.tsx`)
- Payment verify route → Payment verification: verifies payment
- Payment webhook → Payment verification: marks paid (evidence: `app/api/razorpay/webhook/route.ts`)
- Payment webhook → PostgreSQL data: looks up order (evidence: `app/api/razorpay/webhook/route.ts`)
- Razorpay → Payment webhook: sends events
- Checkout form → Order status: shows status
- Customer → Customer accounts: manages account
- Customer accounts → Authentication: authenticates
- Auth handlers → Authentication: dispatches handlers
- Staff user → Admin studio: manages store
- Admin studio → Admin mutations: submits changes (evidence: `app/admin/(panel)/products/page.tsx`)
- Admin mutations → PostgreSQL data: updates commerce data
- Admin studio → PostgreSQL data: reads reports and records (evidence: `app/admin/(panel)/products/page.tsx`)
- Storefront pages → SEO endpoints: publishes sitemap
