# govindmehta/studyzen architecture

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

- Interactive diagram: https://gitdiagram.com/govindmehta/studyzen
- Repository: https://github.com/govindmehta/studyzen

## Overview

##### Project type and purpose
- This is a full-stack “StudyZen” web application acting as an AI-powered study companion.
- Frontend: React/TypeScript SPA built with Vite and Shadcn UI.
- Backend: FastAPI Python service leveraging LLMs (Google Gemini via LangChain), ChromaDB vector store, video & PDF processing, and auxiliary scripts.

##### File structure
- Top-level directories:
- /frontend – all UI code, components, pages, static assets, config (Vite, Tailwind, ESLint) and Prisma ORM schema/migrations.
- /backend – FastAPI entrypoint (main.py), routes (quiz.py, quiz.py, flowchart.py, etc.), AI integrations (rag.ipynb, graphvizzz.py, content.py), DB files (ChromaDB folder and SQLite), PDF & TTS utilities, requirements.txt.
- Patterns:
- Separation of concerns between UI and API.
- ORM migrations under frontend/prisma represent user auth & flashcard schemas.
- AI-centric modules for explanation, flowchart generation, quizzes, and TTS.
- Config & deployment:
- frontend/.env for VITE_API_URL
- backend/.env for GEMINI_API_KEY, YOUTUBE_API_KEY
- uvicorn startup in README.

##### README insights
- Tech stack calls out React, FastAPI, Prisma, ChromaDB, LangChain, OpenCV, Pandas.
- API endpoints: /explanation/, /generate_schedule/, /flowchart/, /videos/
- Database: Prisma (Postgres/SQLite) for user & progress, ChromaDB for vector embeddings.

## Diagram (Mermaid)

```mermaid
graph TB
  subgraph "Frontend Layer"
    direction TB
    React["React SPA"]:::frontend
    ViteConfig["Vite & Tailwind Config"]:::frontend
    Shadcn["Shadcn UI Components"]:::frontend
    Layout["Pages & Layout"]:::frontend
  end

  subgraph "Backend Service"
    direction TB
    FastAPI["FastAPI Service"]:::service
    subgraph "Modules"
      direction TB
      Quiz["Quiz Module"]:::service
      Flowchart["Flowchart Module"]:::service
      Graphviz["Graphviz Flowchart Engine"]:::service
      Schedule["Schedule Generator Module"]:::service
      Explanation["Explanation & RAG Orchestrator"]:::service
      PDF["PDF Processing Utilities"]:::service
      TTS["TTS Module"]:::service
      Sentiment["Sentiment Analysis Module"]:::service
    end
  end

  subgraph "Databases"
    direction TB
    PrismaDB["Prisma DB"]:::database
    Chroma["ChromaDB Vector Store"]:::database
  end

  subgraph "External APIs"
    direction TB
    Gemini["Google Gemini API"]:::external
    YouTube["YouTube API"]:::external
  end

  %% Connections
  React -->|"HTTP JSON"| FastAPI
  FastAPI --> Quiz
  FastAPI --> Flowchart
  FastAPI --> Schedule
  FastAPI --> Explanation
  FastAPI --> PDF
  FastAPI --> TTS
  FastAPI --> Sentiment
  FastAPI --> PrismaDB
  FastAPI --> YouTube
  Flowchart --> Graphviz
  Flowchart --> PDF
  Explanation --> Gemini
  Explanation --> Chroma
  Quiz --> PrismaDB

  %% Click Events
  click React "https://github.com/govindmehta/studyzen/tree/main/frontend/src/"
  click ViteConfig "https://github.com/govindmehta/studyzen/blob/main/frontend/vite.config.ts"
  click ViteConfig "https://github.com/govindmehta/studyzen/blob/main/frontend/tailwind.config.ts"
  click Shadcn "https://github.com/govindmehta/studyzen/tree/main/frontend/src/components/ui/"
  click Layout "https://github.com/govindmehta/studyzen/tree/main/frontend/src/pages/"
  click Layout "https://github.com/govindmehta/studyzen/tree/main/frontend/src/components/layout/"
  click FastAPI "https://github.com/govindmehta/studyzen/blob/main/backend/main.py"
  click Quiz "https://github.com/govindmehta/studyzen/blob/main/backend/quiz.py"
  click Flowchart "https://github.com/govindmehta/studyzen/blob/main/backend/flowchart.py"
  click Graphviz "https://github.com/govindmehta/studyzen/blob/main/backend/graphvizzz.py"
  click Schedule "https://github.com/govindmehta/studyzen/blob/main/backend/time_table.py"
  click Explanation "https://github.com/govindmehta/studyzen/blob/main/backend/content.py"
  click Explanation "https://github.com/govindmehta/studyzen/blob/main/backend/rag.ipynb"
  click PDF "https://github.com/govindmehta/studyzen/tree/main/backend/pdfs/"
  click Chroma "https://github.com/govindmehta/studyzen/tree/main/backend/db/"
  click Chroma "https://github.com/govindmehta/studyzen/blob/main/backend/db/chroma.sqlite3"
  click TTS "https://github.com/govindmehta/studyzen/blob/main/backend/tts.py"
  click TTS "https://github.com/govindmehta/studyzen/blob/main/backend/tts (1).py"
  click Sentiment "https://github.com/govindmehta/studyzen/blob/main/backend/sentiment.py"
  click PrismaDB "https://github.com/govindmehta/studyzen/blob/main/frontend/prisma/schema.prisma"
  click PrismaDB "https://github.com/govindmehta/studyzen/tree/main/frontend/prisma/migrations/"

  %% Styles
  classDef frontend fill:#CCF,stroke:#33A,stroke-width:2px
  classDef service fill:#CFC,stroke:#393,stroke-width:2px
  classDef database fill:#FFC,stroke:#DAA,stroke-width:2px
  classDef external fill:#EFC,stroke:#A33,stroke-width:2px
```
