# falekartik418/project-loop architecture

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

- Interactive diagram: https://gitdiagram.com/falekartik418/project-loop
- Repository: https://github.com/falekartik418/project-loop

## Overview

LOOP is a multi-tenant customer-feedback intelligence platform. Users submit feedback or import it, then review classified feedback, explore analytics and theme trends, ask questions grounded in feedback, and generate shareable Voice-of-Customer reports. Its server-side API routes enforce workspace and role access while coordinating persistence and AI services. The README documents the overall browser-to-API architecture; source excerpts confirm several route-level calls. Other feature connections are omitted where the sampled source does not show the exact request wiring.

Main entry points: [`lib/db.ts`](https://github.com/falekartik418/project-loop/blob/main/lib/db.ts) (Prisma client), [`lib/ai.ts`](https://github.com/falekartik418/project-loop/blob/main/lib/ai.ts) (AI capabilities), [`app/api/feedback/route.ts`](https://github.com/falekartik418/project-loop/blob/main/app/api/feedback/route.ts) (Feedback intake), [`app/api/ask/route.ts`](https://github.com/falekartik418/project-loop/blob/main/app/api/ask/route.ts) (Grounded Q&A)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_feedback_ui["Feedback inbox<br/>[page.tsx]"]
  node_dashboard_ui["Analytics dashboard<br/>[page.tsx]"]
  node_trends_ui["Trend explorer<br/>[page.tsx]"]
  node_themes_ui["Theme manager<br/>[page.tsx]"]
  node_ask_ui["Ask LOOP<br/>[page.tsx]"]
  node_reports_ui["VOC reports<br/>[page.tsx]"]
  node_workspace_ui["Workspace settings<br/>[page.tsx]"]
  node_members_ui["Member management<br/>[page.tsx]"]
end

subgraph group_feedback["Feedback intelligence"]
  node_feedback_api["Feedback intake<br/>[route.ts]"]
  node_import_api["CSV ingestion<br/>[route.ts]"]
  node_insights_api["Dashboard analytics<br/>[route.ts]"]
  node_trends_api["Theme trends<br/>[route.ts]"]
  node_ask_api["Grounded Q&amp;A<br/>[route.ts]"]
  node_reports_api["Report generation<br/>[route.ts]"]
  node_themes_api["Theme routes"]
end

subgraph group_workspace["Workspace operations"]
  node_workspace_api["Workspace routes"]
end

subgraph group_services["Platform services"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_guards["Session and role guards<br/>[guard.ts]"]
  node_ai["AI capabilities<br/>[ai.ts]"]
  node_search["Semantic retrieval<br/>[search.ts]"]
  node_db["Prisma client<br/>[db.ts]"]
end

node_user(("Workspace user"))
node_database[("PostgreSQL")]
node_gemini["Google Gemini"]

node_user -->|"submits feedback"| node_feedback_ui
node_user -->|"asks questions"| node_ask_ui
node_user -->|"requests reports"| node_reports_ui
node_feedback_ui -->|"uses app API"| node_feedback_api
node_dashboard_ui -->|"uses app API"| node_insights_api
node_trends_ui -->|"uses app API"| node_trends_api
node_themes_ui -->|"uses app API"| node_themes_api
node_ask_ui -->|"uses app API"| node_ask_api
node_reports_ui -->|"uses app API"| node_reports_api
node_workspace_ui -->|"uses app API"| node_workspace_api
node_members_ui -->|"uses app API"| node_workspace_api
node_feedback_api -->|"checks roles"| node_guards
node_feedback_api -->|"classifies and embeds"| node_ai
node_import_api -->|"classifies feedback"| node_ai
node_ask_api -->|"answers questions"| node_ai
node_ask_api -->|"retrieves context"| node_search
node_reports_api -->|"generates narrative"| node_ai
node_reports_api -->|"reads and writes"| node_db
node_feedback_api -->|"reads and writes"| node_db
node_insights_api -->|"queries metrics"| node_db
node_trends_api -->|"queries themes"| node_db
node_themes_api -->|"persists themes"| node_db
node_workspace_api -->|"persists workspace data"| node_db
node_db -->|"queries"| node_database
node_ai -->|"calls model API"| node_gemini
node_search -->|"embeds queries"| node_ai
node_search -->|"retrieves feedback"| node_db
node_guards -->|"loads session"| node_auth
node_auth -->|"looks up user"| node_db

click node_feedback_ui "https://github.com/falekartik418/project-loop/blob/main/app/feedback/page.tsx"
click node_dashboard_ui "https://github.com/falekartik418/project-loop/blob/main/app/dashboard/page.tsx"
click node_trends_ui "https://github.com/falekartik418/project-loop/blob/main/app/trends/page.tsx"
click node_themes_ui "https://github.com/falekartik418/project-loop/blob/main/app/themes/page.tsx"
click node_ask_ui "https://github.com/falekartik418/project-loop/blob/main/app/ask/page.tsx"
click node_reports_ui "https://github.com/falekartik418/project-loop/blob/main/app/reports/page.tsx"
click node_workspace_ui "https://github.com/falekartik418/project-loop/blob/main/app/workspace/page.tsx"
click node_members_ui "https://github.com/falekartik418/project-loop/blob/main/app/members/page.tsx"
click node_feedback_api "https://github.com/falekartik418/project-loop/blob/main/app/api/feedback/route.ts"
click node_import_api "https://github.com/falekartik418/project-loop/blob/main/app/api/feedback/import/route.ts"
click node_insights_api "https://github.com/falekartik418/project-loop/blob/main/app/api/insights/route.ts"
click node_trends_api "https://github.com/falekartik418/project-loop/blob/main/app/api/trends/route.ts"
click node_ask_api "https://github.com/falekartik418/project-loop/blob/main/app/api/ask/route.ts"
click node_reports_api "https://github.com/falekartik418/project-loop/blob/main/app/api/reports/route.ts"
click node_workspace_api "https://github.com/falekartik418/project-loop/tree/main/app/api/workspace"
click node_themes_api "https://github.com/falekartik418/project-loop/tree/main/app/api/themes"
click node_auth "https://github.com/falekartik418/project-loop/blob/main/lib/auth.ts"
click node_guards "https://github.com/falekartik418/project-loop/blob/main/lib/guard.ts"
click node_ai "https://github.com/falekartik418/project-loop/blob/main/lib/ai.ts"
click node_search "https://github.com/falekartik418/project-loop/blob/main/lib/search.ts"
click node_db "https://github.com/falekartik418/project-loop/blob/main/lib/db.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_feedback_ui,node_dashboard_ui,node_trends_ui,node_themes_ui,node_ask_ui,node_reports_ui,node_workspace_ui,node_members_ui,node_user toneBlue
class node_feedback_api,node_import_api,node_insights_api,node_trends_api,node_ask_api,node_reports_api,node_themes_api,node_database toneAmber
class node_workspace_api toneMint
class node_auth,node_guards,node_ai,node_search,node_db toneRose
class node_gemini toneIndigo
```

## Components

### User experience

- [Feedback inbox](https://github.com/falekartik418/project-loop/blob/main/app/feedback/page.tsx): `app/feedback/page.tsx`
- [Analytics dashboard](https://github.com/falekartik418/project-loop/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Trend explorer](https://github.com/falekartik418/project-loop/blob/main/app/trends/page.tsx): `app/trends/page.tsx`
- [Theme manager](https://github.com/falekartik418/project-loop/blob/main/app/themes/page.tsx): `app/themes/page.tsx`
- [Ask LOOP](https://github.com/falekartik418/project-loop/blob/main/app/ask/page.tsx): `app/ask/page.tsx`
- [VOC reports](https://github.com/falekartik418/project-loop/blob/main/app/reports/page.tsx): `app/reports/page.tsx`
- [Workspace settings](https://github.com/falekartik418/project-loop/blob/main/app/workspace/page.tsx): `app/workspace/page.tsx`
- [Member management](https://github.com/falekartik418/project-loop/blob/main/app/members/page.tsx): `app/members/page.tsx`

### Feedback intelligence

- [Feedback intake](https://github.com/falekartik418/project-loop/blob/main/app/api/feedback/route.ts): `app/api/feedback/route.ts`
- [CSV ingestion](https://github.com/falekartik418/project-loop/blob/main/app/api/feedback/import/route.ts): `app/api/feedback/import/route.ts`
- [Dashboard analytics](https://github.com/falekartik418/project-loop/blob/main/app/api/insights/route.ts): `app/api/insights/route.ts`
- [Theme trends](https://github.com/falekartik418/project-loop/blob/main/app/api/trends/route.ts): `app/api/trends/route.ts`
- [Grounded Q&A](https://github.com/falekartik418/project-loop/blob/main/app/api/ask/route.ts): `app/api/ask/route.ts`
- [Report generation](https://github.com/falekartik418/project-loop/blob/main/app/api/reports/route.ts): `app/api/reports/route.ts`
- [Theme routes](https://github.com/falekartik418/project-loop/tree/main/app/api/themes): `app/api/themes`

### Workspace operations

- [Workspace routes](https://github.com/falekartik418/project-loop/tree/main/app/api/workspace): `app/api/workspace`

### Platform services

- [Authentication](https://github.com/falekartik418/project-loop/blob/main/lib/auth.ts): `lib/auth.ts`
- [Session and role guards](https://github.com/falekartik418/project-loop/blob/main/lib/guard.ts): `lib/guard.ts`
- [AI capabilities](https://github.com/falekartik418/project-loop/blob/main/lib/ai.ts): `lib/ai.ts`
- [Semantic retrieval](https://github.com/falekartik418/project-loop/blob/main/lib/search.ts): `lib/search.ts`
- [Prisma client](https://github.com/falekartik418/project-loop/blob/main/lib/db.ts): `lib/db.ts`

### Other components

- **Workspace user**
- **PostgreSQL**
- **Google Gemini**

## Connections

- Workspace user → Feedback inbox: submits feedback
- Workspace user → Ask LOOP: asks questions
- Workspace user → VOC reports: requests reports
- Feedback inbox → Feedback intake: uses app API
- Analytics dashboard → Dashboard analytics: uses app API
- Trend explorer → Theme trends: uses app API
- Theme manager → Theme routes: uses app API
- Ask LOOP → Grounded Q&A: uses app API
- VOC reports → Report generation: uses app API
- Workspace settings → Workspace routes: uses app API
- Member management → Workspace routes: uses app API
- Feedback intake → Session and role guards: checks roles (evidence: `app/api/feedback/route.ts`)
- Feedback intake → AI capabilities: classifies and embeds (evidence: `app/api/feedback/route.ts`)
- CSV ingestion → AI capabilities: classifies feedback (evidence: `app/api/feedback/import/route.ts`)
- Grounded Q&A → AI capabilities: answers questions (evidence: `app/api/ask/route.ts`)
- Grounded Q&A → Semantic retrieval: retrieves context
- Report generation → AI capabilities: generates narrative (evidence: `app/api/reports/route.ts`)
- Report generation → Prisma client: reads and writes (evidence: `app/api/reports/route.ts`)
- Feedback intake → Prisma client: reads and writes (evidence: `app/api/feedback/route.ts`)
- Dashboard analytics → Prisma client: queries metrics (evidence: `app/api/insights/route.ts`)
- Theme trends → Prisma client: queries themes (evidence: `app/api/trends/route.ts`)
- Theme routes → Prisma client: persists themes (evidence: `app/api/themes/route.ts`)
- Workspace routes → Prisma client: persists workspace data (evidence: `app/api/workspace/route.ts`)
- Prisma client → PostgreSQL: queries
- AI capabilities → Google Gemini: calls model API (evidence: `lib/ai.ts`)
- Semantic retrieval → AI capabilities: embeds queries (evidence: `lib/search.ts`)
- Semantic retrieval → Prisma client: retrieves feedback (evidence: `lib/search.ts`)
- Session and role guards → Authentication: loads session (evidence: `lib/guard.ts`)
- Authentication → Prisma client: looks up user (evidence: `lib/auth.ts`)
