How alasaihi001/quizforge works
QuizForge AI turns course material into streamed MCQs, flashcards, or summaries, with multilingual input, saved generation history, sharing, and PRO PDF export. The main workflow runs from the dashboard generation form through the API’s authentication, rate-limit, credit, prompt, and Groq steps; the client parses and renders the result. Separate branches cover accounts, subscriptions, and daily credit resets. Paths and links reflect the provided tree, excerpts, and README; unsampled details are represented only where documented, and uncertain sharing wiring is left unverified.
Main entry points: generate/route.ts Generation API · prisma.ts Prisma client · generate-page-client.tsx Generation form · [...nextauth]/route.ts Credentials auth
Components 24
Access and accounts
- Credentials auth
src/app/api/auth/[...nextauth]/route.ts - Registration
src/components/auth/register-form.tsx - Dashboard
src/app/dashboard/page.tsx
Study generation
- Generation form
src/components/dashboard/generate-page-client.tsx - Generation API
src/app/api/generate/route.ts - Mode prompts
src/lib/prompts.ts - Groq AI
- Result parser
src/lib/parsers.ts - Result displays
src/components/dashboard/results - Generation history
src/app/dashboard/history/page.tsx - Public share links
src/app/share/[token]/page.tsx - Share endpoint
src/app/api/share/[token]/route.ts - PDF download
src/components/dashboard/pdf-download-button.tsx - PDF formats
src/components/pdf
Plans and credits
- Billing endpoints
src/app/api/stripe/checkout/route.ts - Subscription portal
src/app/api/stripe/portal/route.ts - Billing webhook
src/app/api/stripe/webhook/route.ts - Stripe
- Daily credit reset
src/app/api/cron/reset-credits/route.ts
Persistence and services
- Prisma client
src/lib/prisma.ts - PostgreSQL
- Rate limiter
src/lib/rate-limit.ts - Upstash Redis
Other components
- Student
Connections 31
- Student → Registration: registers
- Student → Credentials auth: signs in
- Student → Dashboard: uses
- Registration → Credentials auth: creates account
- Credentials auth → Prisma client: reads users
src/app/api/auth/[...nextauth]/route.ts - Dashboard → Generation form: opens
src/app/dashboard/page.tsx - Generation form → Generation API: submits content
src/components/dashboard/generate-page-client.tsx - Generation API → Credentials auth: checks session
src/app/api/generate/route.ts - Generation API → Rate limiter: checks limit
src/app/api/generate/route.ts - Rate limiter → Upstash Redis: limits requests
- Generation API → Prisma client: checks credits
src/app/api/generate/route.ts - Generation API → Mode prompts: builds prompt
src/app/api/generate/route.ts - Generation API → Groq AI: streams request
src/app/api/generate/route.ts - Generation API → Prisma client: saves and decrements
src/app/api/generate/route.ts - Generation API → Generation form: streams response
- Generation form → Result parser: parses output
src/components/dashboard/generate-page-client.tsx - Generation form → Result displays: renders results
src/components/dashboard/generate-page-client.tsx - Dashboard → Generation history: opens history
- Prisma client → PostgreSQL: persists records
- Share endpoint → Prisma client: reads generation
src/app/api/share/[token]/route.ts - Public share links → Share endpoint: loads shared item
- Generation form → Public share links: offers share link
- Generation form → PDF download: offers export
src/components/dashboard/generate-page-client.tsx - PDF download → PDF formats: formats document
src/components/dashboard/pdf-download-button.tsx - Billing endpoints → Credentials auth: checks session
src/app/api/stripe/checkout/route.ts - Billing endpoints → Prisma client: loads customer
src/app/api/stripe/checkout/route.ts - Billing endpoints → Stripe: creates checkout
src/app/api/stripe/checkout/route.ts - Subscription portal → Stripe: creates portal
src/app/api/stripe/portal/route.ts - Billing webhook → Stripe: verifies events
src/app/api/stripe/webhook/route.ts - Billing webhook → Prisma client: updates plan credits
src/app/api/stripe/webhook/route.ts - Daily credit reset → Prisma client: resets credits
src/app/api/cron/reset-credits/route.ts