Overview
Vocab Vault uses TypeScript interfaces to maintain type safety across the application. All core data structures are defined in/src/data/ and used throughout the app for vocabulary terms, achievements, user statistics, and spaced repetition.
Core Interfaces
Term Interface
TheTerm interface represents a single vocabulary term with its definition and metadata.
id- Unique numeric identifier for the termterm- The vocabulary word or phrasedefinition- Standard technical definitioneli5Definition- Optional simplified explanation for beginnerscategory- Category ID this term belongs toexample- Optional ASCII art or text-based visual example
/src/data/vocabulary.ts:1-8
Achievement Interface
Achievements are unlocked based on user progress and study patterns.id- Unique string identifiertitle- Display name of the achievementdescription- What the user did to earn iticon- Material icon namecategory- Optional category this achievement relates toisHidden- Whether this is a secret achievementcondition- Function that returns true when achievement is unlocked
/src/data/achievements.ts:3-11
UserStats Interface
Tracks all user progress and statistics for achievement checking.totalCardsViewed- Total number of flashcards viewedunlockedAchievements- Array of achievement IDs that have been unlockedcategoryProgress- Object mapping category IDs to number of mastered termsstreak- Current consecutive days of studyinglogoClicks- Optional counter for logo clicks (easter egg)lastStudyTime- Optional timestamp of last study session
/src/data/achievements.ts:13-20
Spaced Repetition Structures
SRSCard Interface
Represents a single card in the spaced repetition system using the SM-2 algorithm.termId- References the Term.id this card is foreaseFactor- Difficulty multiplier (default 2.5, minimum 1.3)interval- Number of days until the next review is duerepetitions- Consecutive successful reviews (resets to 0 on failure)nextReviewDate- ISO date string (YYYY-MM-DD) when card is next duelastReviewDate- ISO date string of last review, or null if never reviewedquality- Last quality rating (0-5 scale)
/src/lib/sm2.ts:14-22
SRSData Interface
Container for all SRS cards with versioning for future schema migrations.cards- Object mapping term IDs to their SRS card dataversion- Schema version number for migration support
/src/lib/sm2.ts:24-27
Type Unions
TermStatus
Represents the learning status of a term in classic (non-SRS) mode.known- User has mastered this termlearning- User is currently learning this termunseen- User has not studied this term yet
/src/hooks/useProgress.ts:19
Progress Interface
Maps term IDs to their learning status in classic mode./src/hooks/useProgress.ts:21-23
Categories
Vocab Vault organizes terms into 24 categories, each with visual styling and metadata.id- Unique identifier used in Term.categoryname- Display namesubtitle- Short descriptoricon- Material Icons nameabbrev- Short abbreviation for compact displayscolorClass- Tailwind CSS class for category color
/src/data/vocabulary.ts:10-37
All Categories:
Foundation, APIs, Code, Development, Git, Cloud, UI/UX, CSS, AI, No-Code, Money, Tools, Shortcuts, Security, Debugging, Analytics, Mobile, Data, SEO, Testing, Architecture, Hosting, AI Tools, Package
Quality Ratings
SM-2 Quality Scale
The spaced repetition system uses a 0-5 quality scale based on the SuperMemo 2 algorithm:Simplified Ratings
The UI uses a simplified 4-button interface that maps to SM-2 quality:/src/lib/sm2.ts:40-45
Mastery Levels
SRS cards progress through four mastery levels based on interval and repetitions:new- Never reviewed (repetitions = 0)learning- Interval < 7 daysreviewing- Interval 7-20 daysmastered- Interval ≥ 21 days
/src/lib/sm2.ts:213-218