# sohaibwaheed2006-beep/hackdatav2 architecture

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

- Interactive diagram: https://gitdiagram.com/sohaibwaheed2006-beep/hackdatav2
- Repository: https://github.com/sohaibwaheed2006-beep/hackdatav2

## Overview

HackData is a web application for analyzing uploaded data schemas, configuring synthetic data, generating relational datasets or business documents, and exporting results. Its main workflow is presented as upload → schema review → configuration → generation → preview, with project management alongside it. The API routes orchestrate analysis, generation, persistence, and export; specialized analyzers and engines implement the domain work. Edges reflect excerpted calls, indexed references, or documented capabilities; some UI-to-API connections are left dashed because the relevant call sites were not shown.

Main entry points: [`src/app/page.tsx`](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/app/page.tsx) (Project workflow), [`src/app/api/generate/route.ts`](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/app/api/generate/route.ts) (Generate endpoint), [`src/lib/supabase.ts`](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/supabase.ts) (Supabase access), [`src/app/api/analyze/route.ts`](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/app/api/analyze/route.ts) (Analyze endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Product interface"]
  node_workspace["Project workflow<br/>[page.tsx]"]
  node_project_create["Create project"]
  node_upload["Input upload<br/>[InputUpload.tsx]"]
  node_schema_review["Schema review<br/>[SchemaReview.tsx]"]
  node_config["Generation settings<br/>[ConfigPanel.tsx]"]
  node_generate_ui["Generate controls<br/>[GeneratePanel.tsx]"]
  node_preview["Data preview<br/>[PreviewPanel.tsx]"]
  node_sidebar["Project navigation<br/>[Sidebar.tsx]"]
end

subgraph group_api["Application API"]
  node_analyze_api["Analyze endpoint<br/>[route.ts]"]
  node_generate_api["Generate endpoint<br/>[route.ts]"]
  node_export_api["Export endpoint<br/>[route.ts]"]
  node_project_api["Project endpoints<br/>[route.ts]"]
end

subgraph group_analysis["Schema analysis"]
  node_input_analysis["Input analysis<br/>[input-analyzer.ts]"]
  node_relationships["Relationship detection"]
  node_hygiene["Data hygiene<br/>[data-hygiene.ts]"]
end

subgraph group_generation["Data generation"]
  node_ai["AI enrichment<br/>[ai-layer.ts]"]
  node_tabular["Tabular engine<br/>[tabular-engine.ts]"]
  node_relational["Relational engine"]
  node_documents["Document engine<br/>[document-engine.ts]"]
  node_validator["Data validation<br/>[data-validator.ts]"]
end

subgraph group_persistence["Persistence and export"]
  node_storage["Supabase access<br/>[supabase.ts]"]
  node_local_db[("Local fallback store<br/>[local-db.ts]")]
  node_exporter["Format exporter<br/>[exporter.ts]"]
end

node_user(("User"))
node_supabase_service[("Supabase")]

node_user -->|"uses"| node_workspace
node_workspace -->|"opens"| node_project_create
node_workspace -->|"renders"| node_upload
node_workspace -->|"renders"| node_schema_review
node_workspace -->|"renders"| node_config
node_workspace -->|"renders"| node_generate_ui
node_workspace -->|"renders"| node_preview
node_workspace -->|"renders"| node_sidebar
node_upload -.->|"submits input"| node_analyze_api
node_analyze_api -->|"analyzes input"| node_input_analysis
node_analyze_api -->|"detects links"| node_relationships
node_analyze_api -->|"enriches schema"| node_ai
node_input_analysis -->|"uses checks"| node_hygiene
node_ai -->|"filters values"| node_hygiene
node_config -.->|"configures"| node_generate_api
node_generate_ui -.->|"starts generation"| node_generate_api
node_generate_api -->|"requests content"| node_ai
node_generate_api -->|"generates rows"| node_tabular
node_generate_api -->|"generates related data"| node_relational
node_generate_api -->|"generates documents"| node_documents
node_generate_api -->|"validates results"| node_validator
node_relational -->|"generates tables"| node_tabular
node_tabular -->|"checks null tokens"| node_hygiene
node_ai -->|"uses person data"| node_tabular
node_generate_api -->|"loads and saves"| node_storage
node_analyze_api -->|"reads and writes"| node_storage
node_project_api -->|"accesses projects"| node_storage
node_storage -->|"falls back to"| node_local_db
node_storage -->|"connects to"| node_supabase_service
node_preview -.->|"requests download"| node_export_api
node_export_api -->|"loads datasets"| node_storage
node_export_api -->|"formats output"| node_exporter

click node_workspace "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/app/page.tsx"
click node_project_create "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/components/CreateProjectModal.tsx"
click node_upload "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/components/InputUpload.tsx"
click node_schema_review "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/components/SchemaReview.tsx"
click node_config "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/components/ConfigPanel.tsx"
click node_generate_ui "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/components/GeneratePanel.tsx"
click node_preview "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/components/PreviewPanel.tsx"
click node_sidebar "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/components/Sidebar.tsx"
click node_analyze_api "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/app/api/analyze/route.ts"
click node_generate_api "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/app/api/generate/route.ts"
click node_export_api "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/app/api/export/route.ts"
click node_project_api "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/app/api/projects/route.ts"
click node_input_analysis "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/analyzers/input-analyzer.ts"
click node_relationships "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/analyzers/relationship-analyzer.ts"
click node_hygiene "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/analyzers/data-hygiene.ts"
click node_ai "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/ai/ai-layer.ts"
click node_tabular "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/generators/tabular-engine.ts"
click node_relational "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/generators/relational-engine.ts"
click node_documents "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/generators/document-engine.ts"
click node_validator "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/validators/data-validator.ts"
click node_storage "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/supabase.ts"
click node_local_db "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/local-db.ts"
click node_exporter "https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/export/exporter.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_workspace,node_project_create,node_upload,node_schema_review,node_config,node_generate_ui,node_preview,node_sidebar,node_user toneBlue
class node_analyze_api,node_generate_api,node_export_api,node_project_api,node_supabase_service toneAmber
class node_input_analysis,node_relationships,node_hygiene toneMint
class node_ai,node_tabular,node_relational,node_documents,node_validator toneRose
class node_storage,node_local_db,node_exporter toneIndigo
```

## Components

### Product interface

- [Project workflow](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Create project](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/components/CreateProjectModal.tsx): `src/components/CreateProjectModal.tsx`
- [Input upload](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/components/InputUpload.tsx): `src/components/InputUpload.tsx`
- [Schema review](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/components/SchemaReview.tsx): `src/components/SchemaReview.tsx`
- [Generation settings](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/components/ConfigPanel.tsx): `src/components/ConfigPanel.tsx`
- [Generate controls](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/components/GeneratePanel.tsx): `src/components/GeneratePanel.tsx`
- [Data preview](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/components/PreviewPanel.tsx): `src/components/PreviewPanel.tsx`
- [Project navigation](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/components/Sidebar.tsx): `src/components/Sidebar.tsx`

### Application API

- [Analyze endpoint](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/app/api/analyze/route.ts): `src/app/api/analyze/route.ts`
- [Generate endpoint](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/app/api/generate/route.ts): `src/app/api/generate/route.ts`
- [Export endpoint](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/app/api/export/route.ts): `src/app/api/export/route.ts`
- [Project endpoints](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/app/api/projects/route.ts): `src/app/api/projects/route.ts`

### Schema analysis

- [Input analysis](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/analyzers/input-analyzer.ts): `src/lib/analyzers/input-analyzer.ts`
- [Relationship detection](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/analyzers/relationship-analyzer.ts): `src/lib/analyzers/relationship-analyzer.ts`
- [Data hygiene](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/analyzers/data-hygiene.ts): `src/lib/analyzers/data-hygiene.ts`

### Data generation

- [AI enrichment](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/ai/ai-layer.ts): `src/lib/ai/ai-layer.ts`
- [Tabular engine](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/generators/tabular-engine.ts): `src/lib/generators/tabular-engine.ts`
- [Relational engine](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/generators/relational-engine.ts): `src/lib/generators/relational-engine.ts`
- [Document engine](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/generators/document-engine.ts): `src/lib/generators/document-engine.ts`
- [Data validation](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/validators/data-validator.ts): `src/lib/validators/data-validator.ts`

### Persistence and export

- [Supabase access](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- [Local fallback store](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/local-db.ts): `src/lib/local-db.ts`
- [Format exporter](https://github.com/sohaibwaheed2006-beep/hackdatav2/blob/main/src/lib/export/exporter.ts): `src/lib/export/exporter.ts`

### Other components

- **User**
- **Supabase**

## Connections

- User → Project workflow: uses (evidence: `README.md`)
- Project workflow → Create project: opens (evidence: `src/app/page.tsx`)
- Project workflow → Input upload: renders (evidence: `src/app/page.tsx`)
- Project workflow → Schema review: renders (evidence: `src/app/page.tsx`)
- Project workflow → Generation settings: renders (evidence: `src/app/page.tsx`)
- Project workflow → Generate controls: renders (evidence: `src/app/page.tsx`)
- Project workflow → Data preview: renders (evidence: `src/app/page.tsx`)
- Project workflow → Project navigation: renders (evidence: `src/app/page.tsx`)
- Input upload → Analyze endpoint: submits input
- Analyze endpoint → Input analysis: analyzes input (evidence: `src/app/api/analyze/route.ts`)
- Analyze endpoint → Relationship detection: detects links (evidence: `src/app/api/analyze/route.ts`)
- Analyze endpoint → AI enrichment: enriches schema (evidence: `src/app/api/analyze/route.ts`)
- Input analysis → Data hygiene: uses checks (evidence: `src/lib/analyzers/input-analyzer.ts`)
- AI enrichment → Data hygiene: filters values (evidence: `src/lib/ai/ai-layer.ts`)
- Generation settings → Generate endpoint: configures
- Generate controls → Generate endpoint: starts generation
- Generate endpoint → AI enrichment: requests content (evidence: `src/app/api/generate/route.ts`)
- Generate endpoint → Tabular engine: generates rows (evidence: `src/app/api/generate/route.ts`)
- Generate endpoint → Relational engine: generates related data (evidence: `src/app/api/generate/route.ts`)
- Generate endpoint → Document engine: generates documents (evidence: `src/app/api/generate/route.ts`)
- Generate endpoint → Data validation: validates results (evidence: `src/app/api/generate/route.ts`)
- Relational engine → Tabular engine: generates tables (evidence: `src/lib/generators/relational-engine.ts`)
- Tabular engine → Data hygiene: checks null tokens (evidence: `src/lib/generators/tabular-engine.ts`)
- AI enrichment → Tabular engine: uses person data (evidence: `src/lib/ai/ai-layer.ts`)
- Generate endpoint → Supabase access: loads and saves (evidence: `src/app/api/generate/route.ts`)
- Analyze endpoint → Supabase access: reads and writes (evidence: `src/app/api/analyze/route.ts`)
- Project endpoints → Supabase access: accesses projects (evidence: `src/app/api/projects/route.ts`)
- Supabase access → Local fallback store: falls back to (evidence: `src/lib/supabase.ts`)
- Supabase access → Supabase: connects to (evidence: `src/lib/supabase.ts`)
- Data preview → Export endpoint: requests download
- Export endpoint → Supabase access: loads datasets (evidence: `src/app/api/export/route.ts`)
- Export endpoint → Format exporter: formats output (evidence: `src/app/api/export/route.ts`)
