· via Hacker News – Front Page (native)
Cobalt turns TypeScript into GraphQL, promising tRPC speed with schema flexibility
Cobalt, a TypeScript-first API framework that reached Hacker News's front page, infers GraphQL schemas and a typed SDK from plain TypeScript logic, pitching tRPC's iteration speed alongside GraphQL's flexibility.

What Cobalt does
Cobalt, a TypeScript-first API framework whose landing page reached the Hacker News front page on November 24, promises developers GraphQL-style querying without requiring them to write GraphQL. According to the project's site, you define resolver logic once in TypeScript, and the framework infers the GraphQL schema from that code and generates a fully typed client SDK alongside it.
On the client, that means a call such as sdk.query.user({ id: "1" })() returns the complete object, while passing a small selection callback to the same call returns only the fields you list. Field selection, the GraphQL feature the site leans on, becomes opt-in rather than mandatory, and the workflow involves no GraphQL query files, tagged template literals or code-generation watchers.
The pitch against the usual suspects
The landing page builds its case through three comparisons.
Against REST, it argues that managing hundreds of endpoints becomes a maintenance burden and that clients routinely download large JSON payloads just to display a sliver of data. Cobalt's answer is a single endpoint on which the client states exactly what it needs.
Against hand-written GraphQL, the site describes what it calls the 'double declaration problem': you write a TypeScript interface, then a schema, then a resolver, and if the three drift apart the application breaks. Cobalt removes two of those artifacts by treating the TypeScript implementation as the single source of truth, with no client-side codegen or schema synchronization step.
Against tRPC, the project concedes the iteration speed but warns of tight coupling, where backend logic leaks into the client bundle and a later move to microservices or a public API starts to look like a rewrite. In Cobalt's model the schema acts as the loose contract between the two sides, which the site suggests lets a codebase move fast early and grow into more complex backend structures later.
Fewer files, and a smaller context window
Beyond the architecture argument, the site makes claims about codebase size: no routers, adapters, controllers or manual serialization layers, because the transport layer is generated from the logic you write.
It also leans into AI-assisted development, arguing that large, scattered codebases degrade LLM performance and raise token costs. Its illustrative figures put a typical application at 45 files and roughly 11.2k tokens of context, against 13 files and 3.4k tokens for the Cobalt equivalent. These numbers come from the project's own marketing page, with no published methodology behind them.
Reasons for caution
Everything above is drawn from the project's landing page as surfaced on Hacker News; the available material includes no independent benchmarks, documentation review or adoption details. The framework's central claim, that inferred schemas can mature into the kind of complex and optimized GraphQL schemas teams eventually need, is addressed on the site with the assurance that you can refine the API at every stage without accumulating dangerous technical debt. That is currently a promise rather than a demonstrated outcome, and the token-footprint comparison in particular should be read as marketing until third parties test it.
Why it matters
The REST-versus-tRPC-versus-GraphQL debate is one of the livelier fault lines in TypeScript backend development, and Cobalt is an attempt to collapse the tradeoff rather than pick a side. If inferring a schema from implementation code holds up at scale, teams could start with tRPC-like speed and graduate to hand-tuned GraphQL without a rewrite, keeping one artifact as the contract, the implementation and the client types.
Just as telling is the marketing itself. Token cost and LLM context footprint are now headline arguments for a web framework, a clear signal that AI coding assistants have become a first-class consideration in how API tooling gets designed and sold.
- #graphql
- #typescript
- #trpc
- #api-design
- #developer-tools