# rikhinagra/legal-intake-suite architecture

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

- Interactive diagram: https://gitdiagram.com/rikhinagra/legal-intake-suite
- Repository: https://github.com/rikhinagra/legal-intake-suite

## Overview

Legal Intake Suite supports two intake-to-decision workflows: personal-injury case intake and commercial business registration. Claimants submit information and documents; agents verify submissions; attorneys review and decide. Staff access is role-based, and transactional email accompanies key steps. The README documents the lead workflow and email capability; source excerpts and the SOURCE INDEX establish the specific component/action relationships shown. Some unsampled route and action details are therefore omitted rather than inferred.

Main entry points: [`src/lib/supabase/server.ts`](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/lib/supabase/server.ts) (Session Database Client), [`src/app/actions/business-registrations.ts`](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/business-registrations.ts) (Business Review Actions), [`src/lib/business-notifications.ts`](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/lib/business-notifications.ts) (Business Email Notices), [`src/app/actions/submit-business-registration.ts`](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/submit-business-registration.ts) (Business Submission)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public Intake"]
  node_landing["Landing Page<br/>[page.tsx]"]
  node_lead_wizard["Case Intake Wizard<br/>[IntakeWizard.tsx]"]
  node_lead_submit["Lead Submission<br/>[submit-lead.ts]"]
  node_attachments["Case Attachments"]
  node_file_actions["Lead File Actions<br/>[lead-files.ts]"]
end

subgraph group_staff["Staff Review"]
  node_agent_portal["Agent Portal<br/>[AgentPortal.tsx]"]
  node_agent_actions["Agent Review Actions<br/>[agent-portal.ts]"]
  node_attorney_dashboard["Attorney Dashboard"]
  node_attorney_actions["Attorney Decision Actions"]
end

subgraph group_business["Business Registration"]
  node_business_form["Business Registration Form<br/>[BusinessForm.tsx]"]
  node_business_submit["Business Submission"]
  node_business_actions["Business Review Actions"]
  node_business_agent["Agent Business Panel"]
  node_business_attorney["Attorney Business Review"]
end

subgraph group_platform["Data and Access"]
  node_staff_auth["Staff Authentication<br/>[auth.ts]"]
  node_auth_helpers["Staff Profile Lookup<br/>[auth-helpers.ts]"]
  node_session_client["Session Database Client<br/>[server.ts]"]
  node_supabase[("Supabase")]
  node_file_storage["File Storage Helpers<br/>[storage.ts]"]
end

subgraph group_messaging["Notifications"]
  node_business_notifications["Business Email Notices"]
  node_email_service["Resend"]
end

node_claimant(("Claimant"))
node_business_contact(("Business Contact"))

node_claimant -->|"submits case"| node_lead_wizard
node_lead_wizard -.->|"submits details"| node_lead_submit
node_claimant -->|"visits"| node_landing
node_attachments -->|"manages files"| node_file_actions
node_file_actions -->|"uses paths"| node_file_storage
node_agent_portal -->|"loads and saves reviews"| node_agent_actions
node_agent_portal -->|"renders attachments"| node_attachments
node_agent_actions -->|"queries with session"| node_session_client
node_attorney_dashboard -->|"loads and saves decisions"| node_attorney_actions
node_attorney_dashboard -->|"renders attachments"| node_attachments
node_attorney_actions -->|"queries with session"| node_session_client
node_staff_auth -->|"authenticates session"| node_session_client
node_staff_auth -->|"looks up role"| node_auth_helpers
node_auth_helpers -->|"gets profile"| node_session_client
node_session_client -->|"queries"| node_supabase
node_file_storage -.->|"stores files"| node_supabase
node_business_contact -->|"submits registration"| node_business_form
node_business_form -->|"submits registration"| node_business_submit
node_business_submit -->|"sends notices"| node_business_notifications
node_business_submit -->|"inserts registration"| node_supabase
node_business_agent -->|"reviews registration"| node_business_actions
node_business_attorney -->|"reviews decisions"| node_business_actions
node_business_actions -->|"sends status notices"| node_business_notifications
node_business_actions -->|"queries with session"| node_session_client
node_business_notifications -->|"sends email"| node_email_service
node_business_notifications -->|"looks up recipients"| node_supabase

