# thisismendez/blueline architecture

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

- Interactive diagram: https://gitdiagram.com/thisismendez/blueline
- Repository: https://github.com/thisismendez/blueline

## Overview

Blueline Lease is a renter-first residential lease review app that also supports landlords. The main workflow is: a person supplies lease text (including browser-extracted selectable PDF text), the app checks that the packet is a complete residential lease, analyzes it for role-specific risks and citations, then presents a report that can remain ephemeral or be saved to an account. Separate capabilities include asking questions about a packet, matching saved personal red lines, and managing saved reviews. Some UI and integration details are documented rather than shown in source excerpts; those relationships cite the README or are omitted.

Main entry points: [`src/app/api/analysis/route.ts`](https://github.com/thisismendez/blueline/blob/main/src/app/api/analysis/route.ts) (Analysis endpoint), [`src/features/analysis/model/structured.ts`](https://github.com/thisismendez/blueline/blob/main/src/features/analysis/model/structured.ts) (Structured model calls), [`src/features/analysis/review.ts`](https://github.com/thisismendez/blueline/blob/main/src/features/analysis/review.ts) (Lease review), [`src/features/packet/completeness.ts`](https://github.com/thisismendez/blueline/blob/main/src/features/packet/completeness.ts) (Packet completeness)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Review intake"]
  node_document_intake["Document intake<br/>[DocumentIntake.tsx]"]
  node_packet["Text packet<br/>[types.ts]"]
  node_completeness["Packet completeness<br/>[completeness.ts]"]
  node_identity["Reference identity"]
end

subgraph group_analysis["Lease analysis"]
  node_review_pipeline["Lease review<br/>[review.ts]"]
  node_model_calls["Structured model calls<br/>[structured.ts]"]
  node_model_provider["OpenRouter provider<br/>[openrouter.ts]"]
  node_verification["Citation verification<br/>[verify.ts]"]
  node_coverage["Coverage checklist<br/>[checklist.ts]"]
end

subgraph group_results["Review tools"]
  node_report["Review report<br/>[ReviewResult.tsx]"]
  node_questions["Lease Q&amp;A<br/>[route.ts]"]
  node_redlines["Personal red lines<br/>[routes.ts]"]
end

subgraph group_accounts["Accounts and library"]
  node_auth["Account identity<br/>[session.ts]"]
  node_review_store["Review storage<br/>[store.ts]"]
  node_supabase_store[("Supabase review store<br/>[supabase-store.ts]")]
  node_continuation["Guest continuation<br/>[continuation.ts]"]
end

subgraph group_platform["Application entry points"]
  node_review_ui["Review experience<br/>[page.tsx]"]
  node_analysis_api["Analysis endpoint<br/>[route.ts]"]
end

node_visitor(("Lease reviewer"))
node_supabase_auth["Supabase authentication"]

node_visitor -->|"starts review"| node_review_ui
node_review_ui -->|"collects text"| node_document_intake
node_document_intake -.->|"builds packet"| node_packet
node_document_intake -->|"submits text"| node_analysis_api
node_analysis_api -->|"checks packet"| node_completeness
node_completeness -->|"groups references"| node_identity
node_analysis_api -->|"runs review"| node_review_pipeline
node_completeness -->|"requests structured output"| node_model_calls
node_review_pipeline -->|"requests model output"| node_model_calls
node_model_provider -.->|"implements model port"| node_model_calls
node_review_pipeline -->|"verifies citations"| node_verification
node_review_pipeline -->|"assesses topics"| node_coverage
node_analysis_api -->|"persists eligible review"| node_review_store
node_analysis_api -->|"issues continuation"| node_continuation
node_review_ui -.->|"shows result"| node_report
node_visitor -->|"asks about packet"| node_questions
node_questions -->|"checks packet"| node_completeness
node_questions -->|"requests answer"| node_model_calls
node_visitor -->|"manages preferences"| node_redlines
node_redlines -->|"loads owned review"| node_review_store
node_redlines -.->|"matches clauses"| node_model_calls
node_analysis_api -->|"resolves account state"| node_auth
node_auth -->|"validates user"| node_supabase_auth
node_review_store -.->|"implemented by"| node_supabase_store
node_supabase_store -->|"creates server client"| node_supabase_auth

click node_review_ui "https://github.com/thisismendez/blueline/blob/main/src/app/(app)/review/page.tsx"
click node_document_intake "https://github.com/thisismendez/blueline/blob/main/src/features/review/components/DocumentIntake.tsx"
click node_packet "https://github.com/thisismendez/blueline/blob/main/src/features/packet/types.ts"
click node_analysis_api "https://github.com/thisismendez/blueline/blob/main/src/app/api/analysis/route.ts"
click node_completeness "https://github.com/thisismendez/blueline/blob/main/src/features/packet/completeness.ts"
click node_identity "https://github.com/thisismendez/blueline/blob/main/src/features/packet/reference-identity.ts"
click node_review_pipeline "https://github.com/thisismendez/blueline/blob/main/src/features/analysis/review.ts"
click node_model_calls "https://github.com/thisismendez/blueline/blob/main/src/features/analysis/model/structured.ts"
click node_model_provider "https://github.com/thisismendez/blueline/blob/main/src/features/analysis/model/openrouter.ts"
click node_verification "https://github.com/thisismendez/blueline/blob/main/src/features/analysis/verify.ts"
click node_coverage "https://github.com/thisismendez/blueline/blob/main/src/features/analysis/checklist.ts"
click node_report "https://github.com/thisismendez/blueline/blob/main/src/features/review/components/ReviewResult.tsx"
click node_questions "https://github.com/thisismendez/blueline/blob/main/src/features/questions/route.ts"
click node_redlines "https://github.com/thisismendez/blueline/blob/main/src/features/red-lines/routes.ts"
click node_auth "https://github.com/thisismendez/blueline/blob/main/src/features/auth/session.ts"
click node_review_store "https://github.com/thisismendez/blueline/blob/main/src/features/library/store.ts"
click node_supabase_store "https://github.com/thisismendez/blueline/blob/main/src/features/library/supabase-store.ts"
click node_continuation "https://github.com/thisismendez/blueline/blob/main/src/features/review/session/continuation.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_document_intake,node_packet,node_completeness,node_identity,node_visitor toneBlue
class node_review_pipeline,node_model_calls,node_model_provider,node_verification,node_coverage toneAmber
class node_report,node_questions,node_redlines toneMint
class node_auth,node_review_store,node_supabase_store,node_continuation toneRose
class node_review_ui,node_analysis_api,node_supabase_auth toneIndigo
```

## Components

### Review intake

- [Document intake](https://github.com/thisismendez/blueline/blob/main/src/features/review/components/DocumentIntake.tsx): `src/features/review/components/DocumentIntake.tsx`
- [Text packet](https://github.com/thisismendez/blueline/blob/main/src/features/packet/types.ts): `src/features/packet/types.ts`
- [Packet completeness](https://github.com/thisismendez/blueline/blob/main/src/features/packet/completeness.ts): `src/features/packet/completeness.ts`
- [Reference identity](https://github.com/thisismendez/blueline/blob/main/src/features/packet/reference-identity.ts): `src/features/packet/reference-identity.ts`

### Lease analysis

- [Lease review](https://github.com/thisismendez/blueline/blob/main/src/features/analysis/review.ts): `src/features/analysis/review.ts`
- [Structured model calls](https://github.com/thisismendez/blueline/blob/main/src/features/analysis/model/structured.ts): `src/features/analysis/model/structured.ts`
- [OpenRouter provider](https://github.com/thisismendez/blueline/blob/main/src/features/analysis/model/openrouter.ts): `src/features/analysis/model/openrouter.ts`
- [Citation verification](https://github.com/thisismendez/blueline/blob/main/src/features/analysis/verify.ts): `src/features/analysis/verify.ts`
- [Coverage checklist](https://github.com/thisismendez/blueline/blob/main/src/features/analysis/checklist.ts): `src/features/analysis/checklist.ts`

### Review tools

- [Review report](https://github.com/thisismendez/blueline/blob/main/src/features/review/components/ReviewResult.tsx): `src/features/review/components/ReviewResult.tsx`
- [Lease Q&A](https://github.com/thisismendez/blueline/blob/main/src/features/questions/route.ts): `src/features/questions/route.ts`
- [Personal red lines](https://github.com/thisismendez/blueline/blob/main/src/features/red-lines/routes.ts): `src/features/red-lines/routes.ts`

### Accounts and library

- [Account identity](https://github.com/thisismendez/blueline/blob/main/src/features/auth/session.ts): `src/features/auth/session.ts`
- [Review storage](https://github.com/thisismendez/blueline/blob/main/src/features/library/store.ts): `src/features/library/store.ts`
- [Supabase review store](https://github.com/thisismendez/blueline/blob/main/src/features/library/supabase-store.ts): `src/features/library/supabase-store.ts`
- [Guest continuation](https://github.com/thisismendez/blueline/blob/main/src/features/review/session/continuation.ts): `src/features/review/session/continuation.ts`

### Application entry points

- [Review experience](https://github.com/thisismendez/blueline/blob/main/src/app/(app)/review/page.tsx): `src/app/(app)/review/page.tsx`
- [Analysis endpoint](https://github.com/thisismendez/blueline/blob/main/src/app/api/analysis/route.ts): `src/app/api/analysis/route.ts`

### Other components

- **Lease reviewer**
- **Supabase authentication**

## Connections

- Lease reviewer → Review experience: starts review (evidence: `README.md`)
- Review experience → Document intake: collects text (evidence: `README.md`)
- Document intake → Text packet: builds packet
- Document intake → Analysis endpoint: submits text (evidence: `README.md`)
- Analysis endpoint → Packet completeness: checks packet
- Packet completeness → Reference identity: groups references (evidence: `src/features/packet/completeness.ts`)
- Analysis endpoint → Lease review: runs review
- Packet completeness → Structured model calls: requests structured output (evidence: `src/features/packet/completeness.ts`)
- Lease review → Structured model calls: requests model output (evidence: `src/features/analysis/review.ts`)
- OpenRouter provider → Structured model calls: implements model port
- Lease review → Citation verification: verifies citations (evidence: `src/features/analysis/review.ts`)
- Lease review → Coverage checklist: assesses topics (evidence: `src/features/analysis/review.ts`)
- Analysis endpoint → Review storage: persists eligible review
- Analysis endpoint → Guest continuation: issues continuation
- Review experience → Review report: shows result
- Lease reviewer → Lease Q&A: asks about packet (evidence: `src/features/questions/route.ts`)
- Lease Q&A → Packet completeness: checks packet (evidence: `src/features/questions/route.ts`)
- Lease Q&A → Structured model calls: requests answer (evidence: `src/features/questions/route.ts`)
- Lease reviewer → Personal red lines: manages preferences (evidence: `src/features/red-lines/routes.ts`)
- Personal red lines → Review storage: loads owned review (evidence: `src/features/red-lines/routes.ts`)
- Personal red lines → Structured model calls: matches clauses
- Analysis endpoint → Account identity: resolves account state
- Account identity → Supabase authentication: validates user (evidence: `src/features/auth/session.ts`)
- Review storage → Supabase review store: implemented by (evidence: `src/features/library/supabase-store.ts`)
- Supabase review store → Supabase authentication: creates server client (evidence: `src/features/library/supabase-store.ts`)
