{"post":{"slug":"trpc-vs-graphql-vs-rest-2026","title":"tRPC vs GraphQL vs REST in 2026: which API to ship","excerpt":"Three API paradigms, three different bets. Here is the 2026 framework for picking — type safety, ecosystem fit, public vs internal, and the patterns that show up in production.","category":"code","date":"February 12, 2026","author":"ByteLedger Team","content":"<span class=\"dropcap\">P</span>icking an API style in 2026 used to be three religious wars. The dust has mostly settled — each approach has a clear sweet spot, and the right answer depends primarily on who consumes the API and how. This piece is the framework for picking, with the patterns that show up in real production stacks and the trade-offs nobody mentions in the launch posts.\n\n## What changed in 2026\n\n- **tRPC v11** ships with stable subscriptions, server-sent events, and Server Component integration — closing the last gaps to GraphQL on real-time and React.\n- **GraphQL Federation v2** and tools like Apollo Router, Hive, and WunderGraph made federated GraphQL operationally tractable for the first time.\n- **OpenAPI 3.2 + typed clients (openapi-fetch, hey-api)** brought REST APIs close to GraphQL/tRPC's type-safety advantages.\n\n## When tRPC wins\n\n- **Internal full-stack TypeScript app.** Frontend and backend are the same codebase or share types.\n- **Single team owning both ends.** No need for a versioned public contract.\n- **Speed of iteration matters more than long-term consumer stability.**\n- **Best DX in the category** — autocomplete across the wire, no codegen step.\n\nLimitation: TypeScript-only. The \"no schema\" pitch becomes \"no inter-language contract\" if you have non-TS consumers.\n\n## When GraphQL wins\n\n- **Public API with many different consumers** who want different data shapes.\n- **Mobile + web + partners** all reading the same data, requesting different slices.\n- **You need real-time** (subscriptions) and a strong schema-first culture.\n- **You're at scale** with a federation story (multiple teams owning different schema chunks).\n\nLimitation: operationally heavier than REST or tRPC. Caching, N+1, persisted queries — all real considerations.\n\n## When REST wins\n\n- **Public API consumed by unknown clients.**\n- **Language-agnostic surface** — mobile native, embedded, partners in random languages.\n- **You want HTTP caching** (CDN, browser) to do the heavy lifting.\n- **Standard tooling** (Postman, curl, OpenAPI) matters for your consumers.\n\nLimitation: type safety requires discipline (OpenAPI + generated clients). Over- or under-fetching is the historic complaint.\n\n## Comparison\n\n| Dimension | tRPC | GraphQL | REST |\n| --- | --- | --- | --- |\n| Type safety | Inferred (best) | Schema-first | OpenAPI (good) |\n| Best client | TS web/server | Diverse | Polyglot |\n| Caching | Limited | App-level | HTTP-native |\n| Real-time | SSE/WS | Subscriptions | SSE/WS |\n| Setup overhead | Lowest | Highest | Low |\n| Iteration speed | Highest | Medium | Medium |\n| Best for | Internal full-stack TS | Public diverse consumers | Public any consumer |\n\n## The hybrid that wins\n\nA surprising number of 2026 stacks use two:\n\n- **tRPC for internal app** (web → API server in the same monorepo).\n- **REST or GraphQL public layer** for third-party consumers, mobile apps, partners.\n\nThis is the right answer for many apps: ergonomic internal speed plus a versioned, stable external surface.\n\n## What about gRPC?\n\ngRPC remains the best choice for service-to-service communication inside a microservices architecture. Strong types, fast binary protocol, streaming. Not consumer-facing usually — but where it fits, it dominates. ConnectRPC is the modern wrapper that makes it browser-friendly.\n\n## Picking guide\n\n- **Building a SaaS with a React frontend and TS backend, no external API yet** → tRPC.\n- **Public API for developers (Stripe-style)** → REST + OpenAPI.\n- **App with mobile + web + partners reading the same data** → GraphQL.\n- **Inter-service communication at scale** → gRPC / ConnectRPC.\n- **Edge-first app on Cloudflare Workers** → REST or tRPC v11.\n\n## What to skip\n\n- **GraphQL for a tiny single-consumer app.** The setup cost rarely pays off below a clear schema-need.\n- **REST without OpenAPI** in 2026. The type-safety gap to the alternatives is real and unnecessary.\n- **tRPC for public APIs** — the lock-in to TypeScript-on-both-ends is a real consumer constraint.\n\n## FAQ\n\n**Can tRPC do real-time?**\nYes — v11 supports SSE and WebSocket subscriptions natively.\n\n**Is GraphQL slower than REST?**\nNot inherently. Most \"GraphQL is slow\" complaints trace to N+1 queries (solved with DataLoader) or missing caching (solved with persisted queries).\n\n**REST + OpenAPI vs tRPC for internal apps?**\ntRPC's DX is meaningfully better if your stack is TS end-to-end. OpenAPI + generated clients close the gap for polyglot teams.\n\n**Should I migrate from REST to GraphQL?**\nProbably not unless you have a concrete consumer pain (over-fetching, multiple aggregations). Stable REST APIs are valuable.\n\n## Where to go next\n\nFor related material see [Server Components vs Server Actions in 2026](/blog/server-components-vs-server-actions-2026), [Bun vs Deno vs Node in 2026](/blog/bun-vs-deno-vs-node-2026), and [TypeScript strict mode guide in 2026](/blog/typescript-strict-mode-guide-2026).","hue":172,"metaTitle":"tRPC vs GraphQL vs REST 2026: Which API to Ship","metaDescription":"Honest 2026 comparison of tRPC, GraphQL, and REST — type safety, ecosystem, when each wins, and the patterns that actually work in production.","keywords":["trpc vs graphql","rest vs graphql","trpc vs rest","api architecture 2026","typescript api","full stack typescript","graphql federation 2026","openapi rest","api design 2026","end-to-end type safety"],"tldr":["**tRPC wins for internal full-stack TypeScript apps.** Type-safe end-to-end without code generation.","**GraphQL wins for client-driven data shapes** and public APIs with diverse consumers.","**REST remains the right default** for public APIs and language-agnostic surfaces.","**Skip:** picking GraphQL because \"Facebook uses it\" or REST because \"everyone uses it\" — pick by the consumer."],"readTime":"3 min read","wordCount":764},"related":[{"slug":"graphql-vs-trpc-2026","title":"GraphQL vs tRPC in 2026: which API layer should you pick?","excerpt":"GraphQL and tRPC both solve the contract problem between client and server, but they make opposite tradeoffs. Here is the honest 2026 comparison.","category":"code","date":"February 21, 2026","author":"ByteLedger Team","readTime":"4 min read","hue":311},{"slug":"how-to-connect-frontend-to-backend-2026","title":"How to Connect Frontend to Backend in 2026: Field Guide","excerpt":"Connecting a frontend to a backend means agreeing on a contract, then handling auth, CORS, and errors. Here is the practical 2026 version, skeptic included.","category":"code","date":"May 4, 2026","author":"ByteLedger Team","readTime":"5 min read","hue":145},{"slug":"rest-vs-rpc-2026","title":"REST vs RPC in 2026: which API style should you use?","excerpt":"REST, gRPC, tRPC, and JSON-RPC each have a place in 2026. This guide cuts through the philosophy and gives you the practical decision framework.","category":"code","date":"April 7, 2026","author":"ByteLedger Team","readTime":"4 min read","hue":313}],"sameCategory":[{"slug":"bazel-build-explained-2026","title":"Bazel Explained: What Hermetic Builds Actually Cost","excerpt":"Bazel delivers reproducible, precisely cached builds and demands that you describe everything. Here is what you get, what it costs, and who should say no.","category":"code","date":"August 19, 2026","author":"ByteLedger Team","readTime":"3 min read","hue":145},{"slug":"graphql-federation-2026","title":"GraphQL Federation: One Graph, Many Teams","excerpt":"Federation composes independently-owned subgraphs into a single API. Here is what it solves, the operational cost it adds, and when a simpler gateway is enough.","category":"code","date":"August 19, 2026","author":"ByteLedger Team","readTime":"3 min read","hue":300},{"slug":"hermetic-builds-explained-2026","title":"Hermetic Builds Explained: Same Inputs, Same Output","excerpt":"A hermetic build depends only on declared inputs. Here is what that property gives you, the common leaks that break it, and how to move toward it incrementally.","category":"code","date":"August 19, 2026","author":"ByteLedger Team","readTime":"3 min read","hue":130},{"slug":"monorepo-tooling-compared-2026","title":"Monorepo Tooling Compared: What You Actually Need","excerpt":"Monorepo tools solve task orchestration and caching, not repository layout. Here is what each tier provides and how to tell when you have outgrown the simple option.","category":"code","date":"August 19, 2026","author":"ByteLedger Team","readTime":"3 min read","hue":150}],"newer":{"slug":"stock-market-outlook-q2-2026","title":"Stock market outlook for Q2 2026: rates, earnings, and sector rotation","excerpt":"Where the market sits in mid-May 2026 — rate path, Q1 earnings, valuation picture, and the sector rotation playing out under the surface.","category":"finance","date":"February 12, 2026","author":"ByteLedger Team","readTime":"3 min read","hue":295},"older":{"slug":"wedding-budget-planning-2026","title":"Wedding budget planning in 2026: real costs and where to cut","excerpt":"The average US wedding hit $35,000 in 2026. Here is the honest breakdown of where the money goes, where to cut without anyone noticing, and the financial conversation no one has before saying yes.","category":"finance","date":"February 12, 2026","author":"ByteLedger Team","readTime":"4 min read","hue":310}}