# shreytiwari790-arch/redline_backup architecture

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

- Interactive diagram: https://gitdiagram.com/shreytiwari790-arch/redline_backup
- Repository: https://github.com/shreytiwari790-arch/redline_backup

## Overview

Redline is a contract-review application for freelancers. Users start a review, upload a contract, inspect an analysis in a dashboard, and can save or reopen contracts through the library. The dashboard separates risk review, summaries, suggestions, market comparisons, plain-language explanations, and negotiation guidance. The provided excerpts establish the frontend navigation, analysis state, authentication, and Firestore contract operations. Backend function files are listed but their implementation details are not shown, so their connections to the upload workflow are left unasserted.

Main entry points: [`src/screens/Dashboard.tsx`](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/Dashboard.tsx) (Review dashboard), [`src/App.tsx`](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/App.tsx) (App navigation), [`src/AnalysisContext.tsx`](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/AnalysisContext.tsx) (Analysis state), [`src/lib/contracts.ts`](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/lib/contracts.ts) (Contract records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_app["App navigation<br/>[App.tsx]"]
  node_landing["Landing page<br/>[Landing.tsx]"]
  node_upload["Contract upload<br/>[Upload.tsx]"]
  node_library["Saved library<br/>[Library.tsx]"]
end

subgraph group_review["Contract review"]
  node_analysis["Analysis state"]
  node_sampledata["Sample analysis data<br/>[data.ts]"]
  node_dashboard["Review dashboard<br/>[Dashboard.tsx]"]
  node_risks["Risk review<br/>[RisksTab.tsx]"]
  node_summary["Summary view<br/>[SummaryTab.tsx]"]
  node_suggestions["Protection suggestions<br/>[SuggestionsTab.tsx]"]
  node_market["Market comparison<br/>[MarketTab.tsx]"]
  node_eli5["Plain-language view<br/>[Eli5Tab.tsx]"]
  node_negotiate["Negotiation guidance<br/>[NegotiateTab.tsx]"]
  node_viewer["Document viewer<br/>[DocumentViewer.tsx]"]
  node_chat["Chat panel<br/>[ChatPanel.tsx]"]
end

subgraph group_identity["Identity and storage"]
  node_authmodal["Sign-in modal<br/>[AuthModal.tsx]"]
  node_auth["Authentication<br/>[AuthContext.tsx]"]
  node_firebase["Firebase setup<br/>[firebase.ts]"]
  node_contracts["Contract records<br/>[contracts.ts]"]
  node_firestore[("Firestore")]
end

subgraph group_backend["Server functions"]
  node_analyzefn["Analysis function<br/>[analyze.ts]"]
  node_chatfn["Chat function<br/>[chat.ts]"]
end

node_user(("Freelancer"))

node_user -->|"visits"| node_landing
node_app -->|"renders"| node_landing
node_app -->|"renders"| node_upload
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_library
node_app -->|"renders"| node_authmodal
node_app -->|"provides state"| node_analysis
node_app -->|"saves and loads"| node_contracts
node_authmodal -->|"requests sign-in"| node_auth
node_auth -->|"uses configuration"| node_firebase
node_contracts -->|"uses connection"| node_firebase
node_contracts -->|"reads and writes"| node_firestore
node_analysis -->|"initializes from"| node_sampledata
node_dashboard -->|"reads review state"| node_analysis
node_dashboard -->|"renders"| node_risks
node_dashboard -->|"renders"| node_summary
node_dashboard -->|"renders"| node_suggestions
node_dashboard -->|"renders"| node_market
node_dashboard -->|"renders"| node_eli5
node_dashboard -->|"renders"| node_negotiate
node_dashboard -->|"renders"| node_viewer
node_dashboard -->|"renders"| node_chat
node_risks -->|"reads review state"| node_analysis

click node_app "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/App.tsx"
click node_landing "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/Landing.tsx"
click node_upload "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/Upload.tsx"
click node_library "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/Library.tsx"
click node_authmodal "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/components/AuthModal.tsx"
click node_auth "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/auth/AuthContext.tsx"
click node_firebase "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/lib/firebase.ts"
click node_contracts "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/lib/contracts.ts"
click node_analysis "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/AnalysisContext.tsx"
click node_sampledata "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/data.ts"
click node_dashboard "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/Dashboard.tsx"
click node_risks "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/dashboard/RisksTab.tsx"
click node_summary "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/dashboard/SummaryTab.tsx"
click node_suggestions "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/dashboard/SuggestionsTab.tsx"
click node_market "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/dashboard/MarketTab.tsx"
click node_eli5 "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/dashboard/Eli5Tab.tsx"
click node_negotiate "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/dashboard/NegotiateTab.tsx"
click node_viewer "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/components/DocumentViewer.tsx"
click node_chat "https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/components/ChatPanel.tsx"
click node_analyzefn "https://github.com/shreytiwari790-arch/redline_backup/blob/main/netlify/functions/analyze.ts"
click node_chatfn "https://github.com/shreytiwari790-arch/redline_backup/blob/main/netlify/functions/chat.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_app,node_landing,node_upload,node_library toneBlue
class node_analysis,node_sampledata,node_dashboard,node_risks,node_summary,node_suggestions,node_market,node_eli5,node_negotiate,node_viewer,node_chat toneAmber
class node_authmodal,node_auth,node_firebase,node_contracts,node_firestore toneMint
class node_analyzefn,node_chatfn toneRose
class node_user toneIndigo
```

## Components

### User experience

- [App navigation](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/App.tsx): `src/App.tsx`
- [Landing page](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/Landing.tsx): `src/screens/Landing.tsx`
- [Contract upload](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/Upload.tsx): `src/screens/Upload.tsx`
- [Saved library](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/Library.tsx): `src/screens/Library.tsx`

### Contract review

- [Analysis state](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/AnalysisContext.tsx): `src/AnalysisContext.tsx`
- [Sample analysis data](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/data.ts): `src/data.ts`
- [Review dashboard](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/Dashboard.tsx): `src/screens/Dashboard.tsx`
- [Risk review](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/dashboard/RisksTab.tsx): `src/screens/dashboard/RisksTab.tsx`
- [Summary view](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/dashboard/SummaryTab.tsx): `src/screens/dashboard/SummaryTab.tsx`
- [Protection suggestions](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/dashboard/SuggestionsTab.tsx): `src/screens/dashboard/SuggestionsTab.tsx`
- [Market comparison](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/dashboard/MarketTab.tsx): `src/screens/dashboard/MarketTab.tsx`
- [Plain-language view](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/dashboard/Eli5Tab.tsx): `src/screens/dashboard/Eli5Tab.tsx`
- [Negotiation guidance](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/screens/dashboard/NegotiateTab.tsx): `src/screens/dashboard/NegotiateTab.tsx`
- [Document viewer](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/components/DocumentViewer.tsx): `src/components/DocumentViewer.tsx`
- [Chat panel](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/components/ChatPanel.tsx): `src/components/ChatPanel.tsx`

### Identity and storage

- [Sign-in modal](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/components/AuthModal.tsx): `src/components/AuthModal.tsx`
- [Authentication](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/auth/AuthContext.tsx): `src/auth/AuthContext.tsx`
- [Firebase setup](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`
- [Contract records](https://github.com/shreytiwari790-arch/redline_backup/blob/main/src/lib/contracts.ts): `src/lib/contracts.ts`
- **Firestore**

### Server functions

- [Analysis function](https://github.com/shreytiwari790-arch/redline_backup/blob/main/netlify/functions/analyze.ts): `netlify/functions/analyze.ts`
- [Chat function](https://github.com/shreytiwari790-arch/redline_backup/blob/main/netlify/functions/chat.ts): `netlify/functions/chat.ts`

### Other components

- **Freelancer**

## Connections

- Freelancer → Landing page: visits (evidence: `src/screens/Landing.tsx`)
- App navigation → Landing page: renders (evidence: `src/App.tsx`)
- App navigation → Contract upload: renders (evidence: `src/App.tsx`)
- App navigation → Review dashboard: renders (evidence: `src/App.tsx`)
- App navigation → Saved library: renders (evidence: `src/App.tsx`)
- App navigation → Sign-in modal: renders (evidence: `src/App.tsx`)
- App navigation → Analysis state: provides state (evidence: `src/App.tsx`)
- App navigation → Contract records: saves and loads (evidence: `src/App.tsx`)
- Sign-in modal → Authentication: requests sign-in (evidence: `src/components/AuthModal.tsx`)
- Authentication → Firebase setup: uses configuration (evidence: `src/auth/AuthContext.tsx`)
- Contract records → Firebase setup: uses connection (evidence: `src/lib/contracts.ts`)
- Contract records → Firestore: reads and writes (evidence: `src/lib/contracts.ts`)
- Analysis state → Sample analysis data: initializes from (evidence: `src/AnalysisContext.tsx`)
- Review dashboard → Analysis state: reads review state (evidence: `src/screens/Dashboard.tsx`)
- Review dashboard → Risk review: renders (evidence: `src/screens/Dashboard.tsx`)
- Review dashboard → Summary view: renders (evidence: `src/screens/Dashboard.tsx`)
- Review dashboard → Protection suggestions: renders (evidence: `src/screens/Dashboard.tsx`)
- Review dashboard → Market comparison: renders (evidence: `src/screens/Dashboard.tsx`)
- Review dashboard → Plain-language view: renders (evidence: `src/screens/Dashboard.tsx`)
- Review dashboard → Negotiation guidance: renders (evidence: `src/screens/Dashboard.tsx`)
- Review dashboard → Document viewer: renders (evidence: `src/screens/Dashboard.tsx`)
- Review dashboard → Chat panel: renders (evidence: `src/screens/Dashboard.tsx`)
- Risk review → Analysis state: reads review state (evidence: `src/screens/dashboard/RisksTab.tsx`)
