# manandarji06/fst-assignment-2 architecture

> Architecture diagram of the GitHub repository manandarji06/fst-assignment-2, 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/manandarji06/fst-assignment-2
- Repository: https://github.com/manandarji06/fst-assignment-2

## Overview

Lumis is a full-stack e-commerce application. Customers browse and filter the catalog, authenticate, place stock-validated orders, and view order history; administrators can inspect users and audit activity. The map also preserves product APIs, email notifications, and Resend webhook logging. Relationships are limited to those visible in the sampled source, SOURCE INDEX references, or README; unsampled implementations are represented by their exact tree paths, without assuming their internal calls.

Main entry points: [`lib/db.ts`](https://github.com/manandarji06/fst-assignment-2/blob/main/lib/db.ts) (Prisma Client), [`lib/auth.ts`](https://github.com/manandarji06/fst-assignment-2/blob/main/lib/auth.ts) (Auth Service), [`lib/mailer.ts`](https://github.com/manandarji06/fst-assignment-2/blob/main/lib/mailer.ts) (Email Sender), [`app/page.tsx`](https://github.com/manandarji06/fst-assignment-2/blob/main/app/page.tsx) (Home Catalog Page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_home["Home Catalog Page<br/>[page.tsx]"]
  node_catalog["Product Catalog<br/>[ProductCatalog.tsx]"]
  node_productapi["Product API<br/>[route.ts]"]
end

subgraph group_identity["Identity and Orders"]
  node_signin["Sign-in and Sign-up"]
  node_authclient["Auth Client<br/>[auth-client.ts]"]
  node_authserver["Auth Service<br/>[auth.ts]"]
  node_authroute["Auth API Route<br/>[route.ts]"]
  node_middleware["Route Protection<br/>[middleware.ts]"]
  node_orderaction["Order Server Action<br/>[order-actions.ts]"]
  node_orderapi["Order API<br/>[route.ts]"]
  node_dashboard["Customer Dashboard<br/>[page.tsx]"]
end

subgraph group_operations["Administration"]
  node_admin["Admin Console<br/>[page.tsx]"]
  node_auditapi["Audit Log API<br/>[route.ts]"]
end

subgraph group_messaging["Email and Events"]
  node_webhook["Resend Webhook<br/>[route.ts]"]
  node_mailer["Email Sender<br/>[mailer.ts]"]
  node_orderemail["Order Confirmation Template"]
  node_welcomeemail["Welcome Email Template<br/>[WelcomeEmail.tsx]"]
end

node_customer(("Customer"))
node_dbclient["Prisma Client<br/>[db.ts]"]
node_database[("Relational Database<br/>[schema.prisma]")]
node_postgres[("PostgreSQL")]
node_resend["Resend"]

node_customer -->|"browses"| node_home
node_home -->|"renders"| node_catalog
node_catalog -->|"places order"| node_orderaction
node_orderaction -->|"checks session"| node_authserver
node_orderaction -->|"updates order data"| node_dbclient
node_home -->|"loads products"| node_dbclient
node_signin -->|"uses"| node_authclient
node_authclient -.->|"authenticates"| node_authserver
node_authroute -->|"dispatches to"| node_authserver
node_authserver -->|"uses"| node_dbclient
node_middleware -.->|"checks access"| node_authserver
node_orderapi -->|"checks session"| node_authserver
node_orderapi -->|"reads and writes"| node_dbclient
node_productapi -->|"checks session"| node_authserver
node_productapi -->|"reads and writes"| node_dbclient
node_dashboard -->|"checks session"| node_authserver
node_dashboard -->|"loads order history"| node_dbclient
node_admin -->|"loads admin data"| node_dbclient
node_auditapi -->|"checks admin session"| node_authserver
node_auditapi -->|"reads audit logs"| node_dbclient
node_webhook -->|"records email events"| node_dbclient
node_mailer -->|"renders"| node_orderemail
node_mailer -->|"renders"| node_welcomeemail
node_mailer -.->|"sends email"| node_resend
node_dbclient -.->|"accesses schema"| node_database
node_database -.->|"stores data"| node_postgres

click node_home "https://github.com/manandarji06/fst-assignment-2/blob/main/app/page.tsx"
click node_catalog "https://github.com/manandarji06/fst-assignment-2/blob/main/components/ProductCatalog.tsx"
click node_productapi "https://github.com/manandarji06/fst-assignment-2/blob/main/app/api/products/route.ts"
click node_signin "https://github.com/manandarji06/fst-assignment-2/tree/main/app/auth"
click node_authclient "https://github.com/manandarji06/fst-assignment-2/blob/main/lib/auth-client.ts"
click node_authserver "https://github.com/manandarji06/fst-assignment-2/blob/main/lib/auth.ts"
click node_authroute "https://github.com/manandarji06/fst-assignment-2/blob/main/app/api/auth/%5B...all%5D/route.ts"
click node_middleware "https://github.com/manandarji06/fst-assignment-2/blob/main/middleware.ts"
click node_orderaction "https://github.com/manandarji06/fst-assignment-2/blob/main/lib/actions/order-actions.ts"
click node_orderapi "https://github.com/manandarji06/fst-assignment-2/blob/main/app/api/orders/route.ts"
click node_dashboard "https://github.com/manandarji06/fst-assignment-2/blob/main/app/dashboard/page.tsx"
click node_admin "https://github.com/manandarji06/fst-assignment-2/blob/main/app/admin/page.tsx"
click node_auditapi "https://github.com/manandarji06/fst-assignment-2/blob/main/app/api/audit-logs/route.ts"
click node_webhook "https://github.com/manandarji06/fst-assignment-2/blob/main/app/api/webhooks/resend/route.ts"
click node_mailer "https://github.com/manandarji06/fst-assignment-2/blob/main/lib/mailer.ts"
click node_orderemail "https://github.com/manandarji06/fst-assignment-2/blob/main/emails/OrderConfirmationEmail.tsx"
click node_welcomeemail "https://github.com/manandarji06/fst-assignment-2/blob/main/emails/WelcomeEmail.tsx"
click node_dbclient "https://github.com/manandarji06/fst-assignment-2/blob/main/lib/db.ts"
click node_database "https://github.com/manandarji06/fst-assignment-2/blob/main/prisma/schema.prisma"

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_home,node_catalog,node_productapi,node_dbclient toneBlue
class node_signin,node_authclient,node_authserver,node_authroute,node_middleware,node_orderaction,node_orderapi,node_dashboard,node_database,node_postgres toneAmber
class node_admin,node_auditapi toneMint
class node_webhook,node_mailer,node_orderemail,node_welcomeemail toneRose
class node_customer,node_resend toneIndigo
```

## Components

### Storefront

- [Home Catalog Page](https://github.com/manandarji06/fst-assignment-2/blob/main/app/page.tsx): `app/page.tsx`
- [Product Catalog](https://github.com/manandarji06/fst-assignment-2/blob/main/components/ProductCatalog.tsx): `components/ProductCatalog.tsx`
- [Product API](https://github.com/manandarji06/fst-assignment-2/blob/main/app/api/products/route.ts): `app/api/products/route.ts`

### Identity and Orders

- [Sign-in and Sign-up](https://github.com/manandarji06/fst-assignment-2/tree/main/app/auth): `app/auth`
- [Auth Client](https://github.com/manandarji06/fst-assignment-2/blob/main/lib/auth-client.ts): `lib/auth-client.ts`
- [Auth Service](https://github.com/manandarji06/fst-assignment-2/blob/main/lib/auth.ts): `lib/auth.ts`
- [Auth API Route](https://github.com/manandarji06/fst-assignment-2/blob/main/app/api/auth/%5B...all%5D/route.ts): `app/api/auth/[...all]/route.ts`
- [Route Protection](https://github.com/manandarji06/fst-assignment-2/blob/main/middleware.ts): `middleware.ts`
- [Order Server Action](https://github.com/manandarji06/fst-assignment-2/blob/main/lib/actions/order-actions.ts): `lib/actions/order-actions.ts`
- [Order API](https://github.com/manandarji06/fst-assignment-2/blob/main/app/api/orders/route.ts): `app/api/orders/route.ts`
- [Customer Dashboard](https://github.com/manandarji06/fst-assignment-2/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`

### Administration

- [Admin Console](https://github.com/manandarji06/fst-assignment-2/blob/main/app/admin/page.tsx): `app/admin/page.tsx`
- [Audit Log API](https://github.com/manandarji06/fst-assignment-2/blob/main/app/api/audit-logs/route.ts): `app/api/audit-logs/route.ts`

### Email and Events

- [Resend Webhook](https://github.com/manandarji06/fst-assignment-2/blob/main/app/api/webhooks/resend/route.ts): `app/api/webhooks/resend/route.ts`
- [Email Sender](https://github.com/manandarji06/fst-assignment-2/blob/main/lib/mailer.ts): `lib/mailer.ts`
- [Order Confirmation Template](https://github.com/manandarji06/fst-assignment-2/blob/main/emails/OrderConfirmationEmail.tsx): `emails/OrderConfirmationEmail.tsx`
- [Welcome Email Template](https://github.com/manandarji06/fst-assignment-2/blob/main/emails/WelcomeEmail.tsx): `emails/WelcomeEmail.tsx`

### Other components

- **Customer**
- [Prisma Client](https://github.com/manandarji06/fst-assignment-2/blob/main/lib/db.ts): `lib/db.ts`
- [Relational Database](https://github.com/manandarji06/fst-assignment-2/blob/main/prisma/schema.prisma): `prisma/schema.prisma`
- **PostgreSQL**
- **Resend**

## Connections

- Customer → Home Catalog Page: browses (evidence: `README.md`)
- Home Catalog Page → Product Catalog: renders (evidence: `app/page.tsx`)
- Product Catalog → Order Server Action: places order (evidence: `components/ProductCatalog.tsx`)
- Order Server Action → Auth Service: checks session (evidence: `lib/actions/order-actions.ts`)
- Order Server Action → Prisma Client: updates order data (evidence: `lib/actions/order-actions.ts`)
- Home Catalog Page → Prisma Client: loads products (evidence: `app/page.tsx`)
- Sign-in and Sign-up → Auth Client: uses (evidence: `app/auth/sign-in/page.tsx`)
- Auth Client → Auth Service: authenticates
- Auth API Route → Auth Service: dispatches to (evidence: `app/api/auth/[...all]/route.ts`)
- Auth Service → Prisma Client: uses (evidence: `lib/auth.ts`)
- Route Protection → Auth Service: checks access
- Order API → Auth Service: checks session (evidence: `app/api/orders/route.ts`)
- Order API → Prisma Client: reads and writes (evidence: `app/api/orders/route.ts`)
- Product API → Auth Service: checks session (evidence: `app/api/products/route.ts`)
- Product API → Prisma Client: reads and writes (evidence: `app/api/products/route.ts`)
- Customer Dashboard → Auth Service: checks session (evidence: `app/dashboard/page.tsx`)
- Customer Dashboard → Prisma Client: loads order history (evidence: `app/dashboard/page.tsx`)
- Admin Console → Prisma Client: loads admin data (evidence: `app/admin/page.tsx`)
- Audit Log API → Auth Service: checks admin session (evidence: `app/api/audit-logs/route.ts`)
- Audit Log API → Prisma Client: reads audit logs (evidence: `app/api/audit-logs/route.ts`)
- Resend Webhook → Prisma Client: records email events (evidence: `app/api/webhooks/resend/route.ts`)
- Email Sender → Order Confirmation Template: renders (evidence: `lib/mailer.ts`)
- Email Sender → Welcome Email Template: renders (evidence: `lib/mailer.ts`)
- Email Sender → Resend: sends email (evidence: `README.md`)
- Prisma Client → Relational Database: accesses schema
- Relational Database → PostgreSQL: stores data (evidence: `README.md`)
