# balayogesh29/ai-assignment-agent architecture

> Architecture diagram of the GitHub repository balayogesh29/ai-assignment-agent, 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/balayogesh29/ai-assignment-agent
- Repository: https://github.com/balayogesh29/ai-assignment-agent

## Overview

AI Assignment Agent generates academic assignment drafts from a topic and page target. Users can submit, view, and manage drafts in either the React client or the standalone HTML/JavaScript client; those clients use separate documented backend options. The Python API delegates prompt construction and Gemini generation to backend modules, while the Express server handles generation itself. The React app also supports recent assignments and copy, regenerate, and clear actions. Relationships for the standalone client and Python service are documented in the README; source excerpts show the generation calls.

Main entry points: [`backend/ai_agent.py`](https://github.com/balayogesh29/ai-assignment-agent/blob/main/backend/ai_agent.py) (Gemini agent), [`src/App.tsx`](https://github.com/balayogesh29/ai-assignment-agent/blob/main/src/App.tsx) (Assignment workspace), [`frontend/script.js`](https://github.com/balayogesh29/ai-assignment-agent/blob/main/frontend/script.js) (HTML client), [`backend/main.py`](https://github.com/balayogesh29/ai-assignment-agent/blob/main/backend/main.py) (Generate API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_react["React Client"]
  node_react_app["Assignment workspace<br/>[App.tsx]"]
  node_react_mount["React mount<br/>[main.tsx]"]
end

subgraph group_vanilla["Standalone Client"]
  node_web_client["HTML client<br/>[script.js]"]
end

subgraph group_python["FastAPI Backend"]
  node_fastapi["Generate API<br/>[main.py]"]
  node_agent["Gemini agent<br/>[ai_agent.py]"]
  node_prompt["Academic prompts<br/>[prompts.py]"]
end

subgraph group_node["Express Backend"]
  node_express_api["Generate API<br/>[server.ts]"]
  node_node_generation["Gemini generation<br/>[server.ts]"]
end

node_user(("Assignment user"))
node_gemini{{"Google Gemini"}}

node_user -->|"submits topic"| node_react_app
node_react_mount -->|"mounts"| node_react_app
node_react_app -->|"posts request"| node_express_api
node_express_api -->|"dispatches generation"| node_node_generation
node_node_generation -->|"requests draft"| node_gemini
node_user -->|"submits topic"| node_web_client
node_web_client -->|"posts request"| node_fastapi
node_fastapi -->|"calls generator"| node_agent
node_agent -->|"builds prompt"| node_prompt
node_agent -->|"requests draft"| node_gemini

click node_react_app "https://github.com/balayogesh29/ai-assignment-agent/blob/main/src/App.tsx"
click node_react_mount "https://github.com/balayogesh29/ai-assignment-agent/blob/main/src/main.tsx"
click node_web_client "https://github.com/balayogesh29/ai-assignment-agent/blob/main/frontend/script.js"
click node_fastapi "https://github.com/balayogesh29/ai-assignment-agent/blob/main/backend/main.py"
click node_agent "https://github.com/balayogesh29/ai-assignment-agent/blob/main/backend/ai_agent.py"
click node_prompt "https://github.com/balayogesh29/ai-assignment-agent/blob/main/backend/prompts.py"
click node_express_api "https://github.com/balayogesh29/ai-assignment-agent/blob/main/server.ts"
click node_node_generation "https://github.com/balayogesh29/ai-assignment-agent/blob/main/server.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_react_app,node_react_mount,node_user toneBlue
class node_web_client toneAmber
class node_fastapi,node_agent,node_prompt toneMint
class node_express_api,node_node_generation toneRose
class node_gemini toneIndigo
```

## Components

### React Client

- [Assignment workspace](https://github.com/balayogesh29/ai-assignment-agent/blob/main/src/App.tsx): `src/App.tsx`
- [React mount](https://github.com/balayogesh29/ai-assignment-agent/blob/main/src/main.tsx): `src/main.tsx`

### Standalone Client

- [HTML client](https://github.com/balayogesh29/ai-assignment-agent/blob/main/frontend/script.js): `frontend/script.js`

### FastAPI Backend

- [Generate API](https://github.com/balayogesh29/ai-assignment-agent/blob/main/backend/main.py): `backend/main.py`
- [Gemini agent](https://github.com/balayogesh29/ai-assignment-agent/blob/main/backend/ai_agent.py): `backend/ai_agent.py`
- [Academic prompts](https://github.com/balayogesh29/ai-assignment-agent/blob/main/backend/prompts.py): `backend/prompts.py`

### Express Backend

- [Generate API](https://github.com/balayogesh29/ai-assignment-agent/blob/main/server.ts): `server.ts`
- [Gemini generation](https://github.com/balayogesh29/ai-assignment-agent/blob/main/server.ts): `server.ts`

### Other components

- **Assignment user**
- **Google Gemini**

## Connections

- Assignment user → Assignment workspace: submits topic (evidence: `README.md`)
- React mount → Assignment workspace: mounts (evidence: `src/main.tsx`)
- Assignment workspace → Generate API: posts request (evidence: `src/App.tsx`)
- Generate API → Gemini generation: dispatches generation (evidence: `server.ts`)
- Gemini generation → Google Gemini: requests draft (evidence: `server.ts`)
- Assignment user → HTML client: submits topic (evidence: `README.md`)
- HTML client → Generate API: posts request (evidence: `README.md`)
- Generate API → Gemini agent: calls generator (evidence: `backend/main.py`)
- Gemini agent → Academic prompts: builds prompt (evidence: `backend/ai_agent.py`)
- Gemini agent → Google Gemini: requests draft (evidence: `backend/ai_agent.py`)
