Skip to content
HN On Hacker News ↗

Cobalt — GraphQL from TypeScript, without writing GraphQL

▲ 7 points • 10 comments • by Shoetp • 2h ago • HN discussion ↗

Pangram verdict · v3.3

We believe that this text is a mix of AI and human-written content.

88 %

AI likelihood · overall

AI
12% human-written 88% AI-generated
SEGMENTS · HUMAN 1 of 12
SEGMENTS · AI 11 of 12
WORD COUNT 438
PEAK AI % 100% · §2
Analyzed
Nov 24
backend: pangram/v3.3
Segments scanned
12 windows
avg 37 words each
Distribution
12 / 88%
human / AI fraction
Verdict
AI
Pangram v3.3

Article text · 438 words · 12 segments analyzed

Human AI-generated
§1 Human · 0%

Why Cobalt?It's simple and powerful.Cobalt never gets in your way.It extends GraphQL but doesn't force you to use it manually.You get the iteration speed of tRPC and the flexibility of GraphQL. This way you're not sacrificing your ability to craft complex & optimized GraphQL schemas for initial speed.You can refine your API at every stage, without collecting dangerous tech debt.Endpoint Fatigue & Over-fetchingManaging hundreds of endpoints creates a maintenance nightmare.

§2 AI · 100%

You fetch huge JSON blobs just to display a username.The Cobalt SolutionOne smart endpoint. The client specifies exactly what data it needs. The GraphQL feature everyone loves.GET /api/users/1GET /api/users/1/postsGET /api/posts/99/commentsGET /api/users/1?include=profileGET /api/profiles/1/rolesGET /api/roles/1/permissions250kb PayloadActual data neededThe Double Declaration ProblemYou write a TypeScript interface.

§3 AI · 100%

Then you write a GraphQL Schema. Then you write a Resolver.

§4 AI · 100%

If they drift, your app crashes.The Cobalt SolutionSingle source of truth.

§5 AI · 100%

Your TypeScript code IS your schema.

§6 AI · 100%

No client-side codegen steps or schema sync required.Schema.gqlType.tsuserPostsQuery.gqltypes/userPosts.tspostFragments.gqlpostsWithCommentsQuery.gqltypes/postsWithComments.tscommentsQuery.gqltypes/comments.tsTight Coupling TrapGreat for monoliths, but your backend logic leaks into your client bundle. Scaling to microservices or exposing a public API later becomes a rewrite.The Cobalt SolutionLoose coupling, magnetic types.

§7 AI · 100%

The schema is the contract.

§8 AI · 100%

You can move fast AND scale to complex backends.trpcClient.user.byId.query(1)trpcClient.user.byIdWithPosts.query(1)trpcClient.user.getProfile.query(1)trpcClient.post.listRecent.query()trpcClient.post.byAuthor.query(id)trpcClient.comment.create.mutate(data)trpcClient.comment.delete.mutate(id)trpcClient.comment.update.mutate(id)trpcClient.comment.listByPost.query(id)trpcClient.comment.listByUser.query(id)trpcClient.comment.listByPostAndUser.query(id)trpcClient.comment.listByPostAndUserAndPost.query(id)ClientServerTightly CoupledMagnetic Type SafetyDefine your logic once.

§9 AI · 100%

The Schema is inferred. The SDK is generated.

§10 AI · 100%

The types are magnetically bonded across the network boundary.The Cobalt SolutionThe best of all worlds. The speed of tRPC, the flexibility of GraphQL, and the simplicity of REST.

§11 AI · 100%

// ...

§12 AI · 100%

resolver logic  return{  user:{ id, name, email }};}Network BoundaryFrontend SDKconst{user}=awaitsdk.query.user(...);const{id, name, email}=user;Hate Typing?Thirsty LLM?Less is more.A codebase that is fun to work with.Cobalt reduces the surface area of your codebase. No glue code, no manual types, no redundant files. Just pure logic that machines can understand and humans can maintain.Stop writing glue codeTraditional frameworks require Controllers, manual serialization, and Service layers just to move data.The Cobalt SolutionWrite your logic. Cobalt generates the transport layer. No routers, no adapters, no manual schemas.TraditionalRouterControllerServiceCobaltserver/users.tsLogic OnlyContext RotLLMs struggle with large, scattered codebases. Providing context across 50 files degrades performance and increases cost.The Cobalt SolutionDense, collocated code. Smaller context window footprint means smarter AI assistance and lower token costs.Typical App Context11.2k Tokens45 Files (DTOs, Types, Resolvers, Services...)Cobalt App Context3.4k Tokens13 Files (Schema-inferred Resolvers)Typed SDKs for freeWriting GraphQL queries manually is tedious and error-prone. Cobalt gives you a fully typed SDK out of the box.The Cobalt Solutionsdk.query.user({ id })() - Autocomplete your entire backend, as if it was local code. No graphql tags, no codegen watchers.Use GraphQL selections only if you want to.Simple Mode (default)constuser=awaitsdk.query.user({ id: "1" })();// Returns full object automaticallyWith Sub-Selectionconstuser=awaitsdk.query.user({ id: "1" })(({id, name, avatar }) => ({id, name, avatar}));// Returns only requested fields