# utkarshcodehub/proprompter architecture

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

- Interactive diagram: https://gitdiagram.com/utkarshcodehub/proprompter
- Repository: https://github.com/utkarshcodehub/proprompter

## Overview

ProPrompter turns a user's rough prompt into a model-aware Lean or Structured result, with quality and token metrics; Compare runs both modes. The frontend also supports sign-in and the README-described history, collections, dashboard, and community features. Those broader screens are represented by their documented paths, but their internal calls and Supabase data wiring were not shown, so the graph avoids asserting those relationships.

Main entry points: [`backend/app/routers/optimize.py`](https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/routers/optimize.py) (Optimize and compare routes), [`backend/app/config.py`](https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/config.py) (Runtime settings), [`backend/app/main.py`](https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/main.py) (FastAPI application), [`frontend/src/app/page.jsx`](https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/page.jsx) (Optimize interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_home["Optimize interface<br/>[page.jsx]"]
  node_voice["Speech input<br/>[MicButton.jsx]"]
  node_history["Prompt history<br/>[page.jsx]"]
  node_collections["Collections<br/>[page.jsx]"]
  node_comparison["Mode comparison<br/>[page.jsx]"]
  node_dashboard["Usage dashboard<br/>[page.jsx]"]
  node_community["Community prompts<br/>[page.jsx]"]
end

subgraph group_identity["Identity"]
  node_auth["Sign-in screen<br/>[page.jsx]"]
  node_auth_hook["Auth state<br/>[useAuth.js]"]
  node_callback["OAuth callback<br/>[route.js]"]
  node_supabase_client["Supabase client<br/>[supabase.js]"]
end

subgraph group_api["Prompt API"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_routes["Optimize and compare routes<br/>[optimize.py]"]
  node_schemas["Request and result schemas<br/>[schemas.py]"]
  node_limits["Daily rate limits<br/>[rate_limiter.py]"]
  node_health["Health endpoint<br/>[health.py]"]
  node_config["Runtime settings<br/>[config.py]"]
end

subgraph group_engine["Optimization engine"]
  node_engine["Prompt optimization<br/>[groq_service.py]"]
end

node_visitor(("Prompt author"))
node_supabase[("Supabase")]
node_groq["Groq LLM"]

node_visitor -->|"submits prompt"| node_home
node_home -->|"uses input"| node_voice
node_home -->|"POSTs optimize"| node_routes
node_comparison -.->|"requests compare"| node_routes
node_routes -->|"runs optimization"| node_engine
node_routes -->|"checks quota"| node_limits
node_routes -->|"validates and returns"| node_schemas
node_engine -->|"calls model"| node_groq
node_api_app -->|"registers routes"| node_routes
node_api_app -->|"registers route"| node_health
node_api_app -->|"configures app"| node_config
node_limits -->|"reads limits"| node_config
node_health -->|"reads settings"| node_config
node_engine -->|"reads model settings"| node_config
node_auth -.->|"uses auth"| node_auth_hook
node_auth_hook -->|"uses client"| node_supabase_client
node_auth_hook -->|"auth operations"| node_supabase
node_callback -->|"exchanges session"| node_supabase
node_history -.->|"stores and reads prompts"| node_supabase
node_collections -.->|"manages collections"| node_supabase
node_dashboard -.->|"loads activity stats"| node_supabase
node_community -.->|"community data"| node_supabase

click node_home "https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/page.jsx"
click node_voice "https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/components/MicButton.jsx"
click node_history "https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/history/page.jsx"
click node_collections "https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/collections/page.jsx"
click node_comparison "https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/compare/page.jsx"
click node_dashboard "https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/dashboard/page.jsx"
click node_community "https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/community/page.jsx"
click node_auth "https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/login/page.jsx"
click node_auth_hook "https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/hooks/useAuth.js"
click node_callback "https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/auth/callback/route.js"
click node_supabase_client "https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/lib/supabase.js"
click node_api_app "https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/main.py"
click node_routes "https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/routers/optimize.py"
click node_schemas "https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/schemas.py"
click node_limits "https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/middleware/rate_limiter.py"
click node_health "https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/routers/health.py"
click node_config "https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/config.py"
click node_engine "https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/services/groq_service.py"

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_voice,node_history,node_collections,node_comparison,node_dashboard,node_community toneBlue
class node_auth,node_auth_hook,node_callback,node_supabase_client,node_supabase toneAmber
class node_api_app,node_routes,node_schemas,node_limits,node_health,node_config toneMint
class node_engine toneRose
class node_visitor,node_groq toneIndigo
```

## Components

### User experience

- [Optimize interface](https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/page.jsx): `frontend/src/app/page.jsx`
- [Speech input](https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/components/MicButton.jsx): `frontend/src/components/MicButton.jsx`
- [Prompt history](https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/history/page.jsx): `frontend/src/app/history/page.jsx`
- [Collections](https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/collections/page.jsx): `frontend/src/app/collections/page.jsx`
- [Mode comparison](https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/compare/page.jsx): `frontend/src/app/compare/page.jsx`
- [Usage dashboard](https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/dashboard/page.jsx): `frontend/src/app/dashboard/page.jsx`
- [Community prompts](https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/community/page.jsx): `frontend/src/app/community/page.jsx`

### Identity

- [Sign-in screen](https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/login/page.jsx): `frontend/src/app/login/page.jsx`
- [Auth state](https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/hooks/useAuth.js): `frontend/src/hooks/useAuth.js`
- [OAuth callback](https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/app/auth/callback/route.js): `frontend/src/app/auth/callback/route.js`
- [Supabase client](https://github.com/utkarshcodehub/proprompter/blob/main/frontend/src/lib/supabase.js): `frontend/src/lib/supabase.js`

### Prompt API

- [FastAPI application](https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/main.py): `backend/app/main.py`
- [Optimize and compare routes](https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/routers/optimize.py): `backend/app/routers/optimize.py`
- [Request and result schemas](https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/schemas.py): `backend/app/schemas.py`
- [Daily rate limits](https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/middleware/rate_limiter.py): `backend/app/middleware/rate_limiter.py`
- [Health endpoint](https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/routers/health.py): `backend/app/routers/health.py`
- [Runtime settings](https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/config.py): `backend/app/config.py`

### Optimization engine

- [Prompt optimization](https://github.com/utkarshcodehub/proprompter/blob/main/backend/app/services/groq_service.py): `backend/app/services/groq_service.py`

### Other components

- **Prompt author**
- **Supabase**
- **Groq LLM**

## Connections

- Prompt author → Optimize interface: submits prompt (evidence: `README.md`)
- Optimize interface → Speech input: uses input (evidence: `frontend/src/app/page.jsx`)
- Optimize interface → Optimize and compare routes: POSTs optimize (evidence: `frontend/src/app/page.jsx`)
- Mode comparison → Optimize and compare routes: requests compare
- Optimize and compare routes → Prompt optimization: runs optimization (evidence: `backend/app/routers/optimize.py`)
- Optimize and compare routes → Daily rate limits: checks quota (evidence: `backend/app/routers/optimize.py`)
- Optimize and compare routes → Request and result schemas: validates and returns (evidence: `backend/app/routers/optimize.py`)
- Prompt optimization → Groq LLM: calls model (evidence: `backend/app/services/groq_service.py`)
- FastAPI application → Optimize and compare routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Health endpoint: registers route (evidence: `backend/app/main.py`)
- FastAPI application → Runtime settings: configures app (evidence: `backend/app/main.py`)
- Daily rate limits → Runtime settings: reads limits (evidence: `backend/app/middleware/rate_limiter.py`)
- Health endpoint → Runtime settings: reads settings (evidence: `backend/app/routers/health.py`)
- Prompt optimization → Runtime settings: reads model settings (evidence: `backend/app/services/groq_service.py`)
- Sign-in screen → Auth state: uses auth
- Auth state → Supabase client: uses client (evidence: `frontend/src/hooks/useAuth.js`)
- Auth state → Supabase: auth operations (evidence: `frontend/src/hooks/useAuth.js`)
- OAuth callback → Supabase: exchanges session (evidence: `frontend/src/app/auth/callback/route.js`)
- Prompt history → Supabase: stores and reads prompts
- Collections → Supabase: manages collections
- Usage dashboard → Supabase: loads activity stats
- Community prompts → Supabase: community data
