# rushikesh5035/summarist-ai architecture

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

- Interactive diagram: https://gitdiagram.com/rushikesh5035/summarist-ai
- Repository: https://github.com/rushikesh5035/summarist-ai

## Overview

Summarist.ai is a PDF-understanding SaaS: an authenticated user uploads a document, chooses summary or chat, and gets saved insights or a document conversation. The synchronous summary path and chat setup are visible in the dashboard excerpt; chat requests perform retrieval-augmented generation in the API route. README capabilities also include asynchronous processing with live progress, a unified vault, exports, usage tiers, and billing. Several of those implementations were not sampled, so their paths use supported enclosing directories and their connections are documented rather than inferred from imports.

Main entry points: [`app/(logged-in)/dashboard/DashboardClient.tsx`](https://github.com/rushikesh5035/summarist-ai/blob/main/app/(logged-in)/dashboard/DashboardClient.tsx) (Upload dashboard), [`app/api/chat/[id]/route.ts`](https://github.com/rushikesh5035/summarist-ai/blob/main/app/api/chat/%5Bid%5D/route.ts) (Chat API and retrieval), [`db/schema.ts`](https://github.com/rushikesh5035/summarist-ai/blob/main/db/schema.ts) (Postgres and pgvector), [`lib/payments.ts`](https://github.com/rushikesh5035/summarist-ai/blob/main/lib/payments.ts) (Polar billing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Product experience"]
  node_dashboard["Upload dashboard"]
  node_summary["Summary viewer"]
  node_chatui["PDF chat UI<br/>[ChatPage.tsx]"]
  node_vault["Unified vault"]
end

subgraph group_document["Document workflows"]
  node_upload["PDF upload<br/>[uploadthing.ts]"]
  node_summaryactions["Summary generation<br/>[upload-actions.ts]"]
  node_chatsetup["Chat setup<br/>[chat-actions.ts]"]
  node_background["Async PDF processing<br/>[chatPdfInFun.ts]"]
  node_chatapi["Chat API and retrieval<br/>[route.ts]"]
  node_ai["Gemini models<br/>[geminiai.ts]"]
  node_uploadthing["UploadThing service"]
  node_inngest["Inngest service<br/>[client.ts]"]
end

subgraph group_platform["Data and identity"]
  node_chatdata["Chat and vector helpers<br/>[chat-pdf.ts]"]
  node_summaries["Summary helpers<br/>[summaries.ts]"]
  node_database[("Postgres and pgvector<br/>[schema.ts]")]
  node_identity["Clerk identity<br/>[route.ts]"]
end

subgraph group_commercial["Plans and billing"]
  node_plans["Credits and usage limits<br/>[credits.ts]"]
  node_billing["Polar billing<br/>[payments.ts]"]
  node_polar["Polar service"]
end

node_user(("PDF user"))

node_user -->|"uploads PDF"| node_dashboard
node_dashboard -->|"starts upload"| node_upload
node_upload -.->|"stores file"| node_uploadthing
node_dashboard -->|"requests summary"| node_summaryactions
node_summaryactions -.->|"saves result"| node_summary
node_dashboard -->|"starts chat"| node_chatsetup
node_chatsetup -.->|"queues processing"| node_background
node_background -.->|"runs durable job"| node_inngest
node_user -.->|"asks question"| node_chatui
node_chatui -.->|"sends message"| node_chatapi
node_chatapi -->|"retrieves chunks"| node_chatdata
node_chatapi -->|"embeds and answers"| node_ai
node_chatapi -.->|"stores messages"| node_database
node_chatdata -.->|"searches vectors"| node_database
node_user -.->|"opens saved work"| node_vault
node_summary -.->|"exports insights"| node_user
node_identity -.->|"syncs identity"| node_database
node_user -.->|"uses plan quota"| node_plans
node_user -.->|"manages subscription"| node_billing
node_billing -->|"opens billing portal"| node_polar
node_billing -->|"loads customer id"| node_database

click node_dashboard "https://github.com/rushikesh5035/summarist-ai/blob/main/app/(logged-in)/dashboard/DashboardClient.tsx"
click node_summary "https://github.com/rushikesh5035/summarist-ai/tree/main/components/summaries"
click node_chatui "https://github.com/rushikesh5035/summarist-ai/blob/main/components/chat/ChatPage.tsx"
click node_vault "https://github.com/rushikesh5035/summarist-ai/tree/main/components/vault"
click node_upload "https://github.com/rushikesh5035/summarist-ai/blob/main/utils/uploadthing.ts"
click node_summaryactions "https://github.com/rushikesh5035/summarist-ai/blob/main/actions/upload-actions.ts"
click node_chatsetup "https://github.com/rushikesh5035/summarist-ai/blob/main/actions/chat-actions.ts"
click node_background "https://github.com/rushikesh5035/summarist-ai/blob/main/inngest/functions/chatPdfInFun.ts"
click node_chatapi "https://github.com/rushikesh5035/summarist-ai/blob/main/app/api/chat/%5Bid%5D/route.ts"
click node_ai "https://github.com/rushikesh5035/summarist-ai/blob/main/lib/geminiai.ts"
click node_chatdata "https://github.com/rushikesh5035/summarist-ai/blob/main/lib/chat-pdf.ts"
click node_summaries "https://github.com/rushikesh5035/summarist-ai/blob/main/lib/summaries.ts"
click node_database "https://github.com/rushikesh5035/summarist-ai/blob/main/db/schema.ts"
click node_identity "https://github.com/rushikesh5035/summarist-ai/blob/main/app/api/webhooks/clerk/route.ts"
click node_plans "https://github.com/rushikesh5035/summarist-ai/blob/main/lib/credits.ts"
click node_billing "https://github.com/rushikesh5035/summarist-ai/blob/main/lib/payments.ts"
click node_inngest "https://github.com/rushikesh5035/summarist-ai/blob/main/inngest/client.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_dashboard,node_summary,node_chatui,node_vault,node_user toneBlue
class node_upload,node_summaryactions,node_chatsetup,node_background,node_chatapi,node_ai,node_uploadthing,node_inngest toneAmber
class node_chatdata,node_summaries,node_database,node_identity toneMint
class node_plans,node_billing,node_polar toneRose
```

## Components

### Product experience

- [Upload dashboard](https://github.com/rushikesh5035/summarist-ai/blob/main/app/(logged-in)/dashboard/DashboardClient.tsx): `app/(logged-in)/dashboard/DashboardClient.tsx`
- [Summary viewer](https://github.com/rushikesh5035/summarist-ai/tree/main/components/summaries): `components/summaries`
- [PDF chat UI](https://github.com/rushikesh5035/summarist-ai/blob/main/components/chat/ChatPage.tsx): `components/chat/ChatPage.tsx`
- [Unified vault](https://github.com/rushikesh5035/summarist-ai/tree/main/components/vault): `components/vault`

### Document workflows

- [PDF upload](https://github.com/rushikesh5035/summarist-ai/blob/main/utils/uploadthing.ts): `utils/uploadthing.ts`
- [Summary generation](https://github.com/rushikesh5035/summarist-ai/blob/main/actions/upload-actions.ts): `actions/upload-actions.ts`
- [Chat setup](https://github.com/rushikesh5035/summarist-ai/blob/main/actions/chat-actions.ts): `actions/chat-actions.ts`
- [Async PDF processing](https://github.com/rushikesh5035/summarist-ai/blob/main/inngest/functions/chatPdfInFun.ts): `inngest/functions/chatPdfInFun.ts`
- [Chat API and retrieval](https://github.com/rushikesh5035/summarist-ai/blob/main/app/api/chat/%5Bid%5D/route.ts): `app/api/chat/[id]/route.ts`
- [Gemini models](https://github.com/rushikesh5035/summarist-ai/blob/main/lib/geminiai.ts): `lib/geminiai.ts`
- **UploadThing service**
- [Inngest service](https://github.com/rushikesh5035/summarist-ai/blob/main/inngest/client.ts): `inngest/client.ts`

### Data and identity

- [Chat and vector helpers](https://github.com/rushikesh5035/summarist-ai/blob/main/lib/chat-pdf.ts): `lib/chat-pdf.ts`
- [Summary helpers](https://github.com/rushikesh5035/summarist-ai/blob/main/lib/summaries.ts): `lib/summaries.ts`
- [Postgres and pgvector](https://github.com/rushikesh5035/summarist-ai/blob/main/db/schema.ts): `db/schema.ts`
- [Clerk identity](https://github.com/rushikesh5035/summarist-ai/blob/main/app/api/webhooks/clerk/route.ts): `app/api/webhooks/clerk/route.ts`

### Plans and billing

- [Credits and usage limits](https://github.com/rushikesh5035/summarist-ai/blob/main/lib/credits.ts): `lib/credits.ts`
- [Polar billing](https://github.com/rushikesh5035/summarist-ai/blob/main/lib/payments.ts): `lib/payments.ts`
- **Polar service**

### Other components

- **PDF user**

## Connections

- PDF user → Upload dashboard: uploads PDF (evidence: `app/(logged-in)/dashboard/DashboardClient.tsx`)
- Upload dashboard → PDF upload: starts upload (evidence: `app/(logged-in)/dashboard/DashboardClient.tsx`)
- PDF upload → UploadThing service: stores file (evidence: `README.md`)
- Upload dashboard → Summary generation: requests summary (evidence: `app/(logged-in)/dashboard/DashboardClient.tsx`)
- Summary generation → Summary viewer: saves result (evidence: `README.md`)
- Upload dashboard → Chat setup: starts chat (evidence: `app/(logged-in)/dashboard/DashboardClient.tsx`)
- Chat setup → Async PDF processing: queues processing (evidence: `README.md`)
- Async PDF processing → Inngest service: runs durable job (evidence: `README.md`)
- PDF user → PDF chat UI: asks question (evidence: `README.md`)
- PDF chat UI → Chat API and retrieval: sends message (evidence: `README.md`)
- Chat API and retrieval → Chat and vector helpers: retrieves chunks (evidence: `app/api/chat/[id]/route.ts`)
- Chat API and retrieval → Gemini models: embeds and answers (evidence: `app/api/chat/[id]/route.ts`)
- Chat API and retrieval → Postgres and pgvector: stores messages (evidence: `README.md`)
- Chat and vector helpers → Postgres and pgvector: searches vectors (evidence: `README.md`)
- PDF user → Unified vault: opens saved work (evidence: `README.md`)
- Summary viewer → PDF user: exports insights (evidence: `README.md`)
- Clerk identity → Postgres and pgvector: syncs identity (evidence: `README.md`)
- PDF user → Credits and usage limits: uses plan quota (evidence: `README.md`)
- PDF user → Polar billing: manages subscription (evidence: `README.md`)
- Polar billing → Polar service: opens billing portal
- Polar billing → Postgres and pgvector: loads customer id
