Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data โ all from the browser, and deployed in milliseconds.
A full-featured flashcard application with spaced repetition learning, built for Val Town.
- Deck Management: Create, edit, and delete flashcard decks
- Card Creation: Add unlimited flashcards with front (question) and back (answer)
- Spaced Repetition: Smart learning algorithm (SM-2) that shows cards at optimal intervals
- Study Sessions: Intuitive study mode with card flipping and 4-level difficulty ratings
- Statistics: Track your learning progress with detailed metrics
- Backup & Restore: Export/import your data as JSON
Uses the proven SM-2 algorithm (same foundation as Anki) to optimize your learning:
- Again: Didn't remember - Review again soon
- Hard: Remembered with difficulty - Review in a few days
- Good: Remembered correctly - Review at normal interval
- Easy: Remembered instantly - Review much later
Cards become easier or harder based on your performance, maximizing retention while minimizing study time.
- Total cards created across all decks
- Total reviews completed
- Total study time
- Average accuracy percentage
- Detailed session history with per-deck performance
- Username-based login (no password required)
- Per-user data isolation using Val Town blob storage
- JSON backup/restore for data portability
- All data stored securely in Val Town's infrastructure
- Login: Enter any username (creates new user if doesn't exist)
- Create a Deck: Click "Create Deck" and give it a name
- Add Cards: Open your deck and add flashcards (front and back)
- Study: Click "Study" to begin learning with spaced repetition
- Track Progress: View your statistics to see your learning journey
- Read the question (front of card)
- Try to recall the answer
- Click "Show Answer" to flip the card
- Rate your recall:
- Again (red): Didn't remember
- Hard (orange): Remembered with difficulty
- Good (green): Remembered correctly
- Easy (blue): Remembered instantly
- The algorithm schedules the next review based on your rating
- Click "Backup" in the navigation
- Click "Download Backup" to export as JSON
- Save the file somewhere safe
- To restore: Select the file and click "Restore Backup"
flashcard/
โโโ main.ts # Entry point
โโโ README.md # This file
โโโ ARCHITECTURE.md # Detailed technical documentation
โโโ backend/
โ โโโ index.ts # Hono app and route setup
โ โโโ storage.ts # Blob storage utilities
โ โโโ routes/
โ โโโ auth.ts # User authentication
โ โโโ decks.ts # Deck CRUD
โ โโโ cards.ts # Card CRUD
โ โโโ study.ts # Study sessions and SM-2
โ โโโ stats.ts # Statistics and tracking
โ โโโ backup.ts # Data export/import
โโโ frontend/
โ โโโ index.html # Single-page app UI
โ โโโ index.js # Client-side logic
โโโ shared/
โโโ types.ts # Shared types and SR algorithm
- Backend: Hono (lightweight web framework)
- Frontend: Vanilla JavaScript + TailwindCSS
- Storage: Val Town Blob Storage
- Runtime: Deno (Val Town platform)
- Algorithm: SM-2 Spaced Repetition
- Simple per-user isolation
- Fast single-fetch loading
- No schema migrations
- Perfect for personal-scale apps
- Lightweight (no framework overhead)
- Simple to understand and modify
- Fast load times
- No build step needed
- Proven effective (used by Anki)
- Well-documented and understood
- Simple to implement
- Excellent for long-term retention
All endpoints require X-Username header (except login).
POST /api/auth/login- Login/create userGET/POST/PUT/DELETE /api/decks- Manage decksGET/POST/PUT/DELETE /api/cards- Manage cardsGET /api/study/:deckId- Get due cardsPOST /api/study/review- Record card reviewGET /api/stats- Get statisticsPOST /api/stats/sessions- Save study sessionGET /api/backup- Export dataPOST /api/backup/restore- Import data
See ARCHITECTURE.md for detailed API documentation.
# This is designed for Val Town's platform # To run locally, you'd need Val Town's SDK and blob storage emulator
- Upload all project files to Val Town
- Set
main.tsas the entry point - Configure as an HTTP Val
- No environment variables needed
- Use Val Town's preview feature to test in real-time
- Create test decks and cards
- Try the study mode with different ratings
- Verify statistics update correctly
- Test backup/restore functionality
Potential features to add:
- Image support in cards (using Val Town's AI image generation)
- Audio pronunciation
- Deck sharing/templates
- Card tagging and search
- Dark mode
- Keyboard shortcuts
- Study heatmap calendar
- Review forecast
- Cloze deletion cards
- Bulk CSV import
- Progressive Web App (offline mode)
This project is built for Val Town and is free to use, modify, and distribute.
Built with โค๏ธ for effective learning through spaced repetition.
Algorithm based on SuperMemo's SM-2, popularized by Anki.
Happy Learning! ๐