# ceuw/groza architecture

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

- Interactive diagram: https://gitdiagram.com/ceuw/groza
- Repository: https://github.com/ceuw/groza

## Overview

Groza is a Next.js/PostgreSQL e-commerce platform. Shoppers discover products, build a persistent cart, submit checkout, and view orders; account and admin workflows support that journey with authentication, catalog/inventory, fulfillment, reviews, and marketing tools. The graph includes key business-logic and persistence layers. README documents several capabilities whose implementation files were not sampled; those are represented at their supported route/action paths, with only evidenced relationships shown. Source excerpts and index references limit certainty for unsampled modules.

Main entry points: [`lib/db.js`](https://github.com/ceuw/groza/blob/main/lib/db.js) (PostgreSQL), [`app/actions/admin.js`](https://github.com/ceuw/groza/blob/main/app/actions/admin.js) (Admin Mutations), [`app/actions/auth.js`](https://github.com/ceuw/groza/blob/main/app/actions/auth.js) (Authentication Actions), [`lib/cart.js`](https://github.com/ceuw/groza/blob/main/lib/cart.js) (Cart Services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_store["Storefront"]
  node_catalog["Catalog &amp; Discovery<br/>[page.js]"]
  node_product["Product Detail<br/>[page.js]"]
  node_search["Search<br/>[route.js]"]
end

subgraph group_commerce["Commerce Operations"]
  node_cartpage["Shopping Cart<br/>[page.js]"]
  node_checkoutpage["Checkout<br/>[page.js]"]
  node_orderpage["Order Tracking<br/>[page.js]"]
  node_checkoutaction["Checkout Action<br/>[checkout.js]"]
end

subgraph group_identity["Accounts &amp; Engagement"]
  node_accounts["Customer Accounts"]
  node_authaction["Authentication Actions<br/>[auth.js]"]
  node_review["Customer Reviews<br/>[reviews.js]"]
end

subgraph group_admin["Store Administration"]
  node_adminui["Admin Workspace"]
  node_adminaction["Admin Mutations<br/>[admin.js]"]
  node_newsletter["Newsletter<br/>[newsletter.js]"]
end

subgraph group_platform["Business Logic &amp; Data"]
  node_products["Product Services<br/>[products.js]"]
  node_cartlogic["Cart Services<br/>[cart.js]"]
  node_checkoutlogic["Checkout Services<br/>[checkout.js]"]
  node_orders["Order Services<br/>[orders.js]"]
  node_pricing["Pricing &amp; Discounts<br/>[pricing.js]"]
  node_authlogic["Identity Services<br/>[auth.js]"]
  node_adminlogic["Admin Services<br/>[admin.js]"]
  node_settings["Store Settings<br/>[settings.js]"]
  node_database[("PostgreSQL<br/>[db.js]")]
  node_mailer["Email Delivery<br/>[mailer.js]"]
end

node_shopper(("Shopper"))
node_externalmail(("Email Service"))

node_shopper -->|"browses"| node_catalog
node_shopper -->|"views"| node_product
node_shopper -->|"searches"| node_search
node_catalog -->|"loads catalog"| node_products
node_product -->|"loads details"| node_products
node_search -->|"queries products"| node_products
node_shopper -->|"manages cart"| node_cartpage
node_cartpage -->|"reads cart"| node_cartlogic
node_cartlogic -->|"prices items"| node_pricing
node_shopper -->|"checks out"| node_checkoutpage
node_checkoutpage -->|"submits checkout"| node_checkoutaction
node_checkoutaction -->|"processes checkout"| node_checkoutlogic
node_checkoutlogic -.->|"creates order"| node_orders
node_orders -->|"reads and writes"| node_database
node_shopper -->|"manages account"| node_accounts
node_accounts -.->|"submits credentials"| node_authaction
node_authaction -->|"authenticates"| node_authlogic
node_authaction -->|"merges guest cart"| node_cartlogic
node_authaction -->|"sends welcome mail"| node_mailer
node_mailer -.->|"delivers email"| node_externalmail
node_shopper -->|"submits review"| node_review
node_review -->|"checks user"| node_authlogic
node_review -->|"stores pending review"| node_database
node_shopper -->|"tracks order"| node_orderpage
node_adminui -.->|"manages store"| node_adminaction
node_adminaction -.->|"uses admin queries"| node_adminlogic
node_adminaction -->|"updates orders"| node_orders
node_adminaction -->|"mutates records"| node_database
node_adminaction -->|"checks current user"| node_authlogic
node_adminui -->|"loads dashboard data"| node_adminlogic
node_adminlogic -->|"queries admin data"| node_database
node_newsletter -.->|"stores subscribers"| node_database
node_products -->|"queries catalog"| node_database
node_cartlogic -->|"reads and writes"| node_database
node_checkoutlogic -.->|"uses transaction data"| node_database
node_authlogic -->|"reads sessions"| node_database
node_settings -->|"loads settings"| node_database
node_cartpage -->|"loads store settings"| node_settings
node_product -->|"loads store settings"| node_settings

click node_catalog "https://github.com/ceuw/groza/blob/main/app/(store)/shop/page.js"
click node_product "https://github.com/ceuw/groza/blob/main/app/(store)/product/%5Bslug%5D/page.js"
click node_search "https://github.com/ceuw/groza/blob/main/app/api/search/route.js"
click node_cartpage "https://github.com/ceuw/groza/blob/main/app/(store)/cart/page.js"
click node_checkoutpage "https://github.com/ceuw/groza/blob/main/app/(store)/checkout/page.js"
click node_orderpage "https://github.com/ceuw/groza/blob/main/app/(store)/order/%5BorderNumber%5D/page.js"
click node_checkoutaction "https://github.com/ceuw/groza/blob/main/app/actions/checkout.js"
click node_accounts "https://github.com/ceuw/groza/tree/main/app/(store)/account"
click node_authaction "https://github.com/ceuw/groza/blob/main/app/actions/auth.js"
click node_review "https://github.com/ceuw/groza/blob/main/app/actions/reviews.js"
click node_adminui "https://github.com/ceuw/groza/tree/main/app/admin"
click node_adminaction "https://github.com/ceuw/groza/blob/main/app/actions/admin.js"
click node_newsletter "https://github.com/ceuw/groza/blob/main/app/actions/newsletter.js"
click node_products "https://github.com/ceuw/groza/blob/main/lib/products.js"
click node_cartlogic "https://github.com/ceuw/groza/blob/main/lib/cart.js"
click node_checkoutlogic "https://github.com/ceuw/groza/blob/main/lib/checkout.js"
click node_orders "https://github.com/ceuw/groza/blob/main/lib/orders.js"
click node_pricing "https://github.com/ceuw/groza/blob/main/lib/pricing.js"
click node_authlogic "https://github.com/ceuw/groza/blob/main/lib/auth.js"
click node_adminlogic "https://github.com/ceuw/groza/blob/main/lib/admin.js"
click node_settings "https://github.com/ceuw/groza/blob/main/lib/settings.js"
click node_database "https://github.com/ceuw/groza/blob/main/lib/db.js"
click node_mailer "https://github.com/ceuw/groza/blob/main/lib/mailer.js"

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,node_product,node_search toneBlue
class node_cartpage,node_checkoutpage,node_orderpage,node_checkoutaction toneAmber
class node_accounts,node_authaction,node_review toneMint
class node_adminui,node_adminaction,node_newsletter toneRose
class node_products,node_cartlogic,node_checkoutlogic,node_orders,node_pricing,node_authlogic,node_adminlogic,node_settings,node_database,node_mailer,node_shopper,node_externalmail toneIndigo
```

## Components

### Storefront

- [Catalog & Discovery](https://github.com/ceuw/groza/blob/main/app/(store)/shop/page.js): `app/(store)/shop/page.js`
- [Product Detail](https://github.com/ceuw/groza/blob/main/app/(store)/product/%5Bslug%5D/page.js): `app/(store)/product/[slug]/page.js`
- [Search](https://github.com/ceuw/groza/blob/main/app/api/search/route.js): `app/api/search/route.js`

### Commerce Operations

- [Shopping Cart](https://github.com/ceuw/groza/blob/main/app/(store)/cart/page.js): `app/(store)/cart/page.js`
- [Checkout](https://github.com/ceuw/groza/blob/main/app/(store)/checkout/page.js): `app/(store)/checkout/page.js`
- [Order Tracking](https://github.com/ceuw/groza/blob/main/app/(store)/order/%5BorderNumber%5D/page.js): `app/(store)/order/[orderNumber]/page.js`
- [Checkout Action](https://github.com/ceuw/groza/blob/main/app/actions/checkout.js): `app/actions/checkout.js`

### Accounts & Engagement

- [Customer Accounts](https://github.com/ceuw/groza/tree/main/app/(store)/account): `app/(store)/account`
- [Authentication Actions](https://github.com/ceuw/groza/blob/main/app/actions/auth.js): `app/actions/auth.js`
- [Customer Reviews](https://github.com/ceuw/groza/blob/main/app/actions/reviews.js): `app/actions/reviews.js`

### Store Administration

- [Admin Workspace](https://github.com/ceuw/groza/tree/main/app/admin): `app/admin`
- [Admin Mutations](https://github.com/ceuw/groza/blob/main/app/actions/admin.js): `app/actions/admin.js`
- [Newsletter](https://github.com/ceuw/groza/blob/main/app/actions/newsletter.js): `app/actions/newsletter.js`

### Business Logic & Data

- [Product Services](https://github.com/ceuw/groza/blob/main/lib/products.js): `lib/products.js`
- [Cart Services](https://github.com/ceuw/groza/blob/main/lib/cart.js): `lib/cart.js`
- [Checkout Services](https://github.com/ceuw/groza/blob/main/lib/checkout.js): `lib/checkout.js`
- [Order Services](https://github.com/ceuw/groza/blob/main/lib/orders.js): `lib/orders.js`
- [Pricing & Discounts](https://github.com/ceuw/groza/blob/main/lib/pricing.js): `lib/pricing.js`
- [Identity Services](https://github.com/ceuw/groza/blob/main/lib/auth.js): `lib/auth.js`
- [Admin Services](https://github.com/ceuw/groza/blob/main/lib/admin.js): `lib/admin.js`
- [Store Settings](https://github.com/ceuw/groza/blob/main/lib/settings.js): `lib/settings.js`
- [PostgreSQL](https://github.com/ceuw/groza/blob/main/lib/db.js): `lib/db.js`
- [Email Delivery](https://github.com/ceuw/groza/blob/main/lib/mailer.js): `lib/mailer.js`

### Other components

- **Shopper**
- **Email Service**

## Connections

- Shopper → Catalog & Discovery: browses
- Shopper → Product Detail: views
- Shopper → Search: searches
- Catalog & Discovery → Product Services: loads catalog (evidence: `app/(store)/shop/page.js`)
- Product Detail → Product Services: loads details (evidence: `app/(store)/product/[slug]/page.js`)
- Search → Product Services: queries products (evidence: `app/api/search/route.js`)
- Shopper → Shopping Cart: manages cart
- Shopping Cart → Cart Services: reads cart (evidence: `app/(store)/cart/page.js`)
- Cart Services → Pricing & Discounts: prices items (evidence: `lib/cart.js`)
- Shopper → Checkout: checks out
- Checkout → Checkout Action: submits checkout
- Checkout Action → Checkout Services: processes checkout (evidence: `app/actions/checkout.js`)
- Checkout Services → Order Services: creates order
- Order Services → PostgreSQL: reads and writes (evidence: `lib/orders.js`)
- Shopper → Customer Accounts: manages account
- Customer Accounts → Authentication Actions: submits credentials
- Authentication Actions → Identity Services: authenticates (evidence: `app/actions/auth.js`)
- Authentication Actions → Cart Services: merges guest cart (evidence: `app/actions/auth.js`)
- Authentication Actions → Email Delivery: sends welcome mail (evidence: `app/actions/auth.js`)
- Email Delivery → Email Service: delivers email
- Shopper → Customer Reviews: submits review
- Customer Reviews → Identity Services: checks user (evidence: `app/actions/reviews.js`)
- Customer Reviews → PostgreSQL: stores pending review (evidence: `app/actions/reviews.js`)
- Shopper → Order Tracking: tracks order
- Admin Workspace → Admin Mutations: manages store (evidence: `app/admin/discounts/page.js`)
- Admin Mutations → Admin Services: uses admin queries
- Admin Mutations → Order Services: updates orders (evidence: `app/actions/admin.js`)
- Admin Mutations → PostgreSQL: mutates records (evidence: `app/actions/admin.js`)
- Admin Mutations → Identity Services: checks current user (evidence: `app/actions/admin.js`)
- Admin Workspace → Admin Services: loads dashboard data (evidence: `app/admin/page.js`)
- Admin Services → PostgreSQL: queries admin data (evidence: `lib/admin.js`)
- Newsletter → PostgreSQL: stores subscribers
- Product Services → PostgreSQL: queries catalog (evidence: `lib/products.js`)
- Cart Services → PostgreSQL: reads and writes (evidence: `lib/cart.js`)
- Checkout Services → PostgreSQL: uses transaction data
- Identity Services → PostgreSQL: reads sessions (evidence: `lib/auth.js`)
- Store Settings → PostgreSQL: loads settings (evidence: `lib/settings.js`)
- Shopping Cart → Store Settings: loads store settings (evidence: `app/(store)/cart/page.js`)
- Product Detail → Store Settings: loads store settings (evidence: `app/(store)/product/[slug]/page.js`)
