Repository navigation
Proposal: add a strongly-typed Graftcode surface alongside REST and MCP #100
graftcode-team
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Proposal: add a strongly-typed Graftcode surface alongside REST and MCP
Hi! Per CONTRIBUTING.md, enhancements should be discussed here before a PR — so before anything else, here's the idea, followed by a working PR on my fork for reference.
The pain point
This API's whole purpose is being consumed by other people's code (portfolio sites, dashboards, bots). Today every integrator hand-writes their own
fetchcalls and response types againstswagger.yaml/the README examples, with no compile-time safety and no autocomplete. That's boilerplate this repo could remove entirely for consumers of TypeScript/JS (and eventually any Graftcode-supported language).The idea
Add a third integration surface next to the existing REST API and the already-merged MCP server (#71): expose the core LeetCode data as plain, transport-free service classes (
LeetCodeUsers,LeetCodeProblems,LeetCodeContests,LeetCodeDiscussions), then host them with the Graftcode Gateway (gg). Graftcode statically analyzes the module and generates a strongly-typed client package, so an integrator does:instead of:
This is strictly additive — the Express routes, controllers and Swagger stay exactly as-is, so nothing changes for existing REST consumers. It reuses the same GraphQL calls the REST/MCP layers already make (in fact it centralizes that GraphQL client into one shared internal module instead of duplicating it a third time).
Working proof, not just a pitch
I already built this end-to-end on my fork and verified it live (Vision screenshots, a real gateway, and a consumer example actually installing and calling the generated client) rather than just proposing it in the abstract:
PR: #99
That PR has the full write-up: what's exposed, screenshots of Graftcode Vision showing the discovered types, the exact before/after code, and test/lint results. Opening this Discussion per the contribution guidelines and happy to adjust anything (naming, scope, whether this belongs in-tree vs. a separate package) based on your feedback before it'd be considered for merge.
Disclosure
Per the CONTRIBUTING.md requirement to disclose AI assistance: this was built with AI assistance (Cursor) under my direction — I wrote the plan, reviewed every diff, and manually verified the live gateway/consumer end-to-end (see the PR for evidence). Not an unreviewed "vibe-coded" submission.
Curious to hear your thoughts, particularly on whether you'd want this in this repo directly or as a follow-up in a separate package.
All reactions