{"id":46167595,"url":"https://github.com/cwklurks/codesprint","last_synced_at":"2026-03-05T21:23:30.817Z","repository":{"id":324655400,"uuid":"1097951392","full_name":"cwklurks/codesprint","owner":"cwklurks","description":"CodeSprint is a typing practice environment for software engineers that uses real LeetCode-style code snippets instead of lorem ipsum, tracking WPM, accuracy, and errors in real time inside a minimal, keyboard‑first Next.js/React UI.","archived":false,"fork":false,"pushed_at":"2026-02-07T07:38:58.000Z","size":1631,"stargazers_count":49,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-07T17:38:40.459Z","etag":null,"topics":["coding-practice","developer-tools","education","frontend","keyboard-focused","leetcode","leetcode-solutions","monaco-editor","nextjs","nextjs14","productivity","react","touch-typing","typescript","typing","typing-game","typing-practice","typingspeedtest"],"latest_commit_sha":null,"homepage":"https://www.codesprint.ca/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cwklurks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-17T04:10:46.000Z","updated_at":"2026-02-07T07:39:01.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cwklurks/codesprint","commit_stats":null,"previous_names":["cwklurks/codesprint"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/cwklurks/codesprint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwklurks%2Fcodesprint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwklurks%2Fcodesprint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwklurks%2Fcodesprint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwklurks%2Fcodesprint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cwklurks","download_url":"https://codeload.github.com/cwklurks/codesprint/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwklurks%2Fcodesprint/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30004916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T12:19:43.414Z","status":"ssl_error","status_checked_at":"2026-03-02T12:19:02.215Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coding-practice","developer-tools","education","frontend","keyboard-focused","leetcode","leetcode-solutions","monaco-editor","nextjs","nextjs14","productivity","react","touch-typing","typescript","typing","typing-game","typing-practice","typingspeedtest"],"created_at":"2026-03-02T13:36:54.990Z","updated_at":"2026-03-02T13:36:55.593Z","avatar_url":"https://github.com/cwklurks.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eCodeSprint\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://nextjs.org/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Next.js-15-black?style=flat\u0026logo=nextdotjs\u0026logoColor=white\" alt=\"Next.js 15\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://react.dev/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/React-19-61dafb?style=flat\u0026logo=react\u0026logoColor=white\" alt=\"React 19\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://microsoft.github.io/monaco-editor/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Monaco-Editor-blue?style=flat\u0026logo=visualstudiocode\u0026logoColor=white\" alt=\"Monaco\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/0fa880d2-714c-47cf-9c58-218524943d60\" alt=\"codesprint demo\" width=\"100%\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eA \"muscle memory engine\" for LeetCode patterns.\u003c/strong\u003e\n  \u003cbr\u003e\n  It syncs real problem snippets via a custom GraphQL scraper and scores your typing accuracy against the actual syntax trees.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#engineering\"\u003eEngineering\u003c/a\u003e · \u003ca href=\"#the-data-pipeline\"\u003eData Pipeline\u003c/a\u003e · \u003ca href=\"#running-locally\"\u003eRunning Locally\u003c/a\u003e\n\u003c/p\u003e\n\n## Why?\n\nMost typing tests are just `String.split(' ')`. I felt like they measure your ability to type English, but that doesn't translate as much when you're typing code.\n\nI built CodeSprint because I realized people sometimes fail technical interviews not on logic, but on syntax fluency. I needed a way to drill \"Depth First Search in Python\" or \"Ring Buffer in C++\" until my fingers knew the shape of the code.\n\n## Engineering\n\nI wanted to create more than just a text area wrapper. Here is how I went about making it:\n\n### 1. The Renderer (Monaco + Delta Decorations)\n\nInstead of building a custom canvas renderer (yet), CodeSprint runs a heavily customized instance of the Monaco Editor (the core of VS Code).\n\n- **Diffing**: It uses `deltaDecorations` to paint correct/incorrect keystrokes directly onto the editor model without breaking the underlying syntax highlighting.\n- **Layout**: It calculates `getScrolledVisiblePosition` to overlay a really nice custom caret that behaves smoother than the native DOM caret.\n\n### 2. The Sync Script (Bun)\n\nI didn't really want to hardcode snippets. So, I wrote a custom scraper in Bun (`scripts/sync-leetcode.ts`) that:\n\n- Reverse-engineers the LeetCode GraphQL schema.\n- Fetches problems by difficulty and acceptance rate.\n- Sanitizes the code (strips docstrings and excessive comments).\n- Normalizes indentation to standard 4-space tabs.\n\n### 3. The Latency Fight\n\nReact's render cycle is often too slow for a 100 WPM feedback loop. The typing engine (`hooks/useTypingEngine.ts`) isolates the keystroke logic from the React render tree where possible, only triggering re-renders for specific UI updates (like the WPM gauge) to avoid garbage collection pauses during typing bursts.\n\n## The Data Pipeline\n\nTo keep the snippets fresh, you can run the sync script locally:\n\n```bash\n# Requires Bun (https://bun.sh)\nnpm run sync:leetcode -- --limit 50 --difficulties medium,hard\n```\n\nThis will:\n\n- Query the LeetCode `questionData` endpoint.\n- Parse `codeSnippets` for C++, Java, Python, and JS.\n- Output a minified JSON catalog to `data/leetcode-snippets.json`.\n- Autosort them into short, medium, and long problems.\n\n## Running Locally\n\n```bash\n# Install dependencies\nnpm install\n\n# Start the Next.js 15 Turbopack server\nnpm run dev\n```\n\nOpen http://localhost:3000.\n\n## Roadmap\n\n- **Custom Renderer**: Migrating from Monaco to a custom WebGL/Canvas text renderer to support large files with zero DOM overhead (Gap Buffer implementation in progress).\n- **Parser Integration**: Using Tree-sitter to allow \"semantic typing\" (skipping whitespace/formatting irrelevant to the code logic).\n\n## License\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcwklurks%2Fcodesprint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcwklurks%2Fcodesprint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcwklurks%2Fcodesprint/lists"}