[{"data":1,"prerenderedAt":225},["ShallowReactive",2],{"docs:\u002Fdocs\u002Fcomparison":3,"i-lucide:moon":216,"i-lucide:github":221,"i-lucide:menu":223},{"id":4,"title":5,"body":6,"description":208,"extension":209,"meta":210,"navigation":211,"path":212,"seo":213,"stem":214,"__hash__":215},"docs\u002Fdocs\u002Fcomparison.md","Comparison",{"type":7,"value":8,"toc":197},"minimark",[9,13,23,29,57,72,90,94,109,116,119,123,126,138,141,145,152,155,159,162,165,169],[10,11,12],"p",{},"Nuxt Endpoints adds a typed, validated contract around ordinary Nuxt server routes. This page positions it against the approaches it is usually compared with.",[14,15,17,18,22],"h2",{"id":16},"plain-nuxt-fetch-typing","Plain Nuxt ",[19,20,21],"code",{},"$fetch"," typing",[10,24,25,26,28],{},"Nuxt already infers server route return types for ",[19,27,21],{},". What it does not provide:",[30,31,32,44,47,54],"ul",{},[33,34,35,36,39,40,43],"li",{},"Request validation. ",[19,37,38],{},"getQuery",", ",[19,41,42],{},"readBody",", and route params reach the handler unvalidated.",[33,45,46],{},"Typed request input. Params, query, headers, and body are untyped on the caller side.",[33,48,49,50,53],{},"Typed non-2xx responses. Error bodies are ",[19,51,52],{},"unknown",".",[33,55,56],{},"OpenAPI output.",[10,58,59,60,63,64,66,67,53],{},"Nuxt Endpoints keeps that workflow — routes stay ordinary files under ",[19,61,62],{},"server\u002Fapi",", and plain ",[19,65,21],{}," continues to work — and adds the contract on top for the routes that opt in. See ",[68,69,71],"a",{"href":70},"\u002Fdocs\u002Fincremental-adoption","Incremental Adoption",[10,73,74,75,78,79,82,83,86,87,89],{},"On the current Nitro 2 support line, Nuxt Endpoints generates its richer contract types independently, then applies Nitro's JSON wire mapping to client responses. Integration tests compare every generated endpoint success body directly with Nitro's generated ",[19,76,77],{},"InternalApi",". Status-specific non-2xx bodies remain available through ",[19,80,81],{},".result()"," and ",[19,84,85],{},".raw()"," because they are outside ",[19,88,77],{},"'s success-return model.",[14,91,93],{"id":92},"nuxt-typed-fetch-and-fetchdts","Nuxt typed fetch and fetchdts",[10,95,96,97,105,106,108],{},"Nuxt's typed-fetch work and ",[68,98,102],{"href":99,"rel":100},"https:\u002F\u002Fgithub.com\u002Funjs\u002Ffetchdts",[101],"nofollow",[19,103,104],{},"fetchdts"," are complementary to endpoint contracts. ",[19,107,104],{}," is a type-generation engine, not by itself a Nuxt route declaration API: the detail it can generate depends on the contract metadata supplied by its integration.",[10,110,111,112,115],{},"Inferring a route's return type does not by itself define runtime request validation, header schemas, distinct response-status bodies, idempotency policy, or OpenAPI metadata. Nuxt Endpoints owns that executable route contract. It can adopt a different typed-fetch generator later without changing what ",[19,113,114],{},"defineEndpoint"," means.",[10,117,118],{},"The preferred Nuxt 5 direction is to contribute endpoint metadata to Nuxt's generated fetch schema through a public module hook, then let Nuxt clients and Nuxt Endpoints consume the same successful response projection. Until that hook and implementation exist, this is a migration direction rather than a Nuxt 5 support claim.",[14,120,122],{"id":121},"trpc","tRPC",[10,124,125],{},"tRPC provides excellent end-to-end typing, but it replaces REST routing with its own RPC protocol:",[30,127,128,135],{},[33,129,130,131,134],{},"Procedures are not plain HTTP routes; other consumers (mobile apps, other services, ",[19,132,133],{},"curl",") need a tRPC client or an additional REST layer.",[33,136,137],{},"Adopting or removing it is a routing-level decision, not a per-route one.",[10,139,140],{},"Nuxt Endpoints keeps endpoints as plain HTTP routes documented with OpenAPI 3.1, so they remain consumable by anything that speaks HTTP. Adoption and rollback are per route.",[14,142,144],{"id":143},"spec-first-openapi-codegen","Spec-first OpenAPI codegen",[10,146,147,148,151],{},"Tools like ",[19,149,150],{},"openapi-typescript"," generate types from a hand-maintained OpenAPI document. That works well when the spec is the source of truth owned elsewhere. When the same team owns both spec and handlers, the spec tends to drift from the implementation.",[10,153,154],{},"Nuxt Endpoints inverts the direction: the contract lives next to the handler in code, and the OpenAPI document is generated from it. There is no separate codegen step to run and no document to keep in sync by hand.",[14,156,158],{"id":157},"openapi-client-and-proxy-modules","OpenAPI client and proxy modules",[10,160,161],{},"Modules that consume an existing OpenAPI document to generate clients or proxy an external API solve the other direction: the specification already exists outside the Nuxt server route. They are a good fit for third-party and separately owned services.",[10,163,164],{},"Nuxt Endpoints starts with a locally owned Nuxt route, executes its schemas at runtime, and emits OpenAPI from the same definition. It is not intended to replace an external-API client generator.",[14,166,168],{"id":167},"when-not-to-use-it","When not to use it",[30,170,171,186,194],{},[33,172,173,174,177,178,181,182,53],{},"Your API surface needs OpenAPI features that are not first-class yet (multiple media types, cookies, encodings) and the ",[19,175,176],{},"document","\u002F",[19,179,180],{},"extend"," escape hatches are not enough — see ",[68,183,185],{"href":184},"\u002Fdocs\u002Flimits","Limits",[33,187,188,189,193],{},"Your handlers are mostly streams, redirects, or proxies. Those stay better as plain Nitro routes, with ",[68,190,192],{"href":191},"\u002Fdocs\u002Flow-level-http","Low-level HTTP"," escape hatches for the few that need contracts.",[33,195,196],{},"You want RPC-style calls without HTTP semantics at all — tRPC fits that shape better.",{"title":198,"searchDepth":199,"depth":199,"links":200},"",2,[201,203,204,205,206,207],{"id":16,"depth":199,"text":202},"Plain Nuxt $fetch typing",{"id":92,"depth":199,"text":93},{"id":121,"depth":199,"text":122},{"id":143,"depth":199,"text":144},{"id":157,"depth":199,"text":158},{"id":167,"depth":199,"text":168},"How Nuxt Endpoints relates to Nuxt typed fetch, tRPC, and OpenAPI tooling.","md",{},true,"\u002Fdocs\u002Fcomparison",{"title":5,"description":208},"docs\u002Fcomparison","Y7XcLp0jz7lMkx1ETXluriDEHTpK2CEmWfrSO7MOcOE",{"left":217,"top":217,"width":218,"height":218,"rotate":217,"vFlip":219,"hFlip":219,"body":220},0,24,false,"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401\"\u002F>",{"left":217,"top":217,"width":218,"height":218,"rotate":217,"vFlip":219,"hFlip":219,"body":222,"hidden":211},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Cpath d=\"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5c.08-1.25-.27-2.48-1-3.5c.28-1.15.28-2.35 0-3.5c0 0-1 0-3 1.5c-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.4 5.4 0 0 0 4 9c0 3.5 3 5.5 6 5.5c-.39.49-.68 1.05-.85 1.65S8.93 17.38 9 18v4\"\u002F>\u003Cpath d=\"M9 18c-4.51 2-5-2-7-2\"\u002F>\u003C\u002Fg>",{"left":217,"top":217,"width":218,"height":218,"rotate":217,"vFlip":219,"hFlip":219,"body":224},"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M4 5h16M4 12h16M4 19h16\"\u002F>",1787723882421]