# shankar-soni-2006/flashcard-generator architecture

> Architecture diagram of the GitHub repository shankar-soni-2006/flashcard-generator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shankar-soni-2006/flashcard-generator
- Repository: https://github.com/shankar-soni-2006/flashcard-generator

## Overview

AI Smart Flashcards turns user-provided topics, notes, code, vocabulary, or images into flashcard decks, then supports deck management, sharing, and SM-2 reviews with statistics. The principal path is authenticated client → generation or deck/review features → Express routes and controllers → AI, scheduling, or Supabase. The README documents five generation modes and the product capabilities; some page and service implementations were not sampled, so those links are shown only where documented or left out. The excerpted AI client uses Groq, despite the README describing Gemini; the provider is represented as shown in source.

Main entry points: [`client/src/App.jsx`](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/App.jsx) (App routing), [`server/app.js`](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/app.js) (Express API), [`server/config/supabase.js`](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/config/supabase.js) (Supabase client), [`server/controllers/reviewController.js`](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/controllers/reviewController.js) (Review workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client application"]
  node_app["App routing<br/>[App.jsx]"]
  node_auth["Authentication<br/>[AuthContext.jsx]"]
  node_client_services["Client services<br/>[index.js]"]
end

subgraph group_content["Decks and generation"]
  node_generate_page["Generate page<br/>[Generate.jsx]"]
  node_deck_pages["Deck pages<br/>[Decks.jsx]"]
  node_shared_page["Shared deck page<br/>[SharedDeck.jsx]"]
end

subgraph group_learning["Review and insights"]
  node_review_page["Review page<br/>[Review.jsx]"]
  node_statistics_page["Statistics page<br/>[Statistics.jsx]"]
  node_review_controller["Review workflow"]
  node_statistics_controller["Statistics"]
  node_sm2["SM-2 scheduler<br/>[sm2.js]"]
end

subgraph group_backend["API and domain logic"]
  node_api_app["Express API<br/>[app.js]"]
  node_ai_routes["AI routes<br/>[aiRoutes.js]"]
  node_deck_routes["Deck routes<br/>[deckRoutes.js]"]
  node_card_routes["Card routes<br/>[cardRoutes.js]"]
  node_review_routes["Review routes<br/>[reviewRoutes.js]"]
  node_statistics_routes["Statistics routes"]
  node_ai_controller["AI generation<br/>[aiController.js]"]
  node_deck_controller["Deck management<br/>[deckController.js]"]
  node_card_controller["Card management<br/>[cardController.js]"]
end

subgraph group_integrations["Persistence and AI"]
  node_supabase_client["Supabase client<br/>[supabase.js]"]
  node_generators["Generation modes"]
  node_generation_client["AI client<br/>[geminiClient.js]"]
  node_server_supabase["Supabase client<br/>[supabase.js]"]
  node_database[("Supabase database")]
end

node_learner(("Learner"))
node_groq{{"Groq API"}}

node_learner -->|"uses"| node_app
node_app -->|"provides auth"| node_auth
node_auth -->|"authenticates with"| node_supabase_client
node_app -->|"routes to"| node_generate_page
node_app -->|"routes to"| node_deck_pages
node_app -->|"routes to"| node_review_page
node_app -->|"routes to"| node_statistics_page
node_app -->|"routes to"| node_shared_page
node_review_page -->|"requests review data"| node_client_services
node_generate_page -->|"requests generation"| node_client_services
node_client_services -.->|"calls API"| node_api_app
node_api_app -->|"mounts"| node_ai_routes
node_api_app -->|"mounts"| node_deck_routes
node_api_app -->|"mounts"| node_card_routes
node_api_app -->|"mounts"| node_review_routes
node_api_app -->|"mounts"| node_statistics_routes
node_api_app -->|"routes public shares"| node_deck_controller
node_ai_routes -->|"dispatches"| node_ai_controller
node_deck_routes -->|"dispatches"| node_deck_controller
node_card_routes -->|"dispatches"| node_card_controller
node_review_routes -->|"dispatches"| node_review_controller
node_statistics_routes -->|"dispatches"| node_statistics_controller
node_ai_controller -->|"selects mode"| node_generators
node_generators -->|"generates with"| node_generation_client
node_generation_client -->|"requests completions"| node_groq
node_deck_controller -->|"reads and writes"| node_server_supabase
node_card_controller -->|"reads and writes"| node_server_supabase
node_review_controller -->|"reads and writes"| node_server_supabase
node_statistics_controller -->|"reads"| node_server_supabase
node_review_controller -->|"calculates schedule"| node_sm2
node_server_supabase -.->|"persists data"| node_database
node_learner -.->|"opens share link"| node_shared_page
node_learner -.->|"views insights"| node_statistics_page

click node_app "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/App.jsx"
click node_auth "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/context/AuthContext.jsx"
click node_supabase_client "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/lib/supabase.js"
click node_generate_page "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/pages/Generate.jsx"
click node_deck_pages "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/pages/Decks.jsx"
click node_review_page "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/pages/Review.jsx"
click node_statistics_page "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/pages/Statistics.jsx"
click node_shared_page "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/pages/SharedDeck.jsx"
click node_client_services "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/services/index.js"
click node_api_app "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/app.js"
click node_ai_routes "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/routes/aiRoutes.js"
click node_deck_routes "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/routes/deckRoutes.js"
click node_card_routes "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/routes/cardRoutes.js"
click node_review_routes "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/routes/reviewRoutes.js"
click node_statistics_routes "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/routes/statisticsRoutes.js"
click node_ai_controller "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/controllers/aiController.js"
click node_deck_controller "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/controllers/deckController.js"
click node_card_controller "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/controllers/cardController.js"
click node_review_controller "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/controllers/reviewController.js"
click node_statistics_controller "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/controllers/statisticsController.js"
click node_generators "https://github.com/shankar-soni-2006/flashcard-generator/tree/main/server/services/gemini"
click node_generation_client "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/services/gemini/geminiClient.js"
click node_sm2 "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/services/scheduler/sm2.js"
click node_server_supabase "https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/config/supabase.js"

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_app,node_auth,node_client_services toneBlue
class node_generate_page,node_deck_pages,node_shared_page toneAmber
class node_review_page,node_statistics_page,node_review_controller,node_statistics_controller,node_sm2,node_groq toneMint
class node_api_app,node_ai_routes,node_deck_routes,node_card_routes,node_review_routes,node_statistics_routes,node_ai_controller,node_deck_controller,node_card_controller toneRose
class node_supabase_client,node_generators,node_generation_client,node_server_supabase,node_database,node_learner toneIndigo
```

## Components

### Client application

- [App routing](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Authentication](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Client services](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/services/index.js): `client/src/services/index.js`

### Decks and generation

- [Generate page](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/pages/Generate.jsx): `client/src/pages/Generate.jsx`
- [Deck pages](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/pages/Decks.jsx): `client/src/pages/Decks.jsx`
- [Shared deck page](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/pages/SharedDeck.jsx): `client/src/pages/SharedDeck.jsx`

### Review and insights

- [Review page](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/pages/Review.jsx): `client/src/pages/Review.jsx`
- [Statistics page](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/pages/Statistics.jsx): `client/src/pages/Statistics.jsx`
- [Review workflow](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/controllers/reviewController.js): `server/controllers/reviewController.js`
- [Statistics](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/controllers/statisticsController.js): `server/controllers/statisticsController.js`
- [SM-2 scheduler](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/services/scheduler/sm2.js): `server/services/scheduler/sm2.js`

### API and domain logic

- [Express API](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/app.js): `server/app.js`
- [AI routes](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/routes/aiRoutes.js): `server/routes/aiRoutes.js`
- [Deck routes](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/routes/deckRoutes.js): `server/routes/deckRoutes.js`
- [Card routes](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/routes/cardRoutes.js): `server/routes/cardRoutes.js`
- [Review routes](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/routes/reviewRoutes.js): `server/routes/reviewRoutes.js`
- [Statistics routes](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/routes/statisticsRoutes.js): `server/routes/statisticsRoutes.js`
- [AI generation](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/controllers/aiController.js): `server/controllers/aiController.js`
- [Deck management](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/controllers/deckController.js): `server/controllers/deckController.js`
- [Card management](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/controllers/cardController.js): `server/controllers/cardController.js`

### Persistence and AI

- [Supabase client](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/client/src/lib/supabase.js): `client/src/lib/supabase.js`
- [Generation modes](https://github.com/shankar-soni-2006/flashcard-generator/tree/main/server/services/gemini): `server/services/gemini`
- [AI client](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/services/gemini/geminiClient.js): `server/services/gemini/geminiClient.js`
- [Supabase client](https://github.com/shankar-soni-2006/flashcard-generator/blob/main/server/config/supabase.js): `server/config/supabase.js`
- **Supabase database**

### Other components

- **Learner**
- **Groq API**

## Connections

- Learner → App routing: uses
- App routing → Authentication: provides auth (evidence: `client/src/App.jsx`)
- Authentication → Supabase client: authenticates with (evidence: `client/src/context/AuthContext.jsx`)
- App routing → Generate page: routes to (evidence: `client/src/App.jsx`)
- App routing → Deck pages: routes to (evidence: `client/src/App.jsx`)
- App routing → Review page: routes to (evidence: `client/src/App.jsx`)
- App routing → Statistics page: routes to (evidence: `client/src/App.jsx`)
- App routing → Shared deck page: routes to (evidence: `client/src/App.jsx`)
- Review page → Client services: requests review data (evidence: `client/src/pages/Review.jsx`)
- Generate page → Client services: requests generation (evidence: `client/src/pages/Generate.jsx`)
- Client services → Express API: calls API
- Express API → AI routes: mounts (evidence: `server/app.js`)
- Express API → Deck routes: mounts (evidence: `server/app.js`)
- Express API → Card routes: mounts (evidence: `server/app.js`)
- Express API → Review routes: mounts (evidence: `server/app.js`)
- Express API → Statistics routes: mounts (evidence: `server/app.js`)
- Express API → Deck management: routes public shares (evidence: `server/app.js`)
- AI routes → AI generation: dispatches (evidence: `server/routes/aiRoutes.js`)
- Deck routes → Deck management: dispatches (evidence: `server/routes/deckRoutes.js`)
- Card routes → Card management: dispatches (evidence: `server/controllers/cardController.js`)
- Review routes → Review workflow: dispatches (evidence: `server/routes/reviewRoutes.js`)
- Statistics routes → Statistics: dispatches (evidence: `server/routes/statisticsRoutes.js`)
- AI generation → Generation modes: selects mode (evidence: `server/controllers/aiController.js`)
- Generation modes → AI client: generates with (evidence: `server/services/gemini/notesGenerator.js`)
- AI client → Groq API: requests completions (evidence: `server/services/gemini/geminiClient.js`)
- Deck management → Supabase client: reads and writes (evidence: `server/controllers/deckController.js`)
- Card management → Supabase client: reads and writes (evidence: `server/controllers/cardController.js`)
- Review workflow → Supabase client: reads and writes (evidence: `server/controllers/reviewController.js`)
- Statistics → Supabase client: reads (evidence: `server/controllers/statisticsController.js`)
- Review workflow → SM-2 scheduler: calculates schedule (evidence: `server/controllers/reviewController.js`)
- Supabase client → Supabase database: persists data
- Learner → Shared deck page: opens share link (evidence: `README.md`)
- Learner → Statistics page: views insights (evidence: `README.md`)
