# anirudh-1106/vars architecture

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

- Interactive diagram: https://gitdiagram.com/anirudh-1106/vars
- Repository: https://github.com/anirudh-1106/vars

## Overview

1. **Overall shape**
   - VARS is a single Flask application that implements a voice-driven resume builder.
   - The architecture is a browser UI plus a Python backend, with AI services in the middle for transcription, extraction, and refinement.

2. **Frontend boundary**
   - `templates/index.html` is the main interaction surface for recording, transcript review, and answering follow-up questions.
   - `templates/orb_visualizer.html` supports the audio-reactive “orb” voice UI.
   - `static/recorder.js` owns client-side audio capture and the step-by-step interaction flow using browser APIs such as MediaRecorder / Web Audio.

3. **Backend entry point**
   - `app.py` is the orchestration layer.
   - It serves pages, accepts uploaded audio or transcript data, coordinates AI calls, normalizes results, and moves the user through the workflow from raw speech to resume output.

4. **State management**
   - `state.py` holds in-memory application state for the current resume-building session.
   - This is where intermediate artifacts likely live: transcript text, extracted resume fields, missing details, follow-up answers, and the current step/status.
   - The design is stateful but lightweight; there is no visible database layer in the repo.

5. **Audio ingestion path**
   - The browser records user speech and sends audio to the server as `webm` and/or `wav`.
   - The `uploads/` directory is the temporary persistence boundary for those recordings.
   - The presence of recorded artifacts in the repo suggests the backend expects file-based handling rather than pure streaming.

6. **AI processing layer**
   - `services/llm_service.py` is the AI-specific subsystem.
   - It handles the core intelligence: intent classification, structured extraction from transcript text, and refinement of incomplete resume data.
   - Per the README, this layer integrates with Whisper Large-v3 for speech transcription/translation and Groq-hosted LLaMA for LLM-based resume processing.

7. **Data transformation pipeline**
   - Raw spoken input becomes transcript text.
   - Transcript text is reviewed by the user, then passed into the extraction pipeline.
   - The extracted output is converted into structured resume sections such as summary, skills, experience, projects, and contact details.
   - The backend also normalizes that data, including ordering experience by recency.

8. **Missing-information loop**
   - A key subsystem is the follow-up question flow.
   - After extraction, the app detects missing critical fields such as name, contact info, dates, and links.
   - It then asks targeted questions and merges text or voice answers back into the same state until the resume data is complete enough to render.

9. **Resume generation boundary**
   - `templates/resume.html` is the presentation layer for the generated resume preview.
   - The backend turns the structured data into a resume-ready view rather than leaving it as raw JSON-like state.
   - This is the final output boundary before save/export/download behavior.

10. **Runtime and deployment characteristics**
   - The stack is Python/Flask on the server and plain HTML/CSS/JavaScript in the browser.
   - No external frontend framework or database is visible, so the system is intentionally simple and likely optimized for local or small-scale deployment.
   - The external dependencies that matter architecturally are the speech model and the LLM provider, because they define the main processing latency and failure boundaries.

11. **End-to-end flow to diagram**
   - Browser records voice → uploads audio to Flask → transcription/transformation → transcript review → AI extraction into resume sections → missing-detail questions → answer ingestion → final resume preview/rendering.
   - The main architectural seams are: client vs. server, upload storage vs. transient state, and AI processing vs. UI orchestration.

Main entry points: [`app.py`](https://github.com/anirudh-1106/vars/blob/master/app.py) (Flask app), [`static/recorder.js`](https://github.com/anirudh-1106/vars/blob/master/static/recorder.js) (Recorder), [`services/llm_service.py`](https://github.com/anirudh-1106/vars/blob/master/services/llm_service.py) (LLM service), [`state.py`](https://github.com/anirudh-1106/vars/blob/master/state.py) (Session state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_index_page["Main page<br/>HTML entry<br/>[index.html]"]
  node_orb_page["Orb UI<br/>HTML view"]
  node_recorder_js["Recorder<br/>Client audio<br/>[recorder.js]"]
  node_resume_page["Resume view<br/>HTML output<br/>[resume.html]"]
end

subgraph group_backend["Backend"]
  node_app_py["Flask app<br/>Orchestrator<br/>[app.py]"]
  node_state_py(("Session state<br/>In-memory state<br/>[state.py]"))
  node_transcription_step{{"Transcribe<br/>Pipeline step"}}
  node_review_step{{"Review text<br/>Workflow step"}}
  node_extraction_step{{"Extract resume<br/>Pipeline step"}}
  node_followup_step{{"Ask details<br/>Workflow loop"}}
end

subgraph group_ai["AI Layer"]
  node_llm_service["LLM service<br/>AI service<br/>[llm_service.py]"]
  node_speech_models(("Speech models<br/>External AI"))
  node_groq_llm(("Groq LLM<br/>External AI"))
end

subgraph group_storage["Storage"]
  node_uploads_dir[("Uploads<br/>File store")]
  node_debug_recording["Sample audio<br/>Artifact"]
end

node_index_page -->|"uses"| node_recorder_js
node_orb_page -->|"uses"| node_recorder_js
node_recorder_js -->|"uploads audio"| node_app_py
node_app_py -->|"stores audio"| node_uploads_dir
node_app_py -->|"reads/writes"| node_state_py
node_app_py -->|"starts"| node_transcription_step
node_transcription_step -->|"uses"| node_speech_models
node_app_py -->|"serves"| node_review_step
node_review_step -->|"confirmed text"| node_app_py
node_app_py -->|"starts"| node_extraction_step
node_extraction_step -->|"delegates"| node_llm_service
node_llm_service -->|"calls"| node_groq_llm
node_app_py -->|"detects gaps"| node_followup_step
node_followup_step -->|"merges answers"| node_state_py
node_app_py -->|"renders"| node_resume_page
node_debug_recording -.->|"example of"| node_uploads_dir

click node_index_page "https://github.com/anirudh-1106/vars/blob/master/templates/index.html"
click node_orb_page "https://github.com/anirudh-1106/vars/blob/master/templates/orb_visualizer.html"
click node_recorder_js "https://github.com/anirudh-1106/vars/blob/master/static/recorder.js"
click node_app_py "https://github.com/anirudh-1106/vars/blob/master/app.py"
click node_state_py "https://github.com/anirudh-1106/vars/blob/master/state.py"
click node_resume_page "https://github.com/anirudh-1106/vars/blob/master/templates/resume.html"
click node_llm_service "https://github.com/anirudh-1106/vars/blob/master/services/llm_service.py"
click node_uploads_dir "https://github.com/anirudh-1106/vars/tree/master/uploads"
click node_debug_recording "https://github.com/anirudh-1106/vars/blob/master/debug_recording.webm"

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_index_page,node_orb_page,node_recorder_js,node_resume_page toneBlue
class node_app_py,node_state_py,node_transcription_step,node_review_step,node_extraction_step,node_followup_step toneAmber
class node_llm_service,node_speech_models,node_groq_llm toneMint
class node_uploads_dir,node_debug_recording toneRose
```

## Components

### Frontend

Browser UI and client-side capture

- [Main page](https://github.com/anirudh-1106/vars/blob/master/templates/index.html): HTML entry · Primary interaction surface for recording, review, and follow-up questions · `templates/index.html`
- [Orb UI](https://github.com/anirudh-1106/vars/blob/master/templates/orb_visualizer.html): HTML view · Audio-reactive voice UI for recording and listening mode · `templates/orb_visualizer.html`
- [Recorder](https://github.com/anirudh-1106/vars/blob/master/static/recorder.js): Client audio · Browser audio capture and step-by-step interaction flow · `static/recorder.js`
- [Resume view](https://github.com/anirudh-1106/vars/blob/master/templates/resume.html): HTML output · Rendered resume preview boundary for final presentation · `templates/resume.html`

### Backend

Flask orchestration and session flow

- [Flask app](https://github.com/anirudh-1106/vars/blob/master/app.py): Orchestrator · Serves pages, accepts uploads, coordinates AI calls, and advances workflow · `app.py`
- [Session state](https://github.com/anirudh-1106/vars/blob/master/state.py): In-memory state · Holds transcript, extracted fields, missing details, answers, and current step · `state.py`
- **Transcribe**: Pipeline step · Converts uploaded speech into transcript text
- **Review text**: Workflow step · Lets the user inspect and confirm transcript before extraction
- **Extract resume**: Pipeline step · Turns transcript into structured resume sections and normalizes ordering
- **Ask details**: Workflow loop · Detects missing fields and gathers targeted follow-up answers

### AI Layer

Speech and resume intelligence

- [LLM service](https://github.com/anirudh-1106/vars/blob/master/services/llm_service.py): AI service · Intent classification, extraction, and refinement of resume data · `services/llm_service.py`
- **Speech models**: External AI · Whisper-based transcription and translation boundary
- **Groq LLM**: External AI · Hosted language model used for resume processing and refinement

### Storage

Transient audio files and runtime artifacts

- [Uploads](https://github.com/anirudh-1106/vars/tree/master/uploads): File store · Temporary persistence for recorded webm and wav files · `uploads`
- [Sample audio](https://github.com/anirudh-1106/vars/blob/master/debug_recording.webm): Artifact · Recorded audio artifact useful for local debugging · `debug_recording.webm`

## Connections

- Main page → Recorder: uses · Page loads the client recorder flow
- Orb UI → Recorder: uses · Orb UI relies on the same browser audio capture stack
- Recorder → Flask app: uploads audio · Browser sends recorded speech to Flask
- Flask app → Uploads: stores audio · Backend writes uploaded recordings as temporary files
- Flask app → Session state: reads/writes · Workflow state is kept in memory during the session
- Flask app → Transcribe: starts · Backend initiates transcription from uploaded audio
- Transcribe → Speech models: uses · Speech-to-text is handled by external transcription models
- Flask app → Review text: serves · Transcript is returned for user review
- Review text → Flask app: confirmed text · Reviewed transcript is sent back to the backend
- Flask app → Extract resume: starts · Confirmed transcript is passed into resume extraction
- Extract resume → LLM service: delegates · Structured extraction and refinement are handled by the AI layer
- LLM service → Groq LLM: calls · LLM-backed resume reasoning and completion
- Flask app → Ask details: detects gaps · Missing critical fields trigger targeted questions
- Ask details → Session state: merges answers · New answers are folded into the same session state
- Flask app → Resume view: renders · Final structured data is turned into a resume preview
- Sample audio → Uploads: example of · Shows the file-based audio artifact boundary
