Skip to content

Repository files navigation

⚡ SyntaxGym

A local-first code typing trainer for building Rust syntax muscle memory.

Live Demo · Documentation · Contributing

🔒 Local-first & Honest Design

SyntaxGym is a targeted typing trainer that detects common Rust syntax tokens (like =>, ::, &mut) and analyzes your "weak tokens".

What it is:

  • A muscle memory trainer for systems programming languages.
  • Fully local-first. We do not track your typing data, require a login, or use paywalls. Everything is stored locally in your browser's localStorage.

What it is not:

  • SyntaxGym lexes code for comments, strings and identifier boundaries, but it is not a Rust compiler and does not typecheck anything.
  • It is not a LeetCode clone and does not scrape LeetCode.

🚀 Features

  • 111 built-in Rust & DSA snippets across 17 practice packs — traits, generics, iterators, lifetimes, error handling, async, smart pointers, and DSA from binary search to union-find.
  • Three practice modes: Copy (the whole snippet is visible), Gap (key tokens are blanked out), and Recall (only the signature line stays). The typed source is identical in all three, so your scores stay comparable.
  • Token-aware, comment-aware analysis. A match inside a comment is not a token, None inside NoneType is not a token, and a lifetime 'a is not an unterminated char literal.
  • Hesitation reporting. Mistakes tell you what you got wrong. The hesitation report tells you which tokens you typed correctly but slowly — the syntax you still have to think about.
  • Token mastery & spaced repetition. A miss rate per token across your history, and a review queue scheduled by what you actually get wrong rather than by elapsed time alone.
  • Custom snippets and challenge links. Paste your own code, or share a snippet in a URL fragment — the code travels inside the link, nothing is uploaded.
  • Light and dark themes, adjustable code size, and a stored default practice mode.

📊 What the numbers mean

  • Accuracy counts keystrokes, not positions. Mistyping the same => five times costs five keystrokes.
  • Raw WPM counts every attempt; Adjusted WPM counts only the ones that landed.
  • Consistency is the evenness of your rhythm. Bursts separated by stalls score low even at a high WPM — that pattern means the syntax is still in your head, not your fingers.

💻 Running Locally

This is a Vite + React + TypeScript application managed in a pnpm workspace.

pnpm install
pnpm dev

Navigate to http://localhost:5174 to start typing.

pnpm check

Runs typecheck, unit tests, and the production build.

pnpm e2e

Runs the Playwright smoke test of the typing loop. Needs pnpm exec playwright install chromium once.

cargo test --manifest-path crates/syntaxgym-analyzer/Cargo.toml

Runs the Rust reference implementation of the token scanner. It is dependency-free and is not part of the web build — see docs/PRODUCT_ROADMAP.md.

🚀 Launch & Smoke Test

For maintainers preparing a release, please follow the Launch Checklist and the SEO Launch Checklist.

☁️ Deployment

SyntaxGym is optimized for Vercel deployment. Since canonical URLs and Open Graph tags require an absolute URL, you must provide your production domain as an environment variable.

  1. Set VITE_SITE_URL in your Vercel Project Settings (e.g., https://syntaxgym.online).
  2. Ensure the URL does not have a trailing slash.

🤝 Contributing

We welcome contributions! Because SyntaxGym is a lightweight, local-first tool, adding new snippets or refining the UI is straightforward.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Make sure type checks pass (pnpm typecheck)
  4. Commit your changes (git commit -m 'feat: add amazing feature')
  5. Push to the branch (git push origin feature/amazing-feature)
  6. Open a Pull Request

SyntaxGym is open-source and built for the developer community.

About

Local-first Rust syntax typing trainer with weak-token analytics, practice packs, and daily drills.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages