[{"data":1,"prerenderedAt":112},["ShallowReactive",2],{"docs:\u002Fdocs\u002Fmental-model":3,"i-lucide:moon":103,"i-lucide:github":108,"i-lucide:menu":110},{"id":4,"title":5,"body":6,"description":95,"extension":96,"meta":97,"navigation":98,"path":99,"seo":100,"stem":101,"__hash__":102},"docs\u002Fdocs\u002Fmental-model.md","Mental Model",{"type":7,"value":8,"toc":85},"minimark",[9,13,18,26,30,33,37,52,56,71,75,78,82],[10,11,12],"p",{},"Nuxt Endpoints adds a typed contract around ordinary Nuxt server routes. That contract is the source for runtime validation, generated client calls, and OpenAPI output. Six principles explain how every feature fits together.",[14,15,17],"h2",{"id":16},"_1-route-files-stay-nuxt-native","1. Route files stay Nuxt-native",[10,19,20,21,25],{},"You still write ordinary files under ",[22,23,24],"code",{},"server\u002Fapi"," and export an event handler. The endpoint definition wraps the HTTP boundary.",[14,27,29],{"id":28},"_2-schemas-describe-http-input-and-output","2. Schemas describe HTTP input and output",[10,31,32],{},"Zod, Valibot, and Effect Schema definitions describe the data that crosses the HTTP boundary. Handler context types use parsed schema output, so coercion and transforms are reflected in application code.",[14,34,36],{"id":35},"_3-route-paths-become-client-calls","3. Route paths become client calls",[10,38,39,40,43,44,47,48,51],{},"Each endpoint route is generated onto ",[22,41,42],{},"$endpoint('\u002Fpath', { method })"," style calls with typed request options, a default success-body call, typed result helpers, and raw Web Response helpers. Add ",[22,45,46],{},"operation"," only when a named call target such as ",[22,49,50],{},"$endpoint.getUser(...)"," is useful.",[14,53,55],{"id":54},"_4-response-handling-is-explicit","4. Response handling is explicit",[10,57,58,59,62,63,66,67,70],{},"Use the default call when app code only needs the success body. Use ",[22,60,61],{},".result()"," for typed status and body handling, and ",[22,64,65],{},".raw()"," only when code needs a low-level Web ",[22,68,69],{},"Response",".",[14,72,74],{"id":73},"_5-openapi-is-generated-from-the-same-source","5. OpenAPI is generated from the same source",[10,76,77],{},"The module can serve an OpenAPI 3.1 document without maintaining a separate route registry.",[14,79,81],{"id":80},"_6-server-state-adapters-remain-optional","6. Server-state adapters remain optional",[10,83,84],{},"Named endpoint contracts can generate ordinary query, mutation, and infinite-query options for Vue Query. Vue Query owns cache behavior while Nuxt Endpoints keeps request and response types aligned with the server contract.",{"title":86,"searchDepth":87,"depth":87,"links":88},"",2,[89,90,91,92,93,94],{"id":16,"depth":87,"text":17},{"id":28,"depth":87,"text":29},{"id":35,"depth":87,"text":36},{"id":54,"depth":87,"text":55},{"id":73,"depth":87,"text":74},{"id":80,"depth":87,"text":81},"One route definition powers the server, client, and documentation.","md",{},true,"\u002Fdocs\u002Fmental-model",{"title":5,"description":95},"docs\u002Fmental-model","uvNBELgYV_B_q2meRgZLP3ipbF5JxIrrrMVWAPM0XWs",{"left":104,"top":104,"width":105,"height":105,"rotate":104,"vFlip":106,"hFlip":106,"body":107},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":104,"top":104,"width":105,"height":105,"rotate":104,"vFlip":106,"hFlip":106,"body":109,"hidden":98},"\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":104,"top":104,"width":105,"height":105,"rotate":104,"vFlip":106,"hFlip":106,"body":111},"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M4 5h16M4 12h16M4 19h16\"\u002F>",1787723882387]