|
1 | | -# 🧠 DevKeys |
2 | | - |
3 | | -> **Type faster. Code smarter.** DevKeys is a privacy-first typing trainer for developers, built with React + Vite, Tailwind, highlight.js syntax colours, and a Rust-to-WASM scoring engine (the WASM bundle is required for the app to run). |
4 | | -
|
5 | | -## 🧭 Project Map |
6 | | -- `apps/web/` — React frontend with Zustand state, Tailwind styling, highlight.js-driven syntax tokens, and modular UI components (`MenuBar`, `ProjectHeader`, `EditorSurface`, `BackgroundGrid`, …). |
7 | | -- `crates/engine/` — Rust crate that exposes the diff/scoring function via `wasm-bindgen`. Build it with `pnpm build:wasm` (wasm-pack) to emit the JavaScript loader + `.wasm` artifacts under `apps/web/src/wasm/` (required at runtime). |
8 | | -- `docs/` — Product vision, architecture notes, roadmaps, testing guides, and contribution instructions. |
9 | | -- `TODO.md` — Working engineering checklist mapped to the MVP milestones. |
10 | | - |
11 | | -## 📌 Current Snapshot |
12 | | -**Implemented** |
13 | | -- Algorithms mode with language/prompt switchers, animated metrics (WPM, elapsed time, completion), and per-character feedback. |
14 | | -- highlight.js-based syntax colouring integrated with the custom `TypingFeedback` renderer. |
15 | | -- Local session persistence via IndexedDB (accuracy, WPM, elapsed time, prompt metadata, attempt counts). |
16 | | -- Midday.ai-inspired environment: monochrome grid backdrop, ambient radial blurs, and a lowercase project header. |
17 | | -- Tab-to-indent assistance that expands leading whitespace in prompts so new lines remain aligned. |
18 | | - |
19 | | -**In Progress / Planned** |
20 | | -- Expanded prompt packs, keyboard layouts, and richer analytics dashboards (streaks, export). |
21 | | -- Packaging the Rust engine as the default scoring implementation and adding performance telemetry hooks. |
22 | | -- Adaptive difficulty selection, heatmaps, and optional AI prompt generation as future roadmap items. |
23 | | - |
24 | | -## ⚙️ Prerequisites |
| 1 | +<div align="center"> |
| 2 | + |
| 3 | +# <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" style="display: inline-block; vertical-align: middle; margin-right: 8px;"><rect x="2" y="6" width="20" height="12" rx="2" /><text x="12" y="15" text-anchor="middle" font-size="10" fill="currentColor" dominant-baseline="middle">D</text></svg> devkeys |
| 4 | + |
| 5 | +**Type faster. Code smarter.** |
| 6 | + |
| 7 | +A privacy-first typing trainer built for developers who want to sharpen their coding muscle memory. |
| 8 | + |
| 9 | +Born from the need to master a new split keyboard layout while practicing real code—not random text. |
| 10 | + |
| 11 | +[](LICENSE) |
| 12 | +[](https://www.rust-lang.org/) |
| 13 | +[](https://react.dev/) |
| 14 | + |
| 15 | +[Features](#-features) • [Quick Start](#-quick-start) • [Documentation](docs/) • [Contributing](docs/CONTRIBUTING.md) |
| 16 | + |
| 17 | +</div> |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## ✨ Features |
| 22 | + |
| 23 | +**Practice with Real Code** |
| 24 | +- Type algorithm implementations, syntax patterns, and idiomatic code snippets |
| 25 | +- Built-in prompts for multiple programming languages with syntax highlighting |
| 26 | +- Create and manage custom prompts for your specific learning needs |
| 27 | + |
| 28 | +**Developer-Focused Experience** |
| 29 | +- Tab-to-indent that respects code alignment |
| 30 | +- VS Code-inspired syntax themes (Dark+, Light+, GitHub Dark/Light, Monokai) |
| 31 | +- Desktop-like interface with draggable, resizable windows |
| 32 | +- File-based prompt organization with language switcher |
| 33 | + |
| 34 | +**Live Metrics & Analytics** |
| 35 | +- Real-time WPM, accuracy, and completion tracking |
| 36 | +- Per-session statistics with detailed breakdowns |
| 37 | +- Prompt-specific history to track improvement over time |
| 38 | +- All data stored locally in IndexedDB—nothing leaves your device |
| 39 | + |
| 40 | +**Built for Performance** |
| 41 | +- Rust WASM engine for blazing-fast diff calculation and scoring |
| 42 | +- Smooth animations powered by Framer Motion |
| 43 | +- Responsive UI with Tailwind CSS and minimal dependencies |
| 44 | + |
| 45 | +## 🚀 Quick Start |
| 46 | + |
| 47 | +**Prerequisites** |
25 | 48 | - Node.js 20+ |
26 | 49 | - [pnpm](https://pnpm.io/) 8+ |
27 | | -- Rust toolchain via `rustup` **and** `wasm-pack` (required because the frontend always uses the compiled WASM bundle) |
28 | | - ```bash |
29 | | - rustup target add wasm32-unknown-unknown |
30 | | - cargo install wasm-pack |
31 | | - ``` |
32 | | - |
33 | | -## 🚀 Getting Started |
34 | | -Install workspace dependencies: |
35 | | -```bash |
36 | | -pnpm install |
37 | | -``` |
| 50 | +- Rust toolchain + [wasm-pack](https://rustwasm.github.io/wasm-pack/) |
38 | 51 |
|
39 | | -Compile the Rust scoring engine (this runs automatically before `dev:web`/`build:web`, but you can invoke it directly as needed): |
40 | 52 | ```bash |
41 | | -pnpm build:wasm |
| 53 | +# Install Rust targets (one-time setup) |
| 54 | +rustup target add wasm32-unknown-unknown |
| 55 | +cargo install wasm-pack |
42 | 56 | ``` |
43 | 57 |
|
44 | | -Launch the web app with hot reload + Tailwind JIT: |
| 58 | +**Installation** |
| 59 | + |
45 | 60 | ```bash |
| 61 | +# Clone and install dependencies |
| 62 | +git clone https://github.com/yourusername/devkeys.git |
| 63 | +cd devkeys |
| 64 | +pnpm install |
| 65 | + |
| 66 | +# Start the development server |
46 | 67 | pnpm dev:web |
47 | 68 | ``` |
48 | 69 |
|
49 | | -Open the printed URL (default <http://localhost:5173>) to begin. The menu bar controls the active language/prompt, and the typing surface renders animated feedback and syntax highlights. |
| 70 | +Open [http://localhost:5173](http://localhost:5173) and start typing! |
50 | 71 |
|
51 | | -Prefer running from the package directory? |
52 | | -```bash |
53 | | -pnpm --filter @devkeys/web dev |
| 72 | +## 🎯 Usage |
| 73 | + |
| 74 | +- **Start typing** — Focus is automatic; just begin typing the displayed code |
| 75 | +- **Tab** — Auto-complete indentation to match the prompt |
| 76 | +- **Cmd/Ctrl + R** — Restart the current prompt |
| 77 | +- **Cmd/Ctrl + K** — Open the explorer to switch prompts |
| 78 | +- Click the **stats panel** — View detailed metrics and session history |
| 79 | +- **Custom prompts** — Add your own via the explorer sidebar |
| 80 | + |
| 81 | +## 📦 Project Structure |
| 82 | + |
| 83 | +``` |
| 84 | +devkeys/ |
| 85 | +├── apps/web/ # React + Vite frontend |
| 86 | +│ ├── src/ |
| 87 | +│ │ ├── features/ # Editor, stats, session management |
| 88 | +│ │ ├── shared/ # Reusable components & utilities |
| 89 | +│ │ └── wasm/ # Compiled Rust engine (generated) |
| 90 | +├── crates/engine/ # Rust scoring engine |
| 91 | +└── docs/ # Architecture & contribution guides |
54 | 92 | ``` |
55 | 93 |
|
56 | | -## 🧪 Verification & Testing |
57 | | -Run the full project check (lint → typecheck → build → cargo tests): |
| 94 | +## 🧪 Development |
| 95 | + |
58 | 96 | ```bash |
| 97 | +# Run all checks (lint, typecheck, build, tests) |
59 | 98 | pnpm verify |
60 | | -``` |
61 | 99 |
|
62 | | -Individual commands: |
63 | | -- `pnpm lint:web` |
64 | | -- `pnpm typecheck:web` |
65 | | -- `pnpm build:web` |
66 | | -- `pnpm --filter @devkeys/web test` |
67 | | -- `pnpm test:rust` |
68 | | - |
69 | | -### 🦀 Rust Engine Workflow |
70 | | -- Unit test the engine crate: |
71 | | - ```bash |
72 | | - cargo test -p devkeys_engine |
73 | | - ``` |
74 | | -- Build the WASM bundle for the web app (required before running the frontend or building for production): |
75 | | - ```bash |
76 | | - pnpm build:wasm |
77 | | - ``` |
78 | | - The web client always uses the compiled WASM bundle (`apps/web/src/wasm/`); missing artifacts will surface as startup errors. |
79 | | - |
80 | | -## 🏗️ Production Build |
81 | | -Create an optimized bundle: |
82 | | -```bash |
| 100 | +# Build WASM engine only |
| 101 | +pnpm build:wasm |
| 102 | + |
| 103 | +# Run Rust tests |
| 104 | +pnpm test:rust |
| 105 | + |
| 106 | +# Production build |
83 | 107 | pnpm build:web |
84 | 108 | ``` |
85 | 109 |
|
86 | | -Artifacts live in `apps/web/dist/`. The Rust build writes its loader + `.wasm` assets to `apps/web/src/wasm/`, and Vite bundles them automatically. |
87 | | - |
88 | | -## 📊 Session Persistence |
89 | | -- Completed sessions land in IndexedDB (`devkeys/sessions`) with per-character attempt snapshots, accuracy, WPM, and timestamps. |
90 | | -- The bottom GitHub link remains purely client-side; no session data leaves the device. |
91 | | -- Use your browser’s application panel to inspect or clear stored sessions. |
92 | | - |
93 | | -## 📦 Working With Prompt Packs |
94 | | -- Packs live under `apps/web/src/content/packs/`. Update `localPacks.ts` after adding a file so it’s included in the runtime bundle. |
95 | | -- Each item follows the schema shown in `docs/CONTRIBUTING.md` (id, language, snippet, optional metadata). |
96 | | -- Restart (or rely on Vite’s HMR) after authoring new packs so the in-memory registry refreshes. |
97 | | - |
98 | | -## 🛠️ Troubleshooting |
99 | | -- **WASM module not found** → Run `pnpm build:wasm` to regenerate the WASM bundle before starting the app or building assets. |
100 | | -- **Tab doesn’t indent** → Ensure the prompt actually contains leading whitespace; the helper only expands existing indentation. |
101 | | -- **Syntax colours missing** → highlight.js must know the language; update `lib/syntax.ts` to register new ones. |
102 | | -- **IndexedDB clutter** → Clear the `devkeys` database through browser devtools or call `indexedDB.deleteDatabase("devkeys")`. |
103 | | -- **pnpm scripts missing** → Run `pnpm install` at the repo root so workspace scripts are registered. |
104 | | - |
105 | | -## 📚 Further Reading |
106 | | -- Product principles: `docs/01_Overview_Principles.md` |
107 | | -- Goals & feature breakdown: `docs/02_Goals_Features.md` |
108 | | -- Updated architecture + syntax pipeline: `docs/03_Syntax_Architecture.md` |
109 | | -- Testing & CI guidance: `docs/07_Testing_CI.md` |
110 | | -- Contribution workflow & schema references: `docs/CONTRIBUTING.md`, `docs/GLOSSARY.md` |
111 | | - |
112 | | -Questions or ideas? Open an issue or start a discussion—happy typing! ⌨️✨ |
| 110 | +## 🛠️ Tech Stack |
| 111 | + |
| 112 | +- **Frontend:** React 18, TypeScript, Tailwind CSS, Zustand, Framer Motion |
| 113 | +- **Syntax:** highlight.js with VS Code theme support |
| 114 | +- **Engine:** Rust compiled to WebAssembly via wasm-bindgen |
| 115 | +- **Storage:** IndexedDB for session persistence |
| 116 | +- **Build:** Vite, pnpm workspaces |
| 117 | + |
| 118 | +## 🔒 Privacy First |
| 119 | + |
| 120 | +- **100% local** — All typing data, sessions, and progress stay on your device |
| 121 | +- **No analytics** — No tracking, cookies, or external requests |
| 122 | +- **Offline-ready** — Works without an internet connection once loaded |
| 123 | +- **Open source** — Audit the code yourself |
| 124 | + |
| 125 | +## 📚 Documentation |
| 126 | + |
| 127 | +- [Product Principles](docs/01_Overview_Principles.md) |
| 128 | +- [Goals & Features](docs/02_Goals_Features.md) |
| 129 | +- [Architecture](docs/03_Syntax_Architecture.md) |
| 130 | +- [Contributing Guide](docs/CONTRIBUTING.md) |
| 131 | + |
| 132 | +## 🤝 Contributing |
| 133 | + |
| 134 | +We welcome contributions! Whether it's new prompt packs, bug fixes, or feature additions, check out our [Contributing Guide](docs/CONTRIBUTING.md) to get started. |
| 135 | + |
| 136 | +## 📄 License |
| 137 | + |
| 138 | +MIT © DevKeys Contributors |
| 139 | + |
| 140 | +--- |
| 141 | + |
| 142 | + |
| 143 | + |
| 144 | + |
0 commit comments