# dharani25007-code/zanaks-ai architecture

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

- Interactive diagram: https://gitdiagram.com/dharani25007-code/zanaks-ai
- Repository: https://github.com/dharani25007-code/zanaks-ai

## Overview

Zanaks AI is a Flask-based AI coding platform. Users register, create a chat, choose a mode and language, and receive AI-assisted coding help; the platform also offers code execution and a range of learning, collaboration, and account features. The sampled backend is largely a monolith in app.py, with appcore/db.py providing the SQLite/PostgreSQL connection layer. README capability descriptions preserve major features whose individual implementation paths were not sampled, so those are mapped to app.py or the documented templates without implying unsampled internal calls.

Main entry points: [`app.py`](https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py) (Flask application), [`templates/index.html`](https://github.com/dharani25007-code/zanaks-ai/blob/main/templates/index.html) (Dashboard and auth), [`static/js/codebuddy_voice.js`](https://github.com/dharani25007-code/zanaks-ai/blob/main/static/js/codebuddy_voice.js) (Voice interface), [`appcore/db.py`](https://github.com/dharani25007-code/zanaks-ai/blob/main/appcore/db.py) (Database adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_web_ui["Dashboard and auth<br/>[index.html]"]
  node_feature_pages["Feature pages"]
  node_theme_ui["Theme controls"]
end

subgraph group_assistant["AI coding"]
  node_chat["Chat orchestration<br/>[app.py]"]
  node_ai_modes["AI modes<br/>[app.py]"]
  node_ai_providers["AI providers<br/>[app.py]"]
  node_code_execution["Code execution<br/>[app.py]"]
  node_file_video["File and video tools<br/>[app.py]"]
  node_voice["Voice interface<br/>[codebuddy_voice.js]"]
end

subgraph group_learning["Learning features"]
  node_learning_tools["Learning tools<br/>[app.py]"]
  node_karma_leaderboard["Karma and leaderboard<br/>[app.py]"]
  node_collaboration["Live collaboration<br/>[app.py]"]
end

subgraph group_platform["Platform services"]
  node_app["Flask application<br/>[app.py]"]
  node_accounts["Accounts and recovery<br/>[app.py]"]
  node_db_layer["Database adapter<br/>[db.py]"]
  node_database[("Application database")]
end

node_developer(("Developer"))
node_ollama{{"Ollama"}}
node_groq{{"Groq"}}
node_openrouter{{"OpenRouter"}}
node_piston{{"Piston API"}}
node_smtp{{"SMTP mailer"}}
node_socketio{{"Socket.IO"}}

node_developer -->|"uses"| node_web_ui
node_web_ui -.->|"submits requests"| node_app
node_app -->|"handles accounts"| node_accounts
node_accounts -.->|"stores account data"| node_database
node_app -->|"routes chat"| node_chat
node_chat -->|"selects mode"| node_ai_modes
node_chat -->|"requests completions"| node_ai_providers
node_ai_providers -->|"tries local AI"| node_ollama
node_ai_providers -->|"falls back"| node_groq
node_ai_providers -->|"falls back"| node_openrouter
node_app -->|"routes execution"| node_code_execution
node_code_execution -->|"uses execution API"| node_piston
node_app -->|"provides tools"| node_file_video
node_app -->|"provides learning features"| node_learning_tools
node_app -->|"provides rankings"| node_karma_leaderboard
node_app -->|"provides live rooms"| node_collaboration
node_collaboration -->|"uses realtime transport"| node_socketio
node_accounts -->|"sends recovery mail"| node_smtp
node_app -->|"initializes adapter"| node_db_layer
node_db_layer -->|"connects SQLite or PostgreSQL"| node_database
node_feature_pages -.->|"presents features"| node_app
node_developer -->|"speaks commands"| node_voice
node_voice -.->|"queries assistant"| node_chat
node_developer -->|"chooses theme"| node_theme_ui

click node_web_ui "https://github.com/dharani25007-code/zanaks-ai/blob/main/templates/index.html"
click node_feature_pages "https://github.com/dharani25007-code/zanaks-ai/tree/main/templates"
click node_theme_ui "https://github.com/dharani25007-code/zanaks-ai/blob/main/static/js/auth-theme-switcher.js"
click node_app "https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py"
click node_accounts "https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py"
click node_chat "https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py"
click node_ai_modes "https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py"
click node_ai_providers "https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py"
click node_code_execution "https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py"
click node_file_video "https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py"
click node_voice "https://github.com/dharani25007-code/zanaks-ai/blob/main/static/js/codebuddy_voice.js"
click node_learning_tools "https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py"
click node_karma_leaderboard "https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py"
click node_collaboration "https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py"
click node_db_layer "https://github.com/dharani25007-code/zanaks-ai/blob/main/appcore/db.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_web_ui,node_feature_pages,node_theme_ui toneBlue
class node_chat,node_ai_modes,node_ai_providers,node_code_execution,node_file_video,node_voice toneAmber
class node_learning_tools,node_karma_leaderboard,node_collaboration,node_openrouter,node_piston toneMint
class node_app,node_accounts,node_db_layer,node_database toneRose
class node_developer,node_ollama,node_groq,node_smtp,node_socketio toneIndigo
```

## Components

### Web experience

- [Dashboard and auth](https://github.com/dharani25007-code/zanaks-ai/blob/main/templates/index.html): `templates/index.html`
- [Feature pages](https://github.com/dharani25007-code/zanaks-ai/tree/main/templates): `templates`
- [Theme controls](https://github.com/dharani25007-code/zanaks-ai/blob/main/static/js/auth-theme-switcher.js): `static/js/auth-theme-switcher.js`

### AI coding

- [Chat orchestration](https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py): `app.py`
- [AI modes](https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py): `app.py`
- [AI providers](https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py): `app.py`
- [Code execution](https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py): `app.py`
- [File and video tools](https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py): `app.py`
- [Voice interface](https://github.com/dharani25007-code/zanaks-ai/blob/main/static/js/codebuddy_voice.js): `static/js/codebuddy_voice.js`

### Learning features

- [Learning tools](https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py): `app.py`
- [Karma and leaderboard](https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py): `app.py`
- [Live collaboration](https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py): `app.py`

### Platform services

- [Flask application](https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py): `app.py`
- [Accounts and recovery](https://github.com/dharani25007-code/zanaks-ai/blob/main/app.py): `app.py`
- [Database adapter](https://github.com/dharani25007-code/zanaks-ai/blob/main/appcore/db.py): `appcore/db.py`
- **Application database**

### Other components

- **Developer**
- **Ollama**
- **Groq**
- **OpenRouter**
- **Piston API**
- **SMTP mailer**
- **Socket.IO**

## Connections

- Developer → Dashboard and auth: uses (evidence: `README.md`)
- Dashboard and auth → Flask application: submits requests
- Flask application → Accounts and recovery: handles accounts (evidence: `README.md`)
- Accounts and recovery → Application database: stores account data
- Flask application → Chat orchestration: routes chat (evidence: `README.md`)
- Chat orchestration → AI modes: selects mode (evidence: `README.md`)
- Chat orchestration → AI providers: requests completions (evidence: `README.md`)
- AI providers → Ollama: tries local AI (evidence: `README.md`)
- AI providers → Groq: falls back (evidence: `README.md`)
- AI providers → OpenRouter: falls back (evidence: `README.md`)
- Flask application → Code execution: routes execution (evidence: `README.md`)
- Code execution → Piston API: uses execution API (evidence: `README.md`)
- Flask application → File and video tools: provides tools (evidence: `README.md`)
- Flask application → Learning tools: provides learning features (evidence: `README.md`)
- Flask application → Karma and leaderboard: provides rankings (evidence: `README.md`)
- Flask application → Live collaboration: provides live rooms (evidence: `README.md`)
- Live collaboration → Socket.IO: uses realtime transport (evidence: `README.md`)
- Accounts and recovery → SMTP mailer: sends recovery mail (evidence: `README.md`)
- Flask application → Database adapter: initializes adapter (evidence: `appcore/db.py`)
- Database adapter → Application database: connects SQLite or PostgreSQL (evidence: `appcore/db.py`)
- Feature pages → Flask application: presents features
- Developer → Voice interface: speaks commands (evidence: `README.md`)
- Voice interface → Chat orchestration: queries assistant
- Developer → Theme controls: chooses theme (evidence: `static/js/auth-theme-switcher.js`)
