A modern, intelligent terminal-based flashcard application with spaced repetition learning
Learn efficiently with the proven SM-2 spaced repetition algorithm - the same algorithm used by Anki!
๐ Version 1.2.0 is here! Major update with custom study sessions, achievements, learning streaks, and comprehensive analytics!
- SM-2 Spaced Repetition - Scientifically proven to optimize memory retention
- Adaptive Scheduling - Cards appear less frequently as you master them
- Performance Tracking - Algorithm learns from your answers
- Flexible Session Lengths - Quick (10), Standard (25), Intensive (50), or Custom
- Intuitive Arrow Navigation - Easy selection with arrow keys and Enter
- Smart Back Navigation - Go back to previous menus at any step
- Graceful Exit Options - Quit anytime without killing the terminal
- Skip Functionality - Skip difficult cards and return later
- Session Summaries - Track progress and see what's remaining
- Progress Saving - Automatic saving at every step
- Tag-Based Filtering - Study specific topics or categories
- Difficulty-Based Filtering - Focus on new, learning, young, or mature cards
- Flexible Limits - Set custom card counts per session
- Random Order Option - Shuffle cards for varied practice
- Mixed Filtering - Combine tags and difficulty filters
- Tag System - Organize cards with multiple tags per card
- Add/Edit/Delete cards with intuitive CLI interface
- Quick List View - See all cards at a glance with tags and status
- Interactive Card Browser - Browse cards one by one with full content
- Search through your flashcard collection
- Tag Management - Edit card tags with ease
- Local JSON Storage ready for backend integration
- Daily Streak Tracking - Track consecutive study days
- Achievement System - Unlock achievements for various milestones
- Progress Visualization - See your learning journey over time
- Motivation Features - Stay engaged with goals and rewards
- 8 Different Achievements - Cards, sessions, streaks, and mastery milestones
- Study Session History - Complete record of all study sessions
- Weekly Progress Tracking - See your learning patterns over weeks
- Tag Distribution Analysis - Understand which topics you study most
- Performance Metrics - Track accuracy, study time, and session data
- Learning Statistics - Comprehensive view of your progress
- Session Analytics - Detailed breakdown of study habits
- Anki-Style UX - Familiar difficulty rating system (0-4)
- Consistent @clack/prompts Interface - Beautiful, modern design throughout
- Colorful Interface - Clean, modern terminal design
- Keyboard-First - Optimized for terminal power users
- Progress Bars - Visual representation of achievement progress
- TypeScript with strict type safety
- Modular Architecture - Easy to extend and maintain
- Backend-Ready - Prepared for Node.js API integration
- Well-Documented - Comprehensive code documentation
- ๐ Quick Start
- ๐ How It Works
- ๐ฎ User Interface
- ๐พ Data Management
- ๐ ๏ธ Development
- ๐จ Technologies Used
- ๐ฎ Future Roadmap
- ๐ค Contributing
- ๐ License
# Install globally via npm
npm install -g terminal-anki
# That's it! The `anki` command is now available globally.# Start interactive mode
anki
# Jump directly into studying due cards
anki --study
# Show help message
anki --help# Start interactive mode (local)
npm start
# Run with TypeScript in development
npm run dev
# Build for production
npm run build
# Watch for changes during development
npm run watch| Command | Description |
|---|---|
anki |
Start interactive mode with main menu |
anki --study |
Jump directly into studying due cards |
anki --help |
Show help message and available options |
After installation, the application automatically creates 5 sample flashcards to get you started!
The anki command is now available from any directory in your terminal! ๐
# Jump directly into studying due cards
anki --study
# Or use local development
npm start -- --studyTerminal Anki uses the SM-2 (SuperMemo 2) algorithm, the gold standard for spaced repetition learning:
๐ Learning Progression:
New Card โ 1 Day โ 6 Days โ 15 Days โ 37 Days โ 91 Days...
Flexible Study Sessions:
๐ 15 cards due today
Study options:
๐ฏ Study all due cards (15)
๐ Study limited session
โ Cancel
Choose Session Length:
โ Quick session (10 cards)
โ Standard session (25 cards)
โ Intensive session (50 cards)
โ Custom number
โ Back to study options
In-Session Controls:
๐ Card 3/10
Question: Python
Choose your action:
โฏ ๐ Show Answer
โญ๏ธ Skip Card
โ Quit Session
Step 1: Choose Action
Choose your action:
โฏ ๐ Show Answer
โญ๏ธ Skip Card
โ Quit Session
Step 2: Rate Difficulty (After Seeing Answer)
How well did you know this?
โฏ โ Again (0) - Show card soon
๐ค Hard (1)
โ
Good (3)
๐ Easy (4)
โ Quit Session
Difficulty Rating Effects:
| Rating | Description | Effect on Schedule |
|---|---|---|
| 0 | Again | Reset to 10 minutes |
| 1 | Hard | Slightly increase interval |
| 3 | Good | Normal interval increase |
| 4 | Easy | Large interval increase |
- Easy cards (high ratings) appear less frequently
- Difficult cards (low ratings) appear more often
- Algorithm adapts to your personal learning pace
๐ง TERMINAL ANKI - Flashcard Learning System
๐ Total cards: 5 | โฐ Due today: 3 | ๐ฅ Streak: 2 days
? What would you like to do?
โฏ Study due cards # Start learning session
๐ฏ Custom study session # Filtered study by tags/difficulty
Add new card # Create new flashcard
List all cards # View all flashcards
Search cards # Find specific cards
Delete card # Remove flashcards
๐ Achievements # View unlocked achievements
๐ Analytics & History # Detailed progress dashboard
Statistics # Quick stats overview
Exit # Quit application- Choose session length โ Quick (10), Standard (25), Intensive (50), or Custom
- Question appears โ Read the front of the card
- Choose action โ Use arrow keys: Show Answer, Skip Card, or Quit Session
- Rate difficulty โ Use arrow keys: Again (0), Hard (1), Good (3), or Easy (4)
- Session summary โ See progress and remaining cards
Choose viewing mode:
๐ 6 cards available
How would you like to view your cards?
โฏ โก Quick List View
โ Browse Cards One by One
โ Back to Main Menu
Quick List View:
- Shows all cards with status (due/upcoming)
- Truncated text for overview
- Simple "๐ Back to main menu" button
Interactive Browser:
- Full card content without truncation
- Navigate previous/next through cards
- Show/hide answers for each card
- Return to main menu anytime
๐ Learning Statistics
----------------------------------------
๐ Total cards: 25
โฐ Due today: 8
๐ Total reviews: 142
๐ Average easiness: 2.67
๐ Card Distribution:
New (1 day): 3 cards
Learning (2-7 days): 7 cards
Young (1-4 weeks): 10 cards
Mature (1+ month): 5 cardsYour data is stored in flashcards.json with comprehensive tracking:
{
"cards": [
{
"id": "1",
"front": "TypeScript",
"back": "A typed superset of JavaScript",
"tags": ["programming", "typescript"],
"easiness": 2.5,
"interval": 6,
"repetitions": 2,
"nextReview": "2025-10-31T15:44:47.610Z",
"lastReview": "2025-10-25T15:44:47.610Z",
"createdAt": "2025-10-25T15:44:47.610Z"
}
],
"sessionHistory": [
{
"id": "1698224547123",
"startTime": "2025-10-25T15:55:47.123Z",
"endTime": "2025-10-25T16:25:47.456Z",
"cardsStudied": 15,
"correctAnswers": 12,
"incorrectAnswers": 3,
"averageDifficulty": 1.8,
"sessionType": "due",
"quitEarly": false
}
],
"learningStreak": {
"currentStreak": 3,
"longestStreak": 7,
"lastStudyDate": "2025-10-25T00:00:00.000Z",
"studyDates": ["2025-10-23", "2025-10-24", "2025-10-25"]
},
"achievements": [
{
"id": "first_session",
"name": "Study Beginner",
"description": "Complete your first study session",
"icon": "๐",
"category": "sessions",
"progress": {
"current": 1,
"required": 1,
"description": "sessions completed"
},
"unlockedAt": "2025-10-25T15:55:47.123Z"
}
]
}The codebase is structured to easily connect to a Node.js backend:
// Future API integration example
async function syncWithBackend(cards: Flashcard[]) {
const response = await fetch('/api/cards/sync', {
method: 'POST',
body: JSON.stringify(cards)
});
return response.json();
}# Clone the repository
git clone https://github.com/dandrok/terminal-anki.git
cd terminal-anki
# Install dependencies
npm install
# Build the application
npm run build
# Run in development mode
npm run dev
# Install globally for testing
npm linkterminal-anki/
โโโ src/ # TypeScript source code
โ โโโ index.ts # Main CLI application
โ โโโ types.ts # Type definitions
โ โโโ flashcard.ts # Card management & SM-2 algorithm
โ โโโ ui.ts # User interface layer
โโโ .claude/ # Claude documentation
โ โโโ CLAUDE.md # Detailed project docs
โโโ dist/ # Compiled JavaScript
โโโ flashcards.json # Local data storage
โโโ package.json # Dependencies & scripts
โโโ tsconfig.json # TypeScript configuration
โโโ README.md # This file
# Development mode with TypeScript
npm run dev
# Build for production
npm run build
# Watch for changes during development
npm run watch
# Clean build artifacts
npm run clean
# Code Quality & Linting
npm run lint # Run ESLint
npm run lint:fix # Auto-fix linting issues
npm run format # Format code with Prettier
npm run format:check # Check code formatting
npm run type-check # TypeScript type checking
npm run check # Run all checks (lint + type-check + format)This project uses automated code quality checks with pre-commit and pre-push git hooks:
# Pre-commit hook (runs automatically before each commit)
- ESLint linting with auto-fix
- TypeScript type checking
- Prettier code formatting verification
# Pre-push hook (runs automatically before each push)
- Full project build verification
- Ensures no compilation errorsManual Testing:
# Test what pre-commit checks
npm run check
# Test what pre-push checks
npm run buildanki # Interactive mode
anki --study # Direct study mode
anki --help # Show help message- TypeScript - Type-safe development with strict mode
- @clack/prompts - Modern, beautiful CLI prompts for navigation
- prompts - Interactive quiz interface with better control
- chalk - Terminal colors and styling
- ora - Loading spinners and animations
- ESLint - Code linting with TypeScript support
- Prettier - Code formatting and style consistency
- simple-git-hooks - Modern git hooks for pre-commit/pre-push automation
- typescript-eslint - TypeScript-specific ESLint rules
- SM-2 Spaced Repetition - Proven learning algorithm since 1985
- Easiness Factor - Personalized difficulty adjustment
- Interval Calculation - Optimal review timing
- Tag system for organizing flashcards by topics
- Custom study sessions (by tags, difficulty, limits)
- Learning streaks and achievements
- Study session history and analytics
- Enhanced analytics dashboard
- Progress tracking and gamification
- Card import/export (CSV, JSON)
- Bulk operations on cards
- Card decks and categories
- Review time statistics
- Study reminders and notifications
- Web interface for browser access
- Basic REST API backend
- Multi-device synchronization
- Media-rich cards (images, audio)
- Advanced search and filtering
- Mobile companion app
- Cloud-based backup and sync
- Collaborative learning features
- Advanced analytics dashboard
- AI-powered card suggestions
This project is licensed under the MIT License - see the LICENSE file for details.
- SuperMemo - For the SM-2 spaced repetition algorithm
- Anki - For inspiration and algorithm refinement
- Vercel - For the amazing @clack/prompts library
- Node.js Community - For the fantastic CLI ecosystem
Happy Learning! ๐
Built with โค๏ธ and TypeScript