# aadi007kumar/lost_found_ai_app architecture

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

- Interactive diagram: https://gitdiagram.com/aadi007kumar/lost_found_ai_app
- Repository: https://github.com/aadi007kumar/lost_found_ai_app

## Overview

Reunite is a lost-and-found reporting and matching web app. People submit lost or found reports with item details, location, date, contact information and an optional photo; the server validates and saves the report, enriches it with AI captioning and embeddings, then redirects to its report page. That page retrieves fresh opposite-type matches and nearby reports, exposing contact details for follow-up. The README documents the external AI, photo-storage and database services; unsampled schema and nearby-card implementation are represented by their exact tree paths.

Main entry points: [`src/app/items/[id]/page.tsx`](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/app/items/%5Bid%5D/page.tsx) (Report Detail), [`src/app/actions.ts`](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/app/actions.ts) (Create Report), [`src/components/ReportForm.tsx`](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/components/ReportForm.tsx) (Report Form), [`src/lib/matching.ts`](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/lib/matching.ts) (Match Search and Scoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_reporting["Reporting"]
  node_home["Home Page<br/>[page.tsx]"]
  node_reportpage["Report Page<br/>[page.tsx]"]
  node_form["Report Form<br/>[ReportForm.tsx]"]
  node_photodrop["Photo Picker<br/>[PhotoDrop.tsx]"]
  node_create["Create Report<br/>[actions.ts]"]
end

subgraph group_matching["AI Matching"]
  node_matching["Match Search and Scoring<br/>[matching.ts]"]
  node_caption["Photo Captioning<br/>[groq.ts]"]
  node_embedding["Text Embeddings<br/>[embed.ts]"]
end

subgraph group_views["Report Views"]
  node_itempage["Report Detail<br/>[page.tsx]"]
  node_matchcard["Match Card<br/>[MatchCard.tsx]"]
  node_nearbycard["Nearby Card<br/>[NearbyCard.tsx]"]
  node_notice["Posted Notice<br/>[PostedNotice.tsx]"]
  node_button["Button Controls<br/>[Button.tsx]"]
end

subgraph group_data["Data and Integrations"]
  node_blob["Photo Upload<br/>[blob.ts]"]
  node_db["Item Data Access<br/>[db.ts]"]
  node_schema[("Items and Vectors<br/>[schema.sql]")]
  node_format["Date and Phone Formatting<br/>[format.ts]"]
  node_constants["Report Choices<br/>[constants.ts]"]
end

node_visitor(("Person"))
node_neon[("Neon Postgres")]
node_vercelblob[("Vercel Blob")]
node_groqservice{{"Groq Vision API"}}
node_cloudflare{{"Cloudflare Workers AI"}}

node_visitor -->|"opens"| node_home
node_home -->|"renders links"| node_button
node_visitor -->|"starts report"| node_reportpage
node_reportpage -->|"renders form"| node_form
node_form -->|"uses picker"| node_photodrop
node_form -->|"submits form"| node_create
node_form -->|"loads choices"| node_constants
node_form -->|"renders control"| node_button
node_create -->|"uploads photo"| node_blob
node_create -->|"enriches report"| node_matching
node_create -->|"inserts report"| node_db
node_create -->|"checks date"| node_format
node_create -->|"validates choices"| node_constants
node_blob -.->|"stores photo"| node_vercelblob
node_matching -->|"requests caption"| node_caption
node_matching -->|"creates vector"| node_embedding
node_matching -->|"queries candidates"| node_db
node_caption -->|"calls vision API"| node_groqservice
node_embedding -.->|"creates embeddings"| node_cloudflare
node_db -.->|"queries database"| node_neon
node_schema -.->|"defines storage"| node_neon
node_itempage -->|"loads report"| node_db
node_itempage -->|"finds matches"| node_matching
node_itempage -->|"renders matches"| node_matchcard
node_itempage -->|"renders nearby"| node_nearbycard
node_itempage -->|"shows posted notice"| node_notice
node_itempage -->|"renders report link"| node_button
node_matchcard -->|"formats details"| node_format

click node_home "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/app/page.tsx"
click node_reportpage "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/app/report/page.tsx"
click node_form "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/components/ReportForm.tsx"
click node_photodrop "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/components/PhotoDrop.tsx"
click node_create "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/app/actions.ts"
click node_itempage "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/app/items/%5Bid%5D/page.tsx"
click node_matchcard "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/components/MatchCard.tsx"
click node_nearbycard "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/components/NearbyCard.tsx"
click node_notice "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/components/PostedNotice.tsx"
click node_button "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/components/Button.tsx"
click node_matching "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/lib/matching.ts"
click node_caption "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/lib/ai/groq.ts"
click node_embedding "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/lib/ai/embed.ts"
click node_blob "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/lib/blob.ts"
click node_db "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/lib/db.ts"
click node_schema "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/db/schema.sql"
click node_format "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/lib/format.ts"
click node_constants "https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/lib/constants.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_home,node_reportpage,node_form,node_photodrop,node_create toneBlue
class node_matching,node_caption,node_embedding,node_neon,node_vercelblob toneAmber
class node_itempage,node_matchcard,node_nearbycard,node_notice,node_button,node_groqservice toneMint
class node_blob,node_db,node_schema,node_format,node_constants,node_cloudflare toneRose
class node_visitor toneIndigo
```

## Components

### Reporting

- [Home Page](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Report Page](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/app/report/page.tsx): `src/app/report/page.tsx`
- [Report Form](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/components/ReportForm.tsx): `src/components/ReportForm.tsx`
- [Photo Picker](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/components/PhotoDrop.tsx): `src/components/PhotoDrop.tsx`
- [Create Report](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/app/actions.ts): `src/app/actions.ts`

### AI Matching

- [Match Search and Scoring](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/lib/matching.ts): `src/lib/matching.ts`
- [Photo Captioning](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/lib/ai/groq.ts): `src/lib/ai/groq.ts`
- [Text Embeddings](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/lib/ai/embed.ts): `src/lib/ai/embed.ts`

### Report Views

- [Report Detail](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/app/items/%5Bid%5D/page.tsx): `src/app/items/[id]/page.tsx`
- [Match Card](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/components/MatchCard.tsx): `src/components/MatchCard.tsx`
- [Nearby Card](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/components/NearbyCard.tsx): `src/components/NearbyCard.tsx`
- [Posted Notice](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/components/PostedNotice.tsx): `src/components/PostedNotice.tsx`
- [Button Controls](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/components/Button.tsx): `src/components/Button.tsx`

### Data and Integrations

- [Photo Upload](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/lib/blob.ts): `src/lib/blob.ts`
- [Item Data Access](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/lib/db.ts): `src/lib/db.ts`
- [Items and Vectors](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/db/schema.sql): `db/schema.sql`
- [Date and Phone Formatting](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/lib/format.ts): `src/lib/format.ts`
- [Report Choices](https://github.com/aadi007kumar/lost_found_ai_app/blob/main/src/lib/constants.ts): `src/lib/constants.ts`

### Other components

- **Person**
- **Neon Postgres**
- **Vercel Blob**
- **Groq Vision API**
- **Cloudflare Workers AI**

## Connections

- Person → Home Page: opens (evidence: `src/app/page.tsx`)
- Home Page → Button Controls: renders links (evidence: `src/app/page.tsx`)
- Person → Report Page: starts report (evidence: `README.md`)
- Report Page → Report Form: renders form (evidence: `src/app/report/page.tsx`)
- Report Form → Photo Picker: uses picker (evidence: `src/components/ReportForm.tsx`)
- Report Form → Create Report: submits form (evidence: `src/components/ReportForm.tsx`)
- Report Form → Report Choices: loads choices (evidence: `src/components/ReportForm.tsx`)
- Report Form → Button Controls: renders control (evidence: `src/components/ReportForm.tsx`)
- Create Report → Photo Upload: uploads photo (evidence: `src/app/actions.ts`)
- Create Report → Match Search and Scoring: enriches report (evidence: `src/app/actions.ts`)
- Create Report → Item Data Access: inserts report (evidence: `src/app/actions.ts`)
- Create Report → Date and Phone Formatting: checks date (evidence: `src/app/actions.ts`)
- Create Report → Report Choices: validates choices (evidence: `src/app/actions.ts`)
- Photo Upload → Vercel Blob: stores photo (evidence: `README.md`)
- Match Search and Scoring → Photo Captioning: requests caption (evidence: `src/lib/matching.ts`)
- Match Search and Scoring → Text Embeddings: creates vector (evidence: `src/lib/matching.ts`)
- Match Search and Scoring → Item Data Access: queries candidates (evidence: `src/lib/matching.ts`)
- Photo Captioning → Groq Vision API: calls vision API (evidence: `README.md`)
- Text Embeddings → Cloudflare Workers AI: creates embeddings (evidence: `README.md`)
- Item Data Access → Neon Postgres: queries database (evidence: `README.md`)
- Items and Vectors → Neon Postgres: defines storage (evidence: `README.md`)
- Report Detail → Item Data Access: loads report (evidence: `src/app/items/[id]/page.tsx`)
- Report Detail → Match Search and Scoring: finds matches (evidence: `src/app/items/[id]/page.tsx`)
- Report Detail → Match Card: renders matches (evidence: `src/app/items/[id]/page.tsx`)
- Report Detail → Nearby Card: renders nearby (evidence: `src/app/items/[id]/page.tsx`)
- Report Detail → Posted Notice: shows posted notice (evidence: `src/app/items/[id]/page.tsx`)
- Report Detail → Button Controls: renders report link (evidence: `src/app/items/[id]/page.tsx`)
- Match Card → Date and Phone Formatting: formats details (evidence: `src/components/MatchCard.tsx`)