click node_landing "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/%5Blocale%5D/page.tsx"
click node_lead_wizard "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/components/wizard/IntakeWizard.tsx"
click node_lead_submit "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/submit-lead.ts"
click node_attachments "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/components/shared/AttachmentsPanel.tsx"
click node_file_actions "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/lead-files.ts"
click node_agent_portal "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/components/agent/AgentPortal.tsx"
click node_agent_actions "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/agent-portal.ts"
click node_attorney_dashboard "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/components/attorney/AttorneyDashboard.tsx"
click node_attorney_actions "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/attorney-dashboard.ts"
click node_staff_auth "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/auth.ts"
click node_auth_helpers "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/lib/supabase/auth-helpers.ts"
click node_session_client "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/lib/supabase/server.ts"
click node_file_storage "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/lib/supabase/storage.ts"
click node_business_form "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/components/landing/BusinessForm.tsx"
click node_business_submit "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/submit-business-registration.ts"
click node_business_actions "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/business-registrations.ts"
click node_business_agent "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/components/agent/BusinessRegistrationsPanel.tsx"
click node_business_attorney "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/components/attorney/BusinessRegistrationsDashboard.tsx"
click node_business_notifications "https://github.com/rikhinagra/legal-intake-suite/blob/main/src/lib/business-notifications.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_landing,node_lead_wizard,node_lead_submit,node_attachments,node_file_actions toneBlue
class node_agent_portal,node_agent_actions,node_attorney_dashboard,node_attorney_actions toneAmber
class node_business_form,node_business_submit,node_business_actions,node_business_agent,node_business_attorney toneMint
class node_staff_auth,node_auth_helpers,node_session_client,node_supabase,node_file_storage toneRose
class node_business_notifications,node_email_service,node_claimant,node_business_contact toneIndigo
```

## Components

### Public Intake

- [Landing Page](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/%5Blocale%5D/page.tsx): `src/app/[locale]/page.tsx`
- [Case Intake Wizard](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/components/wizard/IntakeWizard.tsx): `src/components/wizard/IntakeWizard.tsx`
- [Lead Submission](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/submit-lead.ts): `src/app/actions/submit-lead.ts`
- [Case Attachments](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/components/shared/AttachmentsPanel.tsx): `src/components/shared/AttachmentsPanel.tsx`
- [Lead File Actions](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/lead-files.ts): `src/app/actions/lead-files.ts`

### Staff Review

- [Agent Portal](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/components/agent/AgentPortal.tsx): `src/components/agent/AgentPortal.tsx`
- [Agent Review Actions](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/agent-portal.ts): `src/app/actions/agent-portal.ts`
- [Attorney Dashboard](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/components/attorney/AttorneyDashboard.tsx): `src/components/attorney/AttorneyDashboard.tsx`
- [Attorney Decision Actions](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/attorney-dashboard.ts): `src/app/actions/attorney-dashboard.ts`

### Business Registration

- [Business Registration Form](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/components/landing/BusinessForm.tsx): `src/components/landing/BusinessForm.tsx`
- [Business Submission](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/submit-business-registration.ts): `src/app/actions/submit-business-registration.ts`
- [Business Review Actions](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/business-registrations.ts): `src/app/actions/business-registrations.ts`
- [Agent Business Panel](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/components/agent/BusinessRegistrationsPanel.tsx): `src/components/agent/BusinessRegistrationsPanel.tsx`
- [Attorney Business Review](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/components/attorney/BusinessRegistrationsDashboard.tsx): `src/components/attorney/BusinessRegistrationsDashboard.tsx`

### Data and Access

- [Staff Authentication](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/app/actions/auth.ts): `src/app/actions/auth.ts`
- [Staff Profile Lookup](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/lib/supabase/auth-helpers.ts): `src/lib/supabase/auth-helpers.ts`
- [Session Database Client](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`
- **Supabase**
- [File Storage Helpers](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/lib/supabase/storage.ts): `src/lib/supabase/storage.ts`

### Notifications

- [Business Email Notices](https://github.com/rikhinagra/legal-intake-suite/blob/main/src/lib/business-notifications.ts): `src/lib/business-notifications.ts`
- **Resend**

### Other components

- **Claimant**
- **Business Contact**

## Connections

- Claimant → Case Intake Wizard: submits case (evidence: `README.md`)
- Case Intake Wizard → Lead Submission: submits details
- Claimant → Landing Page: visits (evidence: `src/app/[locale]/page.tsx`)
- Case Attachments → Lead File Actions: manages files (evidence: `src/components/shared/AttachmentsPanel.tsx`)
- Lead File Actions → File Storage Helpers: uses paths (evidence: `src/app/actions/lead-files.ts`)
- Agent Portal → Agent Review Actions: loads and saves reviews (evidence: `src/components/agent/AgentPortal.tsx`)
- Agent Portal → Case Attachments: renders attachments (evidence: `src/components/agent/AgentPortal.tsx`)
- Agent Review Actions → Session Database Client: queries with session (evidence: `src/app/actions/agent-portal.ts`)
- Attorney Dashboard → Attorney Decision Actions: loads and saves decisions (evidence: `src/components/attorney/AttorneyDashboard.tsx`)
- Attorney Dashboard → Case Attachments: renders attachments (evidence: `src/components/attorney/AttorneyDashboard.tsx`)
- Attorney Decision Actions → Session Database Client: queries with session (evidence: `src/app/actions/attorney-dashboard.ts`)
- Staff Authentication → Session Database Client: authenticates session (evidence: `src/app/actions/auth.ts`)
- Staff Authentication → Staff Profile Lookup: looks up role (evidence: `src/app/actions/auth.ts`)
- Staff Profile Lookup → Session Database Client: gets profile (evidence: `src/lib/supabase/auth-helpers.ts`)
- Session Database Client → Supabase: queries (evidence: `src/lib/supabase/server.ts`)
- File Storage Helpers → Supabase: stores files
- Business Contact → Business Registration Form: submits registration (evidence: `src/components/landing/BusinessForm.tsx`)
- Business Registration Form → Business Submission: submits registration (evidence: `src/components/landing/BusinessForm.tsx`)
- Business Submission → Business Email Notices: sends notices (evidence: `src/app/actions/submit-business-registration.ts`)
- Business Submission → Supabase: inserts registration (evidence: `src/app/actions/submit-business-registration.ts`)
- Agent Business Panel → Business Review Actions: reviews registration (evidence: `src/components/agent/BusinessRegistrationsPanel.tsx`)
- Attorney Business Review → Business Review Actions: reviews decisions (evidence: `src/components/attorney/AttorneyDashboard.tsx`)
- Business Review Actions → Business Email Notices: sends status notices (evidence: `src/app/actions/business-registrations.ts`)
- Business Review Actions → Session Database Client: queries with session (evidence: `src/app/actions/business-registrations.ts`)
- Business Email Notices → Resend: sends email (evidence: `src/lib/business-notifications.ts`)
- Business Email Notices → Supabase: looks up recipients (evidence: `src/lib/business-notifications.ts`)
