Offline code typing trainer (typing.io-like) for touch-typing practice on local files — Electron + Vite + React + TypeScript + Monaco (Mantine UI).
Download: https://github.com/dskaw/code-typing-trainer/releases
Open any local file → split into segments → type with strict rules (slack/lock/backspace) → save attempts locally → view analytics.
- Architecture details:
docs/ARCHITECTURE.md - 中文文档 / Chinese docs:
README.zh-CN.mddocs/ARCHITECTURE.zh-CN.mdCONTRIBUTING.zh-CN.md
- Open local files via menu:
File → Open…(Ctrl+O) - Robust file decoding on Windows: UTF‑8 / UTF‑8 BOM / GBK / GB18030 (encoding shown in Typing header)
- Segmentation in a Web Worker (default: 200 lines/segment;
maxSegmentCharscap to keep Monaco responsive) - Typing engine (pure logic) with:
- slackN (type a few chars after first mistake),
- input lock after slack is exceeded (Backspace to fix),
- Backspace counts toward stats,
- Auto-skip blank lines (optional)
- “Skip comments” mode (comments are shown but not part of typing target) + comments dimming
- Skip leading indentation (optional), trim trailing whitespace (optional), pre-comment alignment spaces auto-skipped
- Monaco viewer only (read-only): constant-time range decorations (fast typing) and no validation/markers
- Theme toggle (dark/light), editor font size (no progress reset), text alignment (left/center/right)
- Summary per segment + local persistence (JSON in Electron
userData) + Analytics page (list + WPM/Unproductive% trends)
TODO: add screenshots / GIFs.
Prerequisites:
- Node.js 22+
- npm 10+
npm install
npm run devNotes:
npm run devruns Vite and launches Electron viavite-plugin-electron(seevite.config.ts).- The app is fully offline (no telemetry, no network calls).
npm run testnpm run buildArtifacts are emitted under:
release/CodeTyping-Trainer-<version>/- Windows: installer
.exe+CodeTyping-Trainer-<version>-win-unpacked/
- Windows: installer
This repo includes a GitHub Actions workflow: .github/workflows/release.yml.
- Push a semver tag
vX.Y.Z(must matchpackage.jsonversion) to trigger a Windows build. - The workflow uploads the installer (
.exe) to GitHub Release assets.
- Open a file via
File → Open…(Ctrl+O) or the Home button. - Typing happens in the Typing page (paste is blocked).
- Finish a segment → Summary is shown and the attempt is saved.
- Analytics page shows attempt history + trend charts.
Ctrl+O: Open fileCtrl+R: Restart current segmentCtrl+Left/Ctrl+Right: Previous / next segment- Theme toggle button: Dark/Light (stored in localStorage)
Ctrl+Shift+D: Toggle debug perf overlay (optional, off by default)
All settings are stored in localStorage under typing-trainer-typing-settings (see src/App.tsx).
- Lines per segment: split by line count (default 200)
- Slack N: allowed extra chars after first mismatch before locking input (default 3)
- Tab width:
Tabkey maps to spaces in normalized text (default 4) - Max segment chars: hard cap for Monaco responsiveness (default 20000)
- Editor font size: updates Monaco options without resetting progress
- Text alignment: left / center / right (visual alignment only)
- Auto-skip blank lines: pressing Enter on blank lines auto-skips consecutive
\\n - Skip leading indentation: don’t type leading spaces at line start
- Trim trailing whitespace: don’t type trailing spaces/tabs at line end
- Comments
- Type comments: comments are part of typing target
- Skip comments (show but don’t type): comments are visible but auto-skipped by the engine (dimmed)
- Default is chosen per file type (
.c/.cpp/.java/.ts/.py/...default to Skip comments;.txt/.md/.log/...default to Type comments)
- Show debug overlay: perf counters for diagnosing input lag (optional)
WPM = (correctChars / 5) / minutesUnproductive% = (incorrect + collateral + backspaces) / typedKeystrokes * 100
Notes:
correctCharscounts only user-typed correct characters (auto-skipped blank lines / comments / indentation do not inflate WPM).
- Fully offline: no network requests, no telemetry.
- Attempts are stored locally as JSON in Electron
app.getPath('userData'). - You are responsible for the copyright/licensing of any files you open in the app.
PRs and issues are welcome.
- Please read
docs/ARCHITECTURE.mdfirst (explains the typing engine, skip rules, Monaco integration, and performance constraints). - Use GitHub Issues (bug/feature templates are provided under
.github/ISSUE_TEMPLATE/).
- SQLite storage backend (optional) for large histories
- More precise language detection for Monaco language mode
- More analytics (per-language/ per-project breakdown)
- More typing modes (time trial, custom segment selection)
MIT — chosen because it is permissive and widely used for small desktop utilities, making it easy to fork and contribute.