A modern spaced repetition learning application built with Next.js 15, featuring the SM-2 algorithm for optimal knowledge retention.
- Flexible Import: Import questions from markdown or JSON with multiple format support
- Category Organization: Organize questions into subjects/topics (Math, History, etc.)
- Multiple Question Types:
- Regular multiple choice (single or multiple correct answers)
- Drag-and-drop sorting questions
- Fill-in-the-blank with text input
- Type Conversion: Switch between question types anytime in the editor
- Live Preview: See parsed questions in real-time as you type
- CRUD Operations: Create, view, edit, and delete questions
- Export/Import: Full backup and restore with JSON export/import
- Rich Explanations: Markdown formatting in explanations (optional)
- Spaced Repetition: Industry-standard SM-2 algorithm
- Category Filtering: Study specific subjects/topics
- Three Study Modes:
- Review Due: Only study questions due today (most efficient)
- All Questions: Practice everything in order
- Random Order: Shuffled questions for variety
- Interactive Question Types:
- Multiple choice with randomized answer positions
- Drag-and-drop sorting (arrange items in correct order)
- Text input for fill-in-the-blank questions
- Immediate Feedback: See correct/incorrect answers instantly
- Progress Tracking: Visual progress bar and question counter
- Progress Dashboard: Track your learning over time
- Category Filtering: View statistics per subject/topic
- Four Learning States:
- π΅ New: Never reviewed
- π Learning: 1 correct answer
- π’ Review: 2+ consecutive correct (mastered)
- π΄ Due Today: Questions needing review
- Backup & Restore: Export/import statistics to preserve learning progress
- Orphaned Data Cleanup: Detect and remove statistics for deleted questions
- Upcoming Reviews: See what's coming in the next 10 reviews
- Mastery Percentage: Track overall progress per category
- Dark Mode: Full dark mode support with system preference detection
- Responsive Design: Works perfectly on mobile, tablet, and desktop
- Keyboard Navigation: Full keyboard accessibility
- Category Badges: Visual indicators showing question categories
- Interactive UI: Drag-and-drop sorting, text input validation
- Smart Validation: Detailed error reporting on import failures
- No Backend Required: All data stored locally in your browser
- Node.js 18+
- npm or pnpm
# Clone the repository
git clone https://github.com/benchuangxd/learning-app.git
cd learning-app
# Install dependencies
npm install
# Run development server
npm run devOpen http://localhost:3000 in your browser.
Navigate to the Questions page and choose your import method:
Paste your questions in markdown format with optional category:
**Question 1 (1 point)**
Which of the following best defines an Embedded System?
A. A system that only uses analogue electronics.
B. A general-purpose computer for various tasks.
C. A standalone software application.
D. A computing system dedicated to a specific task. β
β Embedded systems are specialized computing systems designed for one dedicated purpose.
**Question 2 (1 point)** - Sorting Question
Sort from least to most intrusive (#1 to #4):
#1 Desk-checking
#2 Hardware Breakpoints
#3 LED monitoring
#4 Print statements
β Each method has different performance impacts.
**Question 3 (1 point)** - Fill-in-Blank
A ___ count is used to obtain a 1-second timer.
30,000,000 β
β This is the cycle count for a 1-second delay.
---Supported Formats:
- Regular Multiple Choice: A-F labeled choices, bullet lists
- Sorting Questions: #1, #2, #3, #4 numbering for correct order
- Fill-in-Blank: Use
___in question text with one correct answer - Multiple correct answers (multiple β marks)
- Optional explanations: Can be blank, but must exist as field (
"explanation": "") - Markdown formatting in explanations
Validation Rules:
- Each question must have: id, text, points, difficulty, choices array
- Explanation field required but can be empty string
- At least one choice must be marked correct (β )
- Sorting questions need unique, sequential order numbers (1, 2, 3, 4...)
- Fill-in-blank needs exactly one correct answer
- Import shows detailed errors for any validation failures
Import questions from exported JSON files:
- Preserves all question data and types (regular, sorting, fill-in-blank)
- Includes category information
- Choose to merge with existing or replace all
- Detailed validation: Shows exactly which questions failed and why
- Upfront warnings: Tells you before import how many will be skipped
- Blank explanations are allowed
When importing, optionally specify a category (e.g., "Math", "History"):
- Type in the category field or select from existing categories
- Autocomplete suggests previously used categories
- Leave blank for no category
- Filter questions by category on all pages
Go to the Study page:
- (Optional) Filter by Category: Select a specific subject to study
- Choose a Study Mode:
- Review Due: Most efficient - only studies questions due today
- All Questions: Practice everything in order
- Random Order: Shuffled for varied practice
Interactive Question Types:
- Multiple Choice: Click to select answer(s)
- Sorting: Drag items into correct order (#1 to #4)
- Fill-in-Blank: Type the answer in the text field
Visit the Statistics page to see:
- (Optional) Filter by Category: View stats for specific subjects
- Your mastery percentage (overall or per category)
- Questions in each learning state
- Upcoming review schedule
- Overall progress metrics
Export Your Data:
- Questions: Export all questions to JSON (preserves types, categories, all data)
- Statistics: Export learning progress (spaced repetition data, review schedules)
Import Your Data:
- Questions: Import from JSON with merge or replace options
- Statistics: Import progress data with smart question matching
- Validation: Detailed error reporting shows exactly what failed
- Orphaned Cleanup: Automatically skips statistics for deleted questions
Use Cases:
- Backup before making changes
- Transfer between devices
- Share question sets with others
- Archive historical learning data
The app uses the SM-2 algorithm (used by Anki, SuperMemo):
Answer correctly β Review in 1 day
Answer correctly again β Review in 6 days
Keep answering correctly β Intervals grow exponentially (15d, 37d, 93d...)
Answer incorrectly β Reset to 1 day
- New (π΅): Never studied - review immediately
- Learning (π ): 1 correct answer - still learning
- Review (π’): 2+ correct - mastered, long intervals
- Due (π΄): Time to review again
- β Optimal review timing prevents forgetting
- β Focuses study time on difficult material
- β Minimizes daily review burden
- β Maximizes long-term retention
- Framework: Next.js 15 with App Router
- React: Version 19
- TypeScript: Strict mode enabled
- Build Tool: Turbopack (default in Next.js 15)
- Tailwind CSS V4: CSS-first configuration
- ShadCN UI: CLI-based component library
- Radix UI: Headless accessible components
- SM-2: Spaced repetition algorithm
- LocalStorage: Browser-based persistence
- @dnd-kit: Drag-and-drop library for sorting questions
- ESLint: Code linting
- Prettier: Code formatting
- TypeScript: Zero
anytypes - Type Safety: 100% type coverage
learning-app/
βββ app/ # Next.js App Router pages
β βββ layout.tsx # Root layout with theme
β βββ page.tsx # Home page
β βββ questions/ # Question management
β βββ study/ # Study session
β βββ statistics/ # Progress tracking
βββ components/
β βββ layout/ # Navigation, theme toggle
β βββ questions/ # Import, list components
β βββ study/ # Study session component
β βββ ui/ # ShadCN UI components
βββ lib/
β βββ algorithms/ # SM-2 algorithm
β βββ services/ # Review management
β βββ storage/ # LocalStorage adapter
β βββ parsers/ # Question parser
βββ types/ # TypeScript definitions
βββ docs/ # Reference documentation
Edit app/globals.css to customize colors:
@theme {
--color-primary: #3b82f6; /* Primary blue */
--color-secondary: #8b5cf6; /* Secondary purple */
--color-success: #10b981; /* Success green */
--color-error: #ef4444; /* Error red */
}Toggle dark mode using the sun/moon icon in the navbar. Choices:
- βοΈ Light: Always light theme
- π Dark: Always dark theme
- π» System: Follow OS preference (default)
# Development
npm run dev # Start dev server with Turbopack
npm run build # Build for production
npm start # Start production server
# Code Quality
npm run lint # Run ESLint
npm run type-check # Run TypeScript type checking
npm run format # Format code with Prettier- β 100% Local: All data stored in your browser
- β No Backend: No server, no database
- β No Tracking: No analytics or tracking
- β No Accounts: No sign-up required
- β Offline Ready: Works without internet (after first load)
Important Notes:
- Data is stored in browser LocalStorage
- Clearing browser data will delete your questions and progress
- Always export your data before clearing browser data or switching browsers
- Use export/import to transfer between devices or backup your progress
Multiple Format Support:
# Format 1: Regular Multiple Choice
A. Option 1
B. Option 2 β
# Format 2: Bullet List
- Option 1
- Option 2 β
# Format 3: Multiple Correct Answers
A. Correct β
B. Also Correct β
C. Wrong
# Format 4: Sorting Question
Sort from lowest to highest (#1 to #4):
#1 One
#2 Two
#3 Three
#4 Four
# Format 5: Fill-in-Blank
The answer is ___.
42 β
Category Organization:
- Assign categories during text or JSON import
- Filter questions by category on Questions page
- Categories preserved in export/import
Features:
- One question at a time for focus
- Category filtering (study specific subjects)
- Interactive Question Types:
- Multiple Choice: Randomized answer positions
- Sorting: Drag-and-drop items into correct order
- Fill-in-Blank: Text input with flexible validation
- Visual feedback (green = correct, red = incorrect)
- Explanation shown after answering
- Progress tracking
- Session summary with score
Metrics:
- Category filtering (view stats per subject)
- Total questions in library (filtered or all)
- Questions due today
- Review questions (% mastered)
- Questions in learning phase
- Progress breakdown with visual bars
- Next 10 upcoming reviews
Data Management:
- Export statistics (backup learning progress)
- Import statistics (restore from backup)
- Smart Question Matching: Statistics link to questions by ID
- Orphaned Detection: Warns about statistics for deleted questions
- Automatic Cleanup: Export skips orphaned data automatically
- Manual Cleanup: One-click removal of orphaned statistics
- Category-based organization
This project uses:
- Linear for issue tracking
- Factory AGENTS.md for AI agent instructions
- Conventional Commits for commit messages
MIT License - feel free to use this project for learning!
- SM-2 Algorithm: SuperMemo
- ShadCN UI: shadcn/ui
- Tailwind CSS: tailwindcss.com
- Next.js: nextjs.org
"Only X questions imported instead of Y":
- Click the warning message to see validation errors
- Common issues:
- Missing explanations (must exist as field, but can be blank:
"explanation": "") - No correct answer marked (at least one choice needs β )
- Invalid choice structure
- Sorting questions with duplicate/non-sequential order numbers
- Missing explanations (must exist as field, but can be blank:
"Export/Import doesn't preserve my data":
- Make sure to export BOTH questions and statistics
- Import questions first, then import statistics
- Statistics link to questions by ID, so questions must exist first
"Statistics counts don't match":
- You likely have orphaned statistics (progress data for deleted questions)
- Visit Statistics page β Statistics Backup section
- Look for warning about orphaned statistics
- Click "Clean up" to remove them
"No items to drag":
- Refresh the page and try again
- Make sure questions have
correctOrderfield (1, 2, 3, 4...) - Export/import preserves sorting question data
"Categories not showing":
- Import questions with categories assigned
- Categories auto-appear once questions have them
- Use autocomplete when importing to select existing categories
For issues or questions, please check:
AGENTS.md- Project structure and conventionsdocs/- Detailed technical documentationplanning/LINEAR_TICKETS.md- Feature roadmap- Tips & Troubleshooting section above
Current Features (v1.0):
- β Question import and management (text and JSON)
- β Three question types (multiple choice, sorting, fill-in-blank)
- β Question type conversion in editor
- β Category organization and filtering
- β Export/import for questions and statistics
- β SM-2 spaced repetition
- β Study sessions with interactive question types
- β Category filtering on all pages
- β Statistics dashboard with backup/restore
- β Orphaned data cleanup
- β Dark mode support
Future Enhancements (Optional):
- π Performance charts over time
- π Calendar view of reviews
- β¨οΈ Keyboard shortcuts dialog
- π Sync across devices (via export/import)
- π·οΈ Tags in addition to categories
- π Advanced analytics per category
- π¨ Image support in questions
- π Audio support for language learning
Made with β€οΈ using Next.js 15, Tailwind V4, and TypeScript
Start learning smarter, not harder! π