Master Rust syntax through interactive quizzes and spaced repetition. A Progressive Web App (PWA) that works offline and helps you level up your Rust skills.
- 50+ High-Quality Questions covering all major Rust concepts
- Spaced Repetition algorithm (SM-2) for optimal learning
- Offline-First - Works without internet connection
- Progress Tracking - Track accuracy, streaks, and category performance
- Instant Feedback - Detailed explanations with links to Rust documentation
- Responsive Design - Works on desktop, tablet, and mobile
- PWA Support - Install on your device for native-like experience
- Ownership & Borrowing
- Lifetimes
- Pattern Matching
- Error Handling (
Result,Option,?operator) - Traits & Generics
- Iterators & Closures
- Async/Await
- Macros
- Unsafe Rust
- Standard Library
- Node.js 18+ and npm
# Clone the repository
git clone https://github.com/yourusername/RustLens.git
cd RustLens
# Install dependencies
npm install
# Start development server
npm run devVisit http://localhost:5173 to see the app in action.
# Build the app
npm run build
# Preview the production build
npm run preview-
Update the base path in
vite.config.ts:export default defineConfig({ base: '/your-repo-name/', // Change this to match your repo name // ... rest of config })
-
Enable GitHub Pages in your repository:
- Go to Settings > Pages
- Source: GitHub Actions
-
Push to main branch:
git add . git commit -m "Initial commit" git push origin main
The GitHub Actions workflow will automatically build and deploy your app.
RustLens/
โโโ src/
โ โโโ components/ # React components
โ โ โโโ Header.tsx
โ โ โโโ QuizCard.tsx
โ โ โโโ StatsPanel.tsx
โ โโโ contexts/ # React context providers
โ โ โโโ AppContext.tsx
โ โโโ data/ # Question bank
โ โ โโโ questions.json
โ โโโ lib/ # Core utilities
โ โ โโโ db.ts # IndexedDB wrapper
โ โ โโโ spacedRepetition.ts
โ โโโ types/ # TypeScript definitions
โ โ โโโ question.ts
โ โโโ App.tsx
โ โโโ main.tsx
โโโ public/ # Static assets
โโโ package.json
- Answer questions by selecting an option
- Submit your answer to see if you're correct
- Read the explanation to understand the concept
- Click "Next Question" to continue
- View your overall accuracy and progress
- Track your daily streak
- See performance by category
- Identify weak areas that need more practice
Questions are stored in src/data/questions.json. To add a new question:
{
"id": "unique-id",
"category": "ownership",
"difficulty": 3,
"type": "spot_error",
"code": "fn main() {\n // Your code here\n}",
"question": "What's wrong with this code?",
"options": [
"Option A",
"Option B",
"Option C",
"Option D"
],
"correct": 0,
"explanation": "Detailed explanation of the answer",
"error_line": 2,
"rust_book_link": "https://doc.rust-lang.org/book/..."
}spot_error- Identify the bug in codefill_blank- Complete missing syntaxwill_compile- Predict compilation successfix_code- Choose the correct fixpredict_output- Predict runtime behavioridiomatic- Identify idiomatic Rust
ownershiplifetimespattern_matchingerror_handlingtraits_genericsiterators_closuresasync_awaitmacrosunsafestd_library
- Frontend: React 18 + TypeScript
- Build Tool: Vite
- Styling: CSS with CSS Variables
- Offline Storage: IndexedDB (via
idb) - PWA: Vite PWA Plugin + Workbox
- Deployment: GitHub Pages + GitHub Actions
Edit CSS variables in src/index.css:
:root {
--rust-orange: #CE422B;
--bg-primary: #1a1a1a;
--bg-secondary: #2d2d2d;
/* ... more colors */
}Modify the algorithm in src/lib/spacedRepetition.ts:
- Interval calculations
- Ease factor adjustments
- Question selection weights
Users can install RustLens as a standalone app:
- Visit the deployed site
- Look for "Install" prompt in browser
- Click "Install" to add to home screen
Works on Chrome, Edge, Safari (iOS 16.4+), and Firefox.
Contributions are welcome! Here are some ways to contribute:
- Add more questions
- Improve explanations
- Fix bugs
- Enhance UI/UX
- Add new features
MIT License - feel free to use this project for learning or building your own quiz apps.
- Rust logo and branding - Rust Foundation
- Spaced repetition algorithm - SuperMemo SM-2
- Questions inspired by common Rust interview patterns and The Rust Book
If you find this helpful, please star the repository and share it with others learning Rust!
Built with โค๏ธ for the Rust community