返回资讯中心
外部精选
软件工程
#开发者实时流

The Power of GraphQL, Without GraphQL

The Power of GraphQL, without ``GraphQL``.

Hacker News 最新Shoetp2026/11/24 · 今天9 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

The Power of GraphQL, without GraphQL. The last framework that actually makes sense, in the age of AI.

bunx @cobalt27/dev init

File-based Resolvers

Inferred Schema

Zero-Config SDK

No dependencies. GraphQL selections are optional.

Explorer

PROJECT

server

operations

post.ts

Query

comment.ts

Mutation

types

Post.ts

Type

ctx.ts

Context

operations/comment.ts

1export function Mutation(postId: string, content: string) {

2 const { prisma } = $$ctx(this);

3 return await prisma.comment.create({

4 data: { postId, content },

5 });

6}

Scroll to Explore

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.

Why not REST?

Endpoint Fatigue & Over-fetching

Managing hundreds of endpoints creates a maintenance nightmare. You fetch huge JSON blobs just to display a username.

One smart endpoint. The client specifies exactly what data it needs. The GraphQL feature everyone loves.

You write a TypeScript interface. Then you write a GraphQL Schema. Then you write a Resolver. If they drift, your app crashes.

Single source of truth. Your TypeScript code IS your schema. No client-side codegen steps or schema sync required.

userPostsQuery.gql

types/userPosts.ts

postFragments.gql

postsWithCommentsQuery.gql

types/postsWithComments.ts

commentsQuery.gql

types/comments.ts

Why not tRPC?

Tight Coupling Trap

Great for monoliths, but your backend logic leaks into your client bundle. Scaling to microservices or exposing a public API later becomes a rewrite.

Loose coupling, magnetic types. The schema is the contract. You can move fast AND scale to complex backends.

Server

Tightly Coupled

The Cobalt Way

Magnetic Type Safety

Define your logic once. The Schema is inferred. The SDK is generated. The types are magnetically bonded across the network boundary.

The best of all worlds. The speed of tRPC, the flexibility of GraphQL, and the simplicity of REST.

Network Boundary

Frontend SDK

const{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.

No Boilerplate

Stop writing glue code

Traditional frameworks require Controllers, manual serialization, and Service layers just to move data.

Write your logic. Cobalt generates the transport layer. No routers, no adapters, no manual schemas.

Controller

Service

Cobaltserver/users.ts

Logic Only

LLM Friendly

Context Rot

LLMs struggle with large, scattered codebases. Providing context across 50 files degrades performance and increases cost.

Dense, collocated code. Smaller context window footprint means smarter AI assistance and lower token costs.

Zero-Config SDK

Typed SDKs for free

Writing GraphQL queries manually is tedious and error-prone. Cobalt gives you a fully typed SDK out of the box.

sdk.query.user({ id })() - Autocomplete your entire backend, as if it was local code. No graphql tags, no codegen watchers.

Join the developers building the next generation of type-safe APIs.

Open source. Fast. Magnetic.

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →