# darshanreddy4/darza architecture

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

- Interactive diagram: https://gitdiagram.com/darshanreddy4/darza
- Repository: https://github.com/darshanreddy4/darza

## Overview

DMG is a hybrid commerce platform: customers browse DMG-owned and affiliate products, then purchase owned items through cart and checkout or follow tracked partner redirects. Storefront and admin experiences are separate Next.js surfaces backed by a NestJS API. The graph preserves catalog/search, identity, checkout/payments, merchandising, and administration capabilities documented in the README. Some links rely on README descriptions or import references; unsampled modules are represented only at their supported directory paths.

Main entry points: [`apps/api/src/prisma.service.ts`](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/prisma.service.ts) (PostgreSQL), [`apps/web/src/app/(store)`](https://github.com/darshanreddy4/darza/tree/main/apps/web/src/app/(store)) (Storefront), [`apps/api/src/products/products.service.ts`](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/products/products.service.ts) (Product Catalog), [`apps/api/src/search/search.service.ts`](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/search/search.service.ts) (Product Search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Storefront and Admin"]
  node_webstore["Storefront"]
  node_webadmin["Admin Dashboard"]
  node_authui["Sign-in Pages"]
  node_adminops["Store Administration"]
end

subgraph group_identity["Identity and Site"]
  node_authapi["Authentication<br/>[auth.service.ts]"]
  node_authguard["Access Control<br/>[auth.guard.ts]"]
  node_site["Site Profile<br/>[site.module.ts]"]
  node_appearance["Appearance<br/>[appearance.ts]"]
end

subgraph group_catalog["Catalog and Discovery"]
  node_catalogapi["Product Catalog"]
  node_categoryapi["Categories"]
  node_searchapi["Product Search<br/>[search.service.ts]"]
  node_banners["Banners"]
  node_engagement["Reviews and Wishlist"]
end

subgraph group_commerce["Checkout and Orders"]
  node_checkout["Cart and Checkout<br/>[page.tsx]"]
  node_ordersapi["Orders and Returns<br/>[orders.service.ts]"]
  node_payments["Razorpay Payments"]
  node_analytics["Sales Analytics<br/>[sales-report.ts]"]
end

subgraph group_platform["API Infrastructure"]
  node_database[("PostgreSQL<br/>[prisma.service.ts]")]
  node_cache["Response Cache<br/>[cache.service.ts]"]
  node_storage["Media Storage<br/>[storage.service.ts]"]
end

node_customer(("Customer"))
node_adminuser(("Store Admin"))
node_meili[("Meilisearch")]
node_partner["Partner Marketplace"]

node_customer -->|"browses and buys"| node_webstore
node_adminuser -->|"manages store"| node_webadmin
node_webstore -->|"signs in"| node_authui
node_authui -->|"authenticates"| node_authapi
node_webstore -->|"requests catalog"| node_catalogapi
node_webstore -->|"checks out"| node_checkout
node_checkout -->|"places order"| node_ordersapi
node_ordersapi -->|"creates and verifies payment"| node_payments
node_webstore -->|"tracked redirect"| node_partner
node_webadmin -->|"manages catalog and store"| node_adminops
node_adminops -->|"uses protected API"| node_authguard
node_catalogapi -->|"reads and writes"| node_database
node_catalogapi -->|"updates search index"| node_searchapi
node_searchapi -->|"loads indexed products"| node_database
node_searchapi -->|"indexes and searches"| node_meili
node_catalogapi -->|"caches catalog responses"| node_cache
node_categoryapi -->|"coordinates search"| node_searchapi
node_banners -->|"reads and records engagement"| node_database
node_banners -->|"caches public banners"| node_cache
node_engagement -->|"loads product images"| node_catalogapi
node_engagement -->|"stores review media"| node_storage
node_authapi -->|"reads and updates accounts"| node_database
node_authguard -->|"checks session identity"| node_database
node_site -->|"stores logo media"| node_storage
node_site -->|"caches public profile"| node_cache
node_appearance -->|"caches appearance data"| node_cache
node_appearance -->|"reads and saves settings"| node_database
node_ordersapi -->|"persists orders"| node_database
node_adminops -->|"views sales reports"| node_analytics
node_analytics -.->|"reads sales data"| node_database

click node_webstore "https://github.com/darshanreddy4/darza/tree/main/apps/web/src/app/(store)"
click node_webadmin "https://github.com/darshanreddy4/darza/tree/main/apps/web/src/app/admin"
click node_authui "https://github.com/darshanreddy4/darza/tree/main/apps/web/src/app/(auth)"
click node_authapi "https://github.com/darshanreddy4/darza/blob/main/apps/api/src/auth/auth.service.ts"
click node_authguard "https://github.com/darshanreddy4/darza/blob/main/apps/api/src/auth/auth.guard.ts"
click node_site "https://github.com/darshanreddy4/darza/blob/main/apps/api/src/site/site.module.ts"
click node_appearance "https://github.com/darshanreddy4/darza/blob/main/apps/api/src/appearance/appearance.ts"
click node_catalogapi "https://github.com/darshanreddy4/darza/blob/main/apps/api/src/products/products.service.ts"
click node_categoryapi "https://github.com/darshanreddy4/darza/blob/main/apps/api/src/categories/categories.controller.ts"
click node_searchapi "https://github.com/darshanreddy4/darza/blob/main/apps/api/src/search/search.service.ts"
click node_banners "https://github.com/darshanreddy4/darza/blob/main/apps/api/src/banners/banners.controller.ts"
click node_engagement "https://github.com/darshanreddy4/darza/blob/main/apps/api/src/engagement/engagement.controller.ts"
click node_checkout "https://github.com/darshanreddy4/darza/blob/main/apps/web/src/app/(store)/checkout/page.tsx"
click node_ordersapi "https://github.com/darshanreddy4/darza/blob/main/apps/api/src/orders/orders.service.ts"
click node_payments "https://github.com/darshanreddy4/darza/blob/main/apps/api/src/payments/razorpay.service.ts"
click node_adminops "https://github.com/darshanreddy4/darza/tree/main/apps/web/src/app/admin"
click node_analytics "https://github.com/darshanreddy4/darza/blob/main/apps/api/src/analytics/sales-report.ts"
click node_database "https://github.com/darshanreddy4/darza/blob/main/apps/api/src/prisma.service.ts"
click node_cache "https://github.com/darshanreddy4/darza/blob/main/apps/api/src/cache/cache.service.ts"
click node_storage "https://github.com/darshanreddy4/darza/blob/main/apps/api/src/storage/storage.service.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_webstore,node_webadmin,node_authui,node_adminops toneBlue
class node_authapi,node_authguard,node_site,node_appearance,node_meili toneAmber
class node_catalogapi,node_categoryapi,node_searchapi,node_banners,node_engagement toneMint
class node_checkout,node_ordersapi,node_payments,node_analytics toneRose
class node_database,node_cache,node_storage,node_customer,node_adminuser,node_partner toneIndigo
```

## Components

### Storefront and Admin

- [Storefront](https://github.com/darshanreddy4/darza/tree/main/apps/web/src/app/(store)): `apps/web/src/app/(store)`
- [Admin Dashboard](https://github.com/darshanreddy4/darza/tree/main/apps/web/src/app/admin): `apps/web/src/app/admin`
- [Sign-in Pages](https://github.com/darshanreddy4/darza/tree/main/apps/web/src/app/(auth)): `apps/web/src/app/(auth)`
- [Store Administration](https://github.com/darshanreddy4/darza/tree/main/apps/web/src/app/admin): `apps/web/src/app/admin`

### Identity and Site

- [Authentication](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/auth/auth.service.ts): `apps/api/src/auth/auth.service.ts`
- [Access Control](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/auth/auth.guard.ts): `apps/api/src/auth/auth.guard.ts`
- [Site Profile](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/site/site.module.ts): `apps/api/src/site/site.module.ts`
- [Appearance](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/appearance/appearance.ts): `apps/api/src/appearance/appearance.ts`

### Catalog and Discovery

- [Product Catalog](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/products/products.service.ts): `apps/api/src/products/products.service.ts`
- [Categories](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/categories/categories.controller.ts): `apps/api/src/categories/categories.controller.ts`
- [Product Search](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/search/search.service.ts): `apps/api/src/search/search.service.ts`
- [Banners](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/banners/banners.controller.ts): `apps/api/src/banners/banners.controller.ts`
- [Reviews and Wishlist](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/engagement/engagement.controller.ts): `apps/api/src/engagement/engagement.controller.ts`

### Checkout and Orders

- [Cart and Checkout](https://github.com/darshanreddy4/darza/blob/main/apps/web/src/app/(store)/checkout/page.tsx): `apps/web/src/app/(store)/checkout/page.tsx`
- [Orders and Returns](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/orders/orders.service.ts): `apps/api/src/orders/orders.service.ts`
- [Razorpay Payments](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/payments/razorpay.service.ts): `apps/api/src/payments/razorpay.service.ts`
- [Sales Analytics](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/analytics/sales-report.ts): `apps/api/src/analytics/sales-report.ts`

### API Infrastructure

- [PostgreSQL](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/prisma.service.ts): `apps/api/src/prisma.service.ts`
- [Response Cache](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/cache/cache.service.ts): `apps/api/src/cache/cache.service.ts`
- [Media Storage](https://github.com/darshanreddy4/darza/blob/main/apps/api/src/storage/storage.service.ts): `apps/api/src/storage/storage.service.ts`

### Other components

- **Customer**
- **Store Admin**
- **Meilisearch**
- **Partner Marketplace**

## Connections

- Customer → Storefront: browses and buys (evidence: `README.md`)
- Store Admin → Admin Dashboard: manages store (evidence: `README.md`)
- Storefront → Sign-in Pages: signs in (evidence: `README.md`)
- Sign-in Pages → Authentication: authenticates (evidence: `README.md`)
- Storefront → Product Catalog: requests catalog (evidence: `README.md`)
- Storefront → Cart and Checkout: checks out (evidence: `README.md`)
- Cart and Checkout → Orders and Returns: places order (evidence: `README.md`)
- Orders and Returns → Razorpay Payments: creates and verifies payment (evidence: `apps/api/src/orders/orders.controller.ts`)
- Storefront → Partner Marketplace: tracked redirect (evidence: `README.md`)
- Admin Dashboard → Store Administration: manages catalog and store (evidence: `README.md`)
- Store Administration → Access Control: uses protected API
- Product Catalog → PostgreSQL: reads and writes (evidence: `apps/api/src/products/products.service.ts`)
- Product Catalog → Product Search: updates search index (evidence: `README.md`)
- Product Search → PostgreSQL: loads indexed products (evidence: `apps/api/src/search/search.service.ts`)
- Product Search → Meilisearch: indexes and searches (evidence: `README.md`)
- Product Catalog → Response Cache: caches catalog responses (evidence: `apps/api/src/products/products.service.ts`)
- Categories → Product Search: coordinates search (evidence: `apps/api/src/categories/categories.controller.ts`)
- Banners → PostgreSQL: reads and records engagement (evidence: `apps/api/src/banners/banners.controller.ts`)
- Banners → Response Cache: caches public banners (evidence: `apps/api/src/banners/banners.controller.ts`)
- Reviews and Wishlist → Product Catalog: loads product images (evidence: `apps/api/src/engagement/engagement.controller.ts`)
- Reviews and Wishlist → Media Storage: stores review media (evidence: `apps/api/src/engagement/engagement.controller.ts`)
- Authentication → PostgreSQL: reads and updates accounts (evidence: `apps/api/src/auth/auth.service.ts`)
- Access Control → PostgreSQL: checks session identity (evidence: `apps/api/src/auth/auth.guard.ts`)
- Site Profile → Media Storage: stores logo media (evidence: `apps/api/src/site/site.module.ts`)
- Site Profile → Response Cache: caches public profile (evidence: `apps/api/src/site/site.module.ts`)
- Appearance → Response Cache: caches appearance data (evidence: `apps/api/src/appearance/appearance.service.ts`)
- Appearance → PostgreSQL: reads and saves settings (evidence: `apps/api/src/appearance/appearance.service.ts`)
- Orders and Returns → PostgreSQL: persists orders
- Store Administration → Sales Analytics: views sales reports (evidence: `README.md`)
- Sales Analytics → PostgreSQL: reads sales data
