An AI-powered study assistant that transforms PDFs into personalized learning experiences. Upload a document, pick your mood, and Clarify generates flashcards, cramming sessions, or summaries β all powered by Claude.
flowchart TD
User(["π€ User"])
subgraph Client["Browser (Next.js Client Components)"]
Home["/ Home Page"]
FC["π /flashcards\nCreate & manage decks"]
CR["π§ /cramming\nInteractive study session"]
SM["π /summary\nAI document summary"]
LS[("πΎ localStorage\nFlashcard decks")]
end
subgraph Server["Next.js API Routes (Server)"]
EX["/api/extract\nPDF β Text\n(unpdf)"]
FL["/api/flashcards\nText β Flashcards\n(Claude Opus 4.6)"]
CF["/api/chat-flashcards\nConversation β Flashcards\n(Claude Opus 4.6)"]
SU["/api/summarize\nText β Summary\n(Claude Opus 4.6)"]
AT["/api/analyze-topics\nWrong cards β Weak topics\n(Claude Haiku 4.5)"]
end
subgraph Anthropic["Anthropic API"]
OP["Claude Opus 4.6\nFlashcard & Summary generation"]
HK["Claude Haiku 4.5\nWeak topic analysis"]
end
PDF[["π PDF File"]]
User --> Home
Home --> FC & CR & SM
FC -->|"Upload PDF"| PDF
FC -->|"Chat with AI"| CF
SM -->|"Upload PDF"| PDF
PDF -->|"POST /api/extract"| EX
EX -->|"Extracted text"| FL
EX -->|"Extracted text"| SU
FL -->|"POST /api/flashcards"| OP
CF -->|"POST /api/chat-flashcards"| OP
SU -->|"POST /api/summarize"| OP
AT -->|"POST /api/analyze-topics"| HK
OP -->|"Flashcard JSON"| FC
OP -->|"Flashcard JSON"| CF
OP -->|"Summary markdown"| SM
HK -->|"Topic strings"| CR
FC -->|"Save decks"| LS
LS -->|"Load decks"| CR
CR -->|"Session complete\n(wrong cards)"| AT
-
Upload any PDF and generate flashcards instantly
-
Choose a mood to control depth and quantity:
Mood Cards Style π΄ Tired 5 Short & simple π° Stressed 3 Critical points only π€ Annoyed 5 Blunt, no fluff π€ Curious 10 Deep & detailed -
Name decks, expand to preview cards inline, edit individual Q&A pairs
-
Add and delete cards manually
-
All decks persisted in
localStorage
- Generate flashcards on any topic through natural conversation β no PDF required
- Toggle "Chat with AI" on the flashcards page to open the chat panel
- Describe a topic and Claude generates 8 flashcards by default; ask for more, fewer, or a different focus and it regenerates the full set
- Claude may ask one clarifying question (depth, level, specific focus) before generating
- Pick any saved deck and start studying immediately
- Flip cards by clicking or keyboard shortcuts
- Mark each card Know It or Don't Know
- Real-time progress bar showing known / unknown / unreviewed counts
- Session statistics on completion:
- Accuracy percentage and performance grade
- Time spent total and per card
- AI-identified weak topics from missed cards
- Full list of cards you got wrong
- Retry only the wrong cards, or reset and go again
- Rename the deck inline during a session
- End session early with "Finish Session" button
| Key | Action |
|---|---|
| W / S / Space / β / β | Flip card |
| A / D / β / β | Navigate to previous/next card |
-
Upload a PDF and receive a mood-tailored summary:
Mood Style π΄ Tired 5 bullets, β€ 10 words each + funny analogy π° Stressed 3 numbered critical points, calm tone π€ Annoyed Blunt, no intro, fewest words possible π€ Curious Deep dive with insights and real-world context -
Two-stage loading: shows "Extracting PDF..." then "Generating summary..."
-
Rendered markdown with styled headings, bullets, and inline bold
-
Copy to clipboard or download as a formatted PDF
The app's core innovation is the mood system β four distinct emotional states that shape how the AI generates content. Each mood controls both the quantity and style of output.
Choose your current mental state when generating content:
| Mood | When to Use |
|---|---|
| π΄ Tired | Late night studying, quick reviews |
| π° Stressed | Exam eve, need only the essentials |
| π€ Annoyed | Want to get it done fast, no fluff |
| π€ Curious | Deep learning, thorough understanding |
| Mood | Card Count | Characteristics |
|---|---|---|
| π΄ Tired | 5 | Super short Q&A, minimal detail |
| π° Stressed | 3 | Only critical points, cram-friendly |
| π€ Annoyed | 5 | Blunt, direct, no filler |
| π€ Curious | 10 | Comprehensive, includes nuances |
| Mood | Output Style |
|---|---|
| π΄ Tired | 5 bullets max, β€10 words each, includes a funny analogy |
| π° Stressed | 3 numbered critical points, calming tone |
| π€ Annoyed | Fewest words possible, no intro/outro |
| π€ Curious | Full markdown with headings, insights, context |
| Layer | Technology |
|---|---|
| Framework | Next.js 16.2.3 (App Router) |
| Language | TypeScript 6 (strict mode) |
| Styling | Tailwind CSS v4 |
| UI Components | shadcn/ui + Base UI + Lucide React |
| AI | Anthropic Claude (Opus 4.6 + Haiku 4.5) |
| PDF Extraction | unpdf |
| PDF Export | jsPDF |
| Fonts | Geist Sans + Geist Mono (next/font) |
| Storage | Browser localStorage |
| Deployment | Vercel |
clarify/
βββ app/
β βββ api/
β β βββ extract/route.js # PDF β plain text (unpdf)
β β βββ flashcards/route.js # Text β flashcard JSON (Claude Opus)
β β βββ chat-flashcards/route.js # Conversation β flashcards (Claude Opus)
β β βββ summarize/route.js # Text β summary markdown (Claude Opus)
β β βββ analyze-topics/route.js # Wrong cards β weak topics (Claude Haiku)
β βββ cramming/
β β βββ page.tsx # Interactive study session
β βββ flashcards/
β β βββ page.tsx # Deck management + creation + AI chat
β βββ summary/
β β βββ page.tsx # PDF summarization
β βββ utils/
β β βββ aiApi.ts # Client-side API helpers + types
β β βββ crammingHelpers.ts # Session logic helpers
β β βββ deckAccents.ts # Deck color accent classes
β βββ globals.css
β βββ layout.tsx
β βββ page.tsx # Landing page
βββ components/
β βββ flashcards/ # Flashcard components
β β βββ CreateDeckView.tsx
β β βββ EditDeckView.tsx
β β βββ DeckCard.tsx
β β βββ ChatDeckCreator.tsx
β β βββ QACard.tsx
β β βββ ModeToggle.tsx
β β βββ DeckActions.tsx
β β βββ ConfirmDeleteModal.tsx
β βββ summary/ # Summary components
β β βββ FileUpload.tsx
β β βββ SummaryContent.tsx
β β βββ RenderSummary.tsx
β β βββ ProcessingPDF.tsx
β β βββ MoodSelector.tsx
β β βββ ActionsSection.tsx
β βββ ui/ # shadcn/ui base components
β βββ button.tsx
β βββ navigation-menu.tsx
βββ lib/
β βββ utils.ts # cn() className merger
β βββ prompts.js # Mood-based prompt templates
βββ utils/
β βββ flashcardStorage.ts # localStorage helpers
β βββ pdfExport.ts # PDF download functionality
βββ package.json
βββ next.config.ts
βββ tsconfig.json- Node.js 18+
- An Anthropic API key
git clone https://github.com/SamuelIVX/clarify.git
cd clarify
npm installCreate a .env.local file in the project root:
# .env.local
ANTHROPIC_API_KEY=your_anthropic_api_key_herenpm run devOpen http://localhost:3000.
npm run build
npm startThe app is deployed on Vercel. To deploy your own:
- Push to
mainβ Vercel auto-deploys on every push when connected to GitHub. - Add
ANTHROPIC_API_KEYin your Vercel project under Settings β Environment Variables.
The
/api/extractroute setsmaxDuration = 60to handle large PDFs within Vercel's serverless timeout.
| Route | Method | Input | Output | Model |
|---|---|---|---|---|
/api/extract |
POST | FormData { pdf: File } |
{ text: string } |
β (unpdf) |
/api/flashcards |
POST | { text, mood } |
{ flashcards: [{question, answer}] } |
Claude Opus 4.6 |
/api/chat-flashcards |
POST | { messages: Message[] } |
{ message: string, flashcards: [{question, answer}] | null } |
Claude Opus 4.6 |
/api/summarize |
POST | { text, mood } |
{ summary: string } |
Claude Opus 4.6 |
/api/analyze-topics |
POST | { flashcards: Flashcard[] } |
{ topics: string[] } |
Claude Haiku 4.5 |
All routes run server-side only. ANTHROPIC_API_KEY is never exposed to the client.