# amoghpoluru/evega architecture

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

- Interactive diagram: https://gitdiagram.com/amoghpoluru/evega
- Repository: https://github.com/amoghpoluru/evega

## Overview

This is a multi-vendor marketplace built with Next.js and Payload CMS. The main buyer journey is browsing and searching the shared catalog, viewing a product, checking out, and having payment events create or update orders. Vendors manage storefronts and social connections; staff administer marketplace data. The graph preserves documented capabilities and source-indexed modules, but several page and procedure implementations were not sampled, so uncertain links are omitted or marked unverified.

Main entry points: [`src/modules/products/server/procedures.ts`](https://github.com/amoghpoluru/evega/blob/main/src/modules/products/server/procedures.ts) (Product catalog), [`src/modules/checkout/server/procedures.ts`](https://github.com/amoghpoluru/evega/blob/main/src/modules/checkout/server/procedures.ts) (Checkout), [`src/collections/Orders.ts`](https://github.com/amoghpoluru/evega/blob/main/src/collections/Orders.ts) (Order management), [`src/payload.config.ts`](https://github.com/amoghpoluru/evega/blob/main/src/payload.config.ts) (Payload CMS)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Marketplace storefront"]
  node_catalog["Product catalog<br/>[procedures.ts]"]
  node_search["Catalog search"]
  node_product_page["Product detail<br/>[product-view.tsx]"]
  node_storefront_templates["Storefront templates<br/>[template-engine.ts]"]
end

subgraph group_commerce["Commerce and orders"]
  node_checkout["Checkout<br/>[procedures.ts]"]
  node_payment_events["Payment webhooks<br/>[route.ts]"]
  node_orders[("Order management<br/>[Orders.ts]")]
  node_inventory["Inventory adjustment"]
end

subgraph group_vendor["Vendor operations"]
  node_vendor_social[("Social connections")]
  node_instagram_oauth["Instagram OAuth<br/>[instagram-oauth.ts]"]
  node_staff_admin["Staff administration<br/>[procedures.ts]"]
  node_vendor_data[("Vendor data<br/>[Vendors.ts]")]
end

subgraph group_platform["CMS and platform"]
  node_auth["Authentication<br/>[route.ts]"]
  node_trpc_api["tRPC API<br/>[_app.ts]"]
  node_payload_cms[("Payload CMS<br/>[payload.config.ts]")]
  node_media_api["Media API<br/>[route.ts]"]
  node_blob_storage[("Blob storage")]
  node_media_records[("Media records")]
end

node_shopper(("Shopper"))
node_vendor_actor(("Vendor"))
node_staff_actor(("Staff"))

node_shopper -.->|"browses"| node_catalog
node_shopper -.->|"searches"| node_search
node_shopper -.->|"views"| node_product_page
node_shopper -.->|"checks out"| node_checkout
node_catalog -.->|"builds queries"| node_search
node_catalog -.->|"resolves storefront"| node_storefront_templates
node_checkout -.->|"creates orders"| node_orders
node_payment_events -->|"loads CMS"| node_payload_cms
node_payment_events -.->|"handles payment events"| node_orders
node_orders -->|"adjusts stock"| node_inventory
node_trpc_api -->|"routes procedures"| node_catalog
node_trpc_api -->|"routes procedures"| node_checkout
node_auth -->|"authenticates users"| node_payload_cms
node_media_api -->|"uploads and deletes"| node_blob_storage
node_media_api -->|"creates records"| node_media_records
node_media_records -.->|"stores metadata"| node_payload_cms
node_vendor_actor -.->|"connects accounts"| node_vendor_social
node_vendor_social -->|"refreshes tokens"| node_instagram_oauth
node_staff_actor -.->|"administers marketplace"| node_staff_admin
node_staff_admin -.->|"manages vendors"| node_vendor_data

click node_catalog "https://github.com/amoghpoluru/evega/blob/main/src/modules/products/server/procedures.ts"
click node_search "https://github.com/amoghpoluru/evega/blob/main/src/lib/search/search-query-builder.ts"
click node_product_page "https://github.com/amoghpoluru/evega/blob/main/src/modules/products/ui/components/product-view.tsx"
click node_storefront_templates "https://github.com/amoghpoluru/evega/blob/main/src/lib/templates/template-engine.ts"
click node_checkout "https://github.com/amoghpoluru/evega/blob/main/src/modules/checkout/server/procedures.ts"
click node_payment_events "https://github.com/amoghpoluru/evega/blob/main/src/app/api/stripe/webhook/route.ts"
click node_orders "https://github.com/amoghpoluru/evega/blob/main/src/collections/Orders.ts"
click node_inventory "https://github.com/amoghpoluru/evega/blob/main/src/lib/inventory/adjust-product-stock.ts"
click node_auth "https://github.com/amoghpoluru/evega/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts"
click node_trpc_api "https://github.com/amoghpoluru/evega/blob/main/src/trpc/routers/_app.ts"
click node_payload_cms "https://github.com/amoghpoluru/evega/blob/main/src/payload.config.ts"
click node_media_api "https://github.com/amoghpoluru/evega/blob/main/src/app/api/media/route.ts"
click node_blob_storage "https://github.com/amoghpoluru/evega/blob/main/src/lib/vercel-blob-storage.ts"
click node_media_records "https://github.com/amoghpoluru/evega/blob/main/src/lib/create-media-from-blob.ts"
click node_vendor_social "https://github.com/amoghpoluru/evega/blob/main/src/lib/vendor-social-connections.ts"
click node_instagram_oauth "https://github.com/amoghpoluru/evega/blob/main/src/lib/instagram-oauth.ts"
click node_staff_admin "https://github.com/amoghpoluru/evega/blob/main/src/modules/admin/server/procedures.ts"
click node_vendor_data "https://github.com/amoghpoluru/evega/blob/main/src/collections/Vendors.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_catalog,node_search,node_product_page,node_storefront_templates toneBlue
class node_checkout,node_payment_events,node_orders,node_inventory toneAmber
class node_vendor_social,node_instagram_oauth,node_staff_admin,node_vendor_data toneMint
class node_auth,node_trpc_api,node_payload_cms,node_media_api,node_blob_storage,node_media_records toneRose
class node_shopper,node_vendor_actor,node_staff_actor toneIndigo
```

## Components

### Marketplace storefront

- [Product catalog](https://github.com/amoghpoluru/evega/blob/main/src/modules/products/server/procedures.ts): `src/modules/products/server/procedures.ts`
- [Catalog search](https://github.com/amoghpoluru/evega/blob/main/src/lib/search/search-query-builder.ts): `src/lib/search/search-query-builder.ts`
- [Product detail](https://github.com/amoghpoluru/evega/blob/main/src/modules/products/ui/components/product-view.tsx): `src/modules/products/ui/components/product-view.tsx`
- [Storefront templates](https://github.com/amoghpoluru/evega/blob/main/src/lib/templates/template-engine.ts): `src/lib/templates/template-engine.ts`

### Commerce and orders

- [Checkout](https://github.com/amoghpoluru/evega/blob/main/src/modules/checkout/server/procedures.ts): `src/modules/checkout/server/procedures.ts`
- [Payment webhooks](https://github.com/amoghpoluru/evega/blob/main/src/app/api/stripe/webhook/route.ts): `src/app/api/stripe/webhook/route.ts`
- [Order management](https://github.com/amoghpoluru/evega/blob/main/src/collections/Orders.ts): `src/collections/Orders.ts`
- [Inventory adjustment](https://github.com/amoghpoluru/evega/blob/main/src/lib/inventory/adjust-product-stock.ts): `src/lib/inventory/adjust-product-stock.ts`

### Vendor operations

- [Social connections](https://github.com/amoghpoluru/evega/blob/main/src/lib/vendor-social-connections.ts): `src/lib/vendor-social-connections.ts`
- [Instagram OAuth](https://github.com/amoghpoluru/evega/blob/main/src/lib/instagram-oauth.ts): `src/lib/instagram-oauth.ts`
- [Staff administration](https://github.com/amoghpoluru/evega/blob/main/src/modules/admin/server/procedures.ts): `src/modules/admin/server/procedures.ts`
- [Vendor data](https://github.com/amoghpoluru/evega/blob/main/src/collections/Vendors.ts): `src/collections/Vendors.ts`

### CMS and platform

- [Authentication](https://github.com/amoghpoluru/evega/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts): `src/app/api/auth/[...nextauth]/route.ts`
- [tRPC API](https://github.com/amoghpoluru/evega/blob/main/src/trpc/routers/_app.ts): `src/trpc/routers/_app.ts`
- [Payload CMS](https://github.com/amoghpoluru/evega/blob/main/src/payload.config.ts): `src/payload.config.ts`
- [Media API](https://github.com/amoghpoluru/evega/blob/main/src/app/api/media/route.ts): `src/app/api/media/route.ts`
- [Blob storage](https://github.com/amoghpoluru/evega/blob/main/src/lib/vercel-blob-storage.ts): `src/lib/vercel-blob-storage.ts`
- [Media records](https://github.com/amoghpoluru/evega/blob/main/src/lib/create-media-from-blob.ts): `src/lib/create-media-from-blob.ts`

### Other components

- **Shopper**
- **Vendor**
- **Staff**

## Connections

- Shopper → Product catalog: browses (evidence: `README.md`)
- Shopper → Catalog search: searches
- Shopper → Product detail: views
- Shopper → Checkout: checks out (evidence: `README.md`)
- Product catalog → Catalog search: builds queries (evidence: `src/lib/search/search-query-builder.ts`)
- Product catalog → Storefront templates: resolves storefront (evidence: `src/lib/templates/template-engine.ts`)
- Checkout → Order management: creates orders (evidence: `README.md`)
- Payment webhooks → Payload CMS: loads CMS (evidence: `src/app/api/stripe/webhook/route.ts`)
- Payment webhooks → Order management: handles payment events (evidence: `src/app/api/stripe/webhook/route.ts`)
- Order management → Inventory adjustment: adjusts stock (evidence: `src/collections/Orders.ts`)
- tRPC API → Product catalog: routes procedures (evidence: `src/trpc/routers/_app.ts`)
- tRPC API → Checkout: routes procedures (evidence: `src/trpc/routers/_app.ts`)
- Authentication → Payload CMS: authenticates users (evidence: `src/app/api/auth/[...nextauth]/route.ts`)
- Media API → Blob storage: uploads and deletes (evidence: `src/app/api/media/route.ts`)
- Media API → Media records: creates records (evidence: `src/app/api/media/route.ts`)
- Media records → Payload CMS: stores metadata
- Vendor → Social connections: connects accounts
- Social connections → Instagram OAuth: refreshes tokens (evidence: `src/lib/vendor-social-connections.ts`)
- Staff → Staff administration: administers marketplace
- Staff administration → Vendor data: manages vendors
