# xerav-dev/clausewatch architecture

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

- Interactive diagram: https://gitdiagram.com/xerav-dev/clausewatch
- Repository: https://github.com/xerav-dev/clausewatch

## Overview

ClauseWatch is an AI-assisted contract review web app. A user uploads a PDF or submits demo text; the page sends it to an analysis route, which extracts PDF text when needed and asks Gemini for structured clause risks and an overall decision. The page then presents processing status and a review dashboard with clause details and decision information. The README is only the default Next.js starter guide, so it documents no additional product capabilities. Some route and page excerpts are partial; edges below are limited to relationships visible in the excerpts.

Main entry points: [`app/page.tsx`](https://github.com/xerav-dev/clausewatch/blob/main/app/page.tsx) (Analysis workflow), [`app/api/analyze/route.ts`](https://github.com/xerav-dev/clausewatch/blob/main/app/api/analyze/route.ts) (Analysis API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_intake["Upload and demo<br/>[page.tsx]"]
  node_workflow["Analysis workflow<br/>[page.tsx]"]
  node_progress["Processing view<br/>[page.tsx]"]
  node_review["Review dashboard<br/>[page.tsx]"]
  node_decision["Decision summary<br/>[page.tsx]"]
  node_clause_review["Clause review<br/>[page.tsx]"]
end

subgraph group_analysis["Contract analysis"]
  node_analyze_api["Analysis API<br/>[route.ts]"]
  node_pdf_text["PDF text extraction<br/>[route.ts]"]
  node_gemini["Gemini model"]
end

node_user(("Contract reviewer"))

node_user -->|"submits contract"| node_intake
node_intake -->|"passes input"| node_workflow
node_workflow -->|"POSTs input"| node_analyze_api
node_analyze_api -->|"extracts PDF text"| node_pdf_text
node_analyze_api -->|"requests analysis"| node_gemini
node_workflow -->|"shows status"| node_progress
node_workflow -->|"routes after analysis"| node_review
node_review -->|"shows decision"| node_decision
node_review -->|"shows clauses"| node_clause_review

click node_intake "https://github.com/xerav-dev/clausewatch/blob/main/app/page.tsx"
click node_workflow "https://github.com/xerav-dev/clausewatch/blob/main/app/page.tsx"
click node_progress "https://github.com/xerav-dev/clausewatch/blob/main/app/page.tsx"
click node_review "https://github.com/xerav-dev/clausewatch/blob/main/app/page.tsx"
click node_decision "https://github.com/xerav-dev/clausewatch/blob/main/app/page.tsx"
click node_clause_review "https://github.com/xerav-dev/clausewatch/blob/main/app/page.tsx"
click node_analyze_api "https://github.com/xerav-dev/clausewatch/blob/main/app/api/analyze/route.ts"
click node_pdf_text "https://github.com/xerav-dev/clausewatch/blob/main/app/api/analyze/route.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_intake,node_workflow,node_progress,node_review,node_decision,node_clause_review,node_user toneBlue
class node_analyze_api,node_pdf_text,node_gemini toneAmber
```

## Components

### User experience

- [Upload and demo](https://github.com/xerav-dev/clausewatch/blob/main/app/page.tsx): `app/page.tsx`
- [Analysis workflow](https://github.com/xerav-dev/clausewatch/blob/main/app/page.tsx): `app/page.tsx`
- [Processing view](https://github.com/xerav-dev/clausewatch/blob/main/app/page.tsx): `app/page.tsx`
- [Review dashboard](https://github.com/xerav-dev/clausewatch/blob/main/app/page.tsx): `app/page.tsx`
- [Decision summary](https://github.com/xerav-dev/clausewatch/blob/main/app/page.tsx): `app/page.tsx`
- [Clause review](https://github.com/xerav-dev/clausewatch/blob/main/app/page.tsx): `app/page.tsx`

### Contract analysis

- [Analysis API](https://github.com/xerav-dev/clausewatch/blob/main/app/api/analyze/route.ts): `app/api/analyze/route.ts`
- [PDF text extraction](https://github.com/xerav-dev/clausewatch/blob/main/app/api/analyze/route.ts): `app/api/analyze/route.ts`
- **Gemini model**

### Other components

- **Contract reviewer**

## Connections

- Contract reviewer → Upload and demo: submits contract (evidence: `app/page.tsx`)
- Upload and demo → Analysis workflow: passes input (evidence: `app/page.tsx`)
- Analysis workflow → Analysis API: POSTs input (evidence: `app/page.tsx`)
- Analysis API → PDF text extraction: extracts PDF text (evidence: `app/api/analyze/route.ts`)
- Analysis API → Gemini model: requests analysis (evidence: `app/api/analyze/route.ts`)
- Analysis workflow → Processing view: shows status (evidence: `app/page.tsx`)
- Analysis workflow → Review dashboard: routes after analysis (evidence: `app/page.tsx`)
- Review dashboard → Decision summary: shows decision (evidence: `app/page.tsx`)
- Review dashboard → Clause review: shows clauses (evidence: `app/page.tsx`)
