A Next.js (App Router) frontend for quiz generation/playback and PDF-based document chat, with Clerk authentication.
npm installnpm run dev- Default URL:
http://localhost:3000
npm run buildnpm startnpm run lint- Marketing/landing page composed of sections like Hero, Features, Pricing, and Testimonials.
- Entry point that typically links to Quiz, Document Chat, and Auth flows.
Implemented in app/quiz.
Flow (via Zustand quizStore):
-
setupphase –QuizSetup- User configures quiz settings (e.g., topic, difficulty, etc.).
-
loadingphase – (currently reusesQuizSetupin code)- Can be adapted to show loading UI while questions are being prepared.
-
playingphase –QuizPlayer- User answers questions in an interactive quiz UI.
-
resultphase –QuizResult- Displays quiz results (score, correct/incorrect answers, etc.).
- Uses
Chart.tsx(Recharts) to visualize performance with charts/graphs.
Key Quiz Features:
- Multi-phase quiz experience: setup → play → result.
- Visual result analytics using Recharts.
- Clean separation of components:
QuizSetup,QuizPlayer,QuizResult,Chart, andquizStore.
Implemented in app/documentChat with a modular structure (components, hooks, store, services, utils).
Main UI Components:
DocumentUploader– Upload PDF documents.DocumentViewer– Render uploaded PDFs usingreact-pdf/pdfjs-distandusePdfViewer/pdfHelpers.ChatWindow– Displays the chat conversation.ChatMessage– Renders individual messages (user + AI).ChatInput– Input box to send questions about the document.ChatSideBar– Can show previous chats/sessions or document metadata.DocumentToolbar– Controls like zoom, page navigation, etc.DocumentWithChat– Layout component that combines viewer + chat into a single experience.
State & API:
-
documentChatStore.ts(Zustand)- Manages chat state, current document, messages, and loading flags.
-
documentChatApi.ts- Service layer for calling backend APIs (uploading documents, getting AI responses, etc.).
Key Document Chat Features:
- Upload and view PDFs directly in the browser.
- Ask questions about the document and get AI responses (backed by your API).
- Integrated layout: PDF viewer and chat side-by-side with toolbar and sidebar.
A small demo route showing how to call the backend with a Clerk-issued JWT token.
-
Uses
useAuthfrom@clerk/clerk-reactto get a JWT:const { getToken } = useAuth(); const token = await getToken({ template: "Postman" });
-
Sends a
POSTrequest to:http://127.0.0.1:8000/api/video_to_quiz/generate
-
Includes the JWT in the
Authorization: Bearer <token>header and logs the response.
Use Case:
Developer testing / debugging of the auth + backend integration.
From the folder structure:
app/(auth)/login/[[...login]]/page.tsx→ typically exposed as/loginapp/(auth)/signup/[[...signup]]/page.tsx→ typically exposed as/signup
Features:
- Clerk-based authentication (email/password and/or OAuth depending on Clerk config).
- Once logged in, protected flows (e.g.,
/quiz,/documentChat, backend calls) can use Clerk JWT.
- Framework: Next.js 15 (App Router)
- Language: TypeScript + React 19
- Styling: Tailwind CSS 4, custom UI components
- State Management: Zustand (
quizStore,documentChatStore) - Auth: Clerk (
@clerk/nextjs,@clerk/clerk-react) - Charts: Recharts (
Chart.tsxin the Quiz module) - PDF Handling:
react-pdf,pdfjs-dist, customusePdfViewerhook andpdfHelpers - HTTP/API:
axiosand nativefetch
npm installnpm run dev- Open in browser:
http://localhost:3000/quiz– Quiz flow and results with chartshttp://localhost:3000/documentChat– PDF upload + document chathttp://localhost:3000/checkjwt– JWT + backend API test (for developers)http://localhost:3000/login/signup– Clerk auth screens
This is a Next.js project bootstrapped with create-next-app.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devOpen http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.