[{"data":1,"prerenderedAt":1455},["ShallowReactive",2],{"navigation_docs":3,"-rpc-devtools-nextjs":399},[4,162,346],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":24},"RPC","icon-park-outline:lightning","\u002Frpc","01.rpc",[10,25,63,77,102,136],{"title":11,"icon":12,"redirect":7,"path":13,"stem":14,"children":15,"page":24},"Introduction","icon-park-outline:home","\u002Frpc\u002Fintroduction","01.rpc\u002F01.introduction",[16,20],{"title":17,"path":18,"stem":19},"Quick Start","\u002Frpc\u002Fintroduction\u002Fquick-start","01.rpc\u002F01.introduction\u002F02.quick-start",{"title":21,"path":22,"stem":23},"Manual Install","\u002Frpc\u002Fintroduction\u002Fmanual-install","01.rpc\u002F01.introduction\u002F03.manual-install",false,{"title":26,"icon":27,"path":28,"stem":29,"children":30,"page":24},"Server","icon-park-outline:server","\u002Frpc\u002Fserver","01.rpc\u002F02.server",[31,35,39,43,47,51,55,59],{"title":32,"path":33,"stem":34},"Routes","\u002Frpc\u002Fserver\u002Froutes","01.rpc\u002F02.server\u002F01.routes",{"title":36,"path":37,"stem":38},"Middleware","\u002Frpc\u002Fserver\u002Fmiddleware","01.rpc\u002F02.server\u002F02.middleware",{"title":40,"path":41,"stem":42},"Call Context","\u002Frpc\u002Fserver\u002Fcall-context","01.rpc\u002F02.server\u002F03.call-context",{"title":44,"path":45,"stem":46},"Headers","\u002Frpc\u002Fserver\u002Fheaders","01.rpc\u002F02.server\u002F04.headers",{"title":48,"path":49,"stem":50},"Error Handling","\u002Frpc\u002Fserver\u002Ferror-handling","01.rpc\u002F02.server\u002F05.error-handling",{"title":52,"path":53,"stem":54},"Validation","\u002Frpc\u002Fserver\u002Fvalidation","01.rpc\u002F02.server\u002F06.validation",{"title":56,"path":57,"stem":58},"JSON Round Trip","\u002Frpc\u002Fserver\u002Fjson-round-trip","01.rpc\u002F02.server\u002F07.json-round-trip",{"title":60,"path":61,"stem":62},"Drizzle Tables","\u002Frpc\u002Fserver\u002Fdrizzle-tables","01.rpc\u002F02.server\u002F08.drizzle-tables",{"title":64,"icon":65,"path":66,"stem":67,"children":68,"page":24},"Middlewares","icon-park-outline:link-one","\u002Frpc\u002Fmiddlewares","01.rpc\u002F03.middlewares",[69,73],{"title":70,"path":71,"stem":72},"fetchMetadata","\u002Frpc\u002Fmiddlewares\u002Ffetch-metadata","01.rpc\u002F03.middlewares\u002F01.fetch-metadata",{"title":74,"path":75,"stem":76},"syncRoutes","\u002Frpc\u002Fmiddlewares\u002Fsync-routes","01.rpc\u002F03.middlewares\u002F02.sync-routes",{"title":78,"icon":79,"path":80,"stem":81,"children":82,"page":24},"Client","icon-park-outline:computer","\u002Frpc\u002Fclient","01.rpc\u002F04.client",[83,87,91,94,98],{"title":84,"path":85,"stem":86},"Client Overview","\u002Frpc\u002Fclient\u002Fclient-overview","01.rpc\u002F04.client\u002F00.client-overview",{"title":88,"path":89,"stem":90},"Client Middleware","\u002Frpc\u002Fclient\u002Fclient-middleware","01.rpc\u002F04.client\u002F01.client-middleware",{"title":48,"path":92,"stem":93},"\u002Frpc\u002Fclient\u002Ferror-handling","01.rpc\u002F04.client\u002F02.error-handling",{"title":95,"path":96,"stem":97},"Batch Requests","\u002Frpc\u002Fclient\u002Fbatch","01.rpc\u002F04.client\u002F03.batch",{"title":99,"path":100,"stem":101},"Cancellation & Timeouts","\u002Frpc\u002Fclient\u002Fcancellation-timeouts","01.rpc\u002F04.client\u002F04.cancellation-timeouts",{"title":103,"redirect":104,"icon":105,"path":106,"stem":107,"children":108,"page":24},"Platforms","\u002Frpc\u002Fplatforms\u002Fnode-js","icon-park-outline:play","\u002Frpc\u002Fplatforms","01.rpc\u002F06.platforms",[109,112,116,120,124,128,132],{"title":110,"path":104,"stem":111},"Node.js","01.rpc\u002F06.platforms\u002F01.node-js",{"title":113,"path":114,"stem":115},"Bun","\u002Frpc\u002Fplatforms\u002Fbun","01.rpc\u002F06.platforms\u002F02.bun",{"title":117,"path":118,"stem":119},"AWS Lambda","\u002Frpc\u002Fplatforms\u002Faws-lambda","01.rpc\u002F06.platforms\u002F03.aws-lambda",{"title":121,"path":122,"stem":123},"Google Cloud Functions","\u002Frpc\u002Fplatforms\u002Fgoogle-cloud-functions","01.rpc\u002F06.platforms\u002F04.google-cloud-functions",{"title":125,"path":126,"stem":127},"Cloudflare Workers","\u002Frpc\u002Fplatforms\u002Fcloudflare","01.rpc\u002F06.platforms\u002F05.cloudflare",{"title":129,"path":130,"stem":131},"Vercel","\u002Frpc\u002Fplatforms\u002Fvercel","01.rpc\u002F06.platforms\u002F06.vercel",{"title":133,"path":134,"stem":135},"uWebSockets.js","\u002Frpc\u002Fplatforms\u002Fuwebsockets","01.rpc\u002F06.platforms\u002F07.uwebsockets",{"title":137,"icon":138,"path":139,"stem":140,"children":141,"page":24},"Devtools","icon-park-outline:tool","\u002Frpc\u002Fdevtools","01.rpc\u002F07.devtools",[142,146,150,154,158],{"title":143,"path":144,"stem":145},"Linter","\u002Frpc\u002Fdevtools\u002Flinter","01.rpc\u002F07.devtools\u002F01.linter",{"title":147,"path":148,"stem":149},"Vite","\u002Frpc\u002Fdevtools\u002Fvite","01.rpc\u002F07.devtools\u002F02.vite",{"title":151,"path":152,"stem":153},"Next.js","\u002Frpc\u002Fdevtools\u002Fnextjs","01.rpc\u002F07.devtools\u002F03.nextjs",{"title":155,"path":156,"stem":157},"CLI","\u002Frpc\u002Fdevtools\u002Fcli","01.rpc\u002F07.devtools\u002F04.cli",{"title":159,"path":160,"stem":161},"API Types","\u002Frpc\u002Fdevtools\u002Fapi-types","01.rpc\u002F07.devtools\u002F05.api-types",{"title":163,"icon":164,"path":165,"stem":166,"children":167,"page":24},"RunTypes","i-lucide-braces","\u002Fruntypes","02.runtypes",[168,184,224,254,268,290,332],{"title":11,"icon":169,"redirect":165,"path":170,"stem":171,"children":172,"page":24},"i-lucide-rocket","\u002Fruntypes\u002Fintroduction","02.runtypes\u002F01.introduction",[173,177,180],{"title":174,"path":175,"stem":176},"Built on typescript-go","\u002Fruntypes\u002Fintroduction\u002Fbuilt-on-typescript-go","02.runtypes\u002F01.introduction\u002F02.built-on-typescript-go",{"title":17,"path":178,"stem":179},"\u002Fruntypes\u002Fintroduction\u002Fquick-start","02.runtypes\u002F01.introduction\u002F03.quick-start",{"title":181,"path":182,"stem":183},"Configuration","\u002Fruntypes\u002Fintroduction\u002Fconfiguration","02.runtypes\u002F01.introduction\u002F04.configuration",{"title":185,"icon":186,"redirect":187,"path":188,"stem":189,"children":190,"page":24},"Guide","i-lucide-book-open","\u002Fruntypes\u002Fguide\u002Ftype-builders","\u002Fruntypes\u002Fguide","02.runtypes\u002F02.guide",[191,194,198,201,204,208,212,216,220],{"title":192,"path":187,"stem":193},"Types vs Type Builders","02.runtypes\u002F02.guide\u002F01.type-builders",{"title":195,"path":196,"stem":197},"Reflection","\u002Fruntypes\u002Fguide\u002Freflection","02.runtypes\u002F02.guide\u002F02.reflection",{"title":52,"path":199,"stem":200},"\u002Fruntypes\u002Fguide\u002Fvalidation","02.runtypes\u002F02.guide\u002F03.validation",{"title":56,"path":202,"stem":203},"\u002Fruntypes\u002Fguide\u002Fjson-round-trip","02.runtypes\u002F02.guide\u002F04.json-round-trip",{"title":205,"path":206,"stem":207},"Data Mocking","\u002Fruntypes\u002Fguide\u002Fmocking","02.runtypes\u002F02.guide\u002F07.mocking",{"title":209,"path":210,"stem":211},"JSON Schemas","\u002Fruntypes\u002Fguide\u002Fjson-schemas","02.runtypes\u002F02.guide\u002F08.json-schemas",{"title":213,"path":214,"stem":215},"Pure Functions","\u002Fruntypes\u002Fguide\u002Fpure-functions","02.runtypes\u002F02.guide\u002F09.pure-functions",{"title":217,"path":218,"stem":219},"Compiler Markers","\u002Fruntypes\u002Fguide\u002Fcompiler-markers","02.runtypes\u002F02.guide\u002F10.compiler-markers",{"title":221,"path":222,"stem":223},"All Compiled Functions","\u002Fruntypes\u002Fguide\u002Fall-compiled-functions","02.runtypes\u002F02.guide\u002F11.all-compiled-functions",{"title":225,"icon":226,"redirect":227,"path":228,"stem":229,"children":230,"page":24},"Type Formats","i-lucide-shapes","\u002Fruntypes\u002Ftype-formats\u002Foverview","\u002Fruntypes\u002Ftype-formats","02.runtypes\u002F03.type-formats",[231,234,238,242,246,250],{"title":232,"path":227,"stem":233},"Overview","02.runtypes\u002F03.type-formats\u002F01.overview",{"title":235,"path":236,"stem":237},"String Formats","\u002Fruntypes\u002Ftype-formats\u002Fstring","02.runtypes\u002F03.type-formats\u002F02.string",{"title":239,"path":240,"stem":241},"Number Formats","\u002Fruntypes\u002Ftype-formats\u002Fnumber","02.runtypes\u002F03.type-formats\u002F03.number",{"title":243,"path":244,"stem":245},"BigInt Formats","\u002Fruntypes\u002Ftype-formats\u002Fbigint","02.runtypes\u002F03.type-formats\u002F04.bigint",{"title":247,"path":248,"stem":249},"Date and Time Formats","\u002Fruntypes\u002Ftype-formats\u002Fdate-time","02.runtypes\u002F03.type-formats\u002F05.date-time",{"title":251,"path":252,"stem":253},"Collection Formats","\u002Fruntypes\u002Ftype-formats\u002Fcollections","02.runtypes\u002F03.type-formats\u002F06.collections",{"title":255,"icon":256,"redirect":257,"path":258,"stem":259,"children":260,"page":24},"Tooling","i-lucide-wrench","\u002Fruntypes\u002Ftooling\u002Flinting","\u002Fruntypes\u002Ftooling","02.runtypes\u002F04.tooling",[261,264],{"title":262,"path":257,"stem":263},"Linting","02.runtypes\u002F04.tooling\u002F01.linting",{"title":265,"path":266,"stem":267},"Source Conversion","\u002Fruntypes\u002Ftooling\u002Fsource-conversion","02.runtypes\u002F04.tooling\u002F02.source-conversion",{"title":269,"icon":270,"redirect":271,"path":272,"stem":273,"children":274,"page":24},"AI Integration","i-lucide-sparkles","\u002Fruntypes\u002Fai-integration\u002Fworkflow-and-commands","\u002Fruntypes\u002Fai-integration","02.runtypes\u002F05.ai-integration",[275,278,282,286],{"title":276,"path":271,"stem":277},"AI Workflow","02.runtypes\u002F05.ai-integration\u002F01.workflow-and-commands",{"title":279,"path":280,"stem":281},"FriendlyText","\u002Fruntypes\u002Fai-integration\u002Ffriendly-text","02.runtypes\u002F05.ai-integration\u002F02.friendly-text",{"title":283,"path":284,"stem":285},"MockData","\u002Fruntypes\u002Fai-integration\u002Fmock-data","02.runtypes\u002F05.ai-integration\u002F03.mock-data",{"title":287,"path":288,"stem":289},"Translations (i18n)","\u002Fruntypes\u002Fai-integration\u002Fi18n","02.runtypes\u002F05.ai-integration\u002F04.i18n",{"title":291,"icon":292,"redirect":293,"path":294,"stem":295,"children":296,"page":24},"Drizzle ORM","i-lineicons-drizzle","\u002Fruntypes\u002Fdrizzle-orm\u002Fdrizzle-overview","\u002Fruntypes\u002Fdrizzle-orm","02.runtypes\u002F06.drizzle-orm",[297,300,304,308,312,316,320,324,328],{"title":298,"path":293,"stem":299},"Drizzle Overview","02.runtypes\u002F06.drizzle-orm\u002F00.drizzle-overview",{"title":301,"path":302,"stem":303},"Column Formats","\u002Fruntypes\u002Fdrizzle-orm\u002Fcolumn-formats","02.runtypes\u002F06.drizzle-orm\u002F01.column-formats",{"title":305,"path":306,"stem":307},"Views","\u002Fruntypes\u002Fdrizzle-orm\u002Fviews","02.runtypes\u002F06.drizzle-orm\u002F02.views",{"title":309,"path":310,"stem":311},"Indexes and Constraints","\u002Fruntypes\u002Fdrizzle-orm\u002Fconstraints","02.runtypes\u002F06.drizzle-orm\u002F03.constraints",{"title":313,"path":314,"stem":315},"Row Level Security","\u002Fruntypes\u002Fdrizzle-orm\u002Frow-level-security","02.runtypes\u002F06.drizzle-orm\u002F04.row-level-security",{"title":317,"path":318,"stem":319},"Relations","\u002Fruntypes\u002Fdrizzle-orm\u002Frelations","02.runtypes\u002F06.drizzle-orm\u002F05.relations",{"title":321,"path":322,"stem":323},"The Schema File","\u002Fruntypes\u002Fdrizzle-orm\u002Fschema-file","02.runtypes\u002F06.drizzle-orm\u002F06.schema-file",{"title":325,"path":326,"stem":327},"Migrate an Existing Schema","\u002Fruntypes\u002Fdrizzle-orm\u002Fmigrate-an-existing-schema","02.runtypes\u002F06.drizzle-orm\u002F07.migrate-an-existing-schema",{"title":329,"path":330,"stem":331},"Cloudflare D1 and Durable Objects","\u002Fruntypes\u002Fdrizzle-orm\u002Fcloudflare-storage","02.runtypes\u002F06.drizzle-orm\u002F08.cloudflare-storage",{"title":333,"icon":334,"redirect":335,"path":336,"stem":337,"children":338,"page":24},"Diagnostics","i-lucide-triangle-alert","\u002Fruntypes\u002Fdiagnostics\u002Ferror-levels","\u002Fruntypes\u002Fdiagnostics","02.runtypes\u002F08.diagnostics",[339,342],{"title":340,"path":335,"stem":341},"Error Levels","02.runtypes\u002F08.diagnostics\u002F01.error-levels",{"title":343,"path":344,"stem":345},"All Diagnostics","\u002Fruntypes\u002Fdiagnostics\u002Fall-diagnostics","02.runtypes\u002F08.diagnostics\u002F02.all-diagnostics",{"title":347,"icon":348,"path":349,"stem":350,"children":351,"page":24},"Benchmarks","i-lucide-gauge","\u002Fbenchmarks","03.benchmarks",[352,372],{"title":5,"icon":6,"redirect":353,"path":354,"stem":355,"children":356,"page":24},"\u002Fbenchmarks\u002Frpc\u002Fhello-world","\u002Fbenchmarks\u002Frpc","03.benchmarks\u002F02.rpc",[357,360,364,368],{"title":358,"path":353,"stem":359},"Hello World","03.benchmarks\u002F02.rpc\u002F01.hello-world",{"title":361,"path":362,"stem":363},"Light Validation","\u002Fbenchmarks\u002Frpc\u002Flight-validation","03.benchmarks\u002F02.rpc\u002F02.light-validation",{"title":365,"path":366,"stem":367},"Heavy Validation","\u002Fbenchmarks\u002Frpc\u002Fheavy-validation","03.benchmarks\u002F02.rpc\u002F03.heavy-validation",{"title":369,"path":370,"stem":371},"Payload Sizes","\u002Fbenchmarks\u002Frpc\u002Fpayload-sizes","03.benchmarks\u002F02.rpc\u002F04.payload-sizes",{"title":163,"icon":164,"redirect":373,"path":374,"stem":375,"children":376,"page":24},"\u002Fbenchmarks\u002Fruntypes\u002Fis-valid","\u002Fbenchmarks\u002Fruntypes","03.benchmarks\u002F03.runtypes",[377,380,384,388,392,395],{"title":378,"path":373,"stem":379},"Is Valid","03.benchmarks\u002F03.runtypes\u002F01.is-valid",{"title":381,"path":382,"stem":383},"Is Valid Formats","\u002Fbenchmarks\u002Fruntypes\u002Fis-valid-formats","03.benchmarks\u002F03.runtypes\u002F02.is-valid-formats",{"title":385,"path":386,"stem":387},"Get Errors","\u002Fbenchmarks\u002Fruntypes\u002Fget-errors","03.benchmarks\u002F03.runtypes\u002F03.get-errors",{"title":389,"path":390,"stem":391},"Get Errors Formats","\u002Fbenchmarks\u002Fruntypes\u002Fget-errors-formats","03.benchmarks\u002F03.runtypes\u002F04.get-errors-formats",{"title":56,"path":393,"stem":394},"\u002Fbenchmarks\u002Fruntypes\u002Fjson-round-trip","03.benchmarks\u002F03.runtypes\u002F05.json-round-trip",{"title":396,"path":397,"stem":398},"Type Checking","\u002Fbenchmarks\u002Fruntypes\u002Ftype-checking","03.benchmarks\u002F03.runtypes\u002F07.type-checking",{"id":400,"title":151,"body":401,"description":1449,"extension":1450,"links":1451,"meta":1452,"navigation":463,"path":152,"seo":1453,"stem":153,"__hash__":1454},"docs\u002F01.rpc\u002F07.devtools\u002F03.nextjs.md",{"type":402,"value":403},"minimark",[404,413,521,524,529,542,549,553,565,1282,1286,1293,1297,1308,1312,1338,1438,1445],[405,406,407,408,412],"p",{},"mion resolves your types at build time, so its transform has to run inside Next. ",[409,410,411],"code",{},"withMion"," sets that up in one line.",[414,415,421],"pre",{"className":416,"code":417,"filename":418,"language":419,"meta":420,"style":420},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import {withMion} from '@mionjs\u002Fdevtools\u002Fnext';\n\n\u002F\u002F await is required: the whole-program scan must finish before Turbopack hands files over\nexport default await withMion({\n  reactStrictMode: true,\n});\n","next.config.ts","ts","",[409,422,423,458,465,472,494,511],{"__ignoreMap":420},[424,425,428,432,436,439,442,445,448,452,455],"span",{"class":426,"line":427},"line",1,[424,429,431],{"class":430},"s7zQu","import",[424,433,435],{"class":434},"sMK4o"," {",[424,437,411],{"class":438},"sTEyZ",[424,440,441],{"class":434},"}",[424,443,444],{"class":430}," from",[424,446,447],{"class":434}," '",[424,449,451],{"class":450},"sfazB","@mionjs\u002Fdevtools\u002Fnext",[424,453,454],{"class":434},"'",[424,456,457],{"class":434},";\n",[424,459,461],{"class":426,"line":460},2,[424,462,464],{"emptyLinePlaceholder":463},true,"\n",[424,466,468],{"class":426,"line":467},3,[424,469,471],{"class":470},"sHwdD","\u002F\u002F await is required: the whole-program scan must finish before Turbopack hands files over\n",[424,473,475,478,481,484,488,491],{"class":426,"line":474},4,[424,476,477],{"class":430},"export",[424,479,480],{"class":430}," default",[424,482,483],{"class":430}," await",[424,485,487],{"class":486},"s2Zo4"," withMion",[424,489,490],{"class":438},"(",[424,492,493],{"class":434},"{\n",[424,495,497,501,504,508],{"class":426,"line":496},5,[424,498,500],{"class":499},"swJcz","  reactStrictMode",[424,502,503],{"class":434},":",[424,505,507],{"class":506},"sfNiH"," true",[424,509,510],{"class":434},",\n",[424,512,514,516,519],{"class":426,"line":513},6,[424,515,441],{"class":434},[424,517,518],{"class":438},")",[424,520,457],{"class":434},[405,522,523],{},"That is the whole setup. Your front end gets the same compiled validation and JSON round trip functions as the rest of mion, from the same types.",[525,526,528],"h2",{"id":527},"turbopack-and-webpack","Turbopack and webpack",[405,530,531,533,534,537,538,541],{},[409,532,411],{}," picks the right setup for you. Turbopack has no plugin API, so mion starts a background process from ",[409,535,536],{},"next.config"," and registers a loader that asks it to rewrite each file. With ",[409,539,540],{},"next --webpack",", mion uses the ordinary webpack plugin.",[405,543,544,545,548],{},"Only your own TypeScript is rewritten. Files in ",[409,546,547],{},"node_modules"," are left alone.",[525,550,552],{"id":551},"hosting-the-api-in-your-next-app","Hosting the API in Your Next App",[405,554,555,556,560,561,564],{},"Add a catch-all route handler that imports your routes module and re-exports the handlers ",[557,558,559],"a",{"href":130},"@mionjs\u002Fplatform-vercel"," builds from them. Give ",[409,562,563],{},"\u002Fapi"," to both the router and the client:",[566,567,568,669,1099],"code-group",{},[414,569,572],{"className":416,"code":570,"filename":571,"language":419,"meta":420,"style":420},"import {createVercelHandler} from '@mionjs\u002Fplatform-vercel';\n\u002F\u002F creates the router and registers the routes\nimport '.\u002Froutes-example.ts';\n\n\u002F\u002F the App Router method handlers Next expects\nexport const {GET, POST, PUT, DELETE, PATCH} = createVercelHandler();\n","app\u002Fapi\u002F[...mion]\u002Froute.ts",[409,573,574,595,600,613,617,622],{"__ignoreMap":420},[424,575,576,578,580,583,585,587,589,591,593],{"class":426,"line":427},[424,577,431],{"class":430},[424,579,435],{"class":434},[424,581,582],{"class":438},"createVercelHandler",[424,584,441],{"class":434},[424,586,444],{"class":430},[424,588,447],{"class":434},[424,590,559],{"class":450},[424,592,454],{"class":434},[424,594,457],{"class":434},[424,596,597],{"class":426,"line":460},[424,598,599],{"class":470},"\u002F\u002F creates the router and registers the routes\n",[424,601,602,604,606,609,611],{"class":426,"line":467},[424,603,431],{"class":430},[424,605,447],{"class":434},[424,607,608],{"class":450},".\u002Froutes-example.ts",[424,610,454],{"class":434},[424,612,457],{"class":434},[424,614,615],{"class":426,"line":474},[424,616,464],{"emptyLinePlaceholder":463},[424,618,619],{"class":426,"line":496},[424,620,621],{"class":470},"\u002F\u002F the App Router method handlers Next expects\n",[424,623,624,626,630,632,635,638,641,643,646,648,651,653,656,658,661,664,667],{"class":426,"line":513},[424,625,477],{"class":430},[424,627,629],{"class":628},"spNyl"," const",[424,631,435],{"class":434},[424,633,634],{"class":438},"GET",[424,636,637],{"class":434},",",[424,639,640],{"class":438}," POST",[424,642,637],{"class":434},[424,644,645],{"class":438}," PUT",[424,647,637],{"class":434},[424,649,650],{"class":438}," DELETE",[424,652,637],{"class":434},[424,654,655],{"class":438}," PATCH",[424,657,441],{"class":434},[424,659,660],{"class":434}," =",[424,662,663],{"class":486}," createVercelHandler",[424,665,666],{"class":438},"()",[424,668,457],{"class":434},[414,670,673],{"className":416,"code":671,"filename":672,"language":419,"meta":420,"style":420},"import {createMionRouter, Routes, PublicApi} from '@mionjs\u002Frouter';\n\n\u002F\u002F the route handler is mounted under \u002Fapi; the client uses the same prefix\nconst mion = createMionRouter({basePath: '\u002Fapi'});\n\nexport interface User {\n  id: string;\n  name: string;\n  email: string;\n}\n\nexport const routes = {\n  users: {\n    getById: mion.route((ctx, id: string): User => {\n      return {id, name: 'John', email: 'john@example.com'};\n    }),\n    create: mion.route((ctx, user: Omit\u003CUser, 'id'>): User => {\n      return {id: 'USER-123', ...user};\n    }),\n  },\n} satisfies Routes;\n\nexport const myApi = mion.initRoutes(routes);\nexport type MyApi = PublicApi\u003Ctypeof routes>;\n","routes.ts",[409,674,675,707,711,716,752,756,770,783,795,807,813,818,832,842,886,928,938,991,1019,1028,1034,1046,1051,1075],{"__ignoreMap":420},[424,676,677,679,681,684,686,689,691,694,696,698,700,703,705],{"class":426,"line":427},[424,678,431],{"class":430},[424,680,435],{"class":434},[424,682,683],{"class":438},"createMionRouter",[424,685,637],{"class":434},[424,687,688],{"class":438}," Routes",[424,690,637],{"class":434},[424,692,693],{"class":438}," PublicApi",[424,695,441],{"class":434},[424,697,444],{"class":430},[424,699,447],{"class":434},[424,701,702],{"class":450},"@mionjs\u002Frouter",[424,704,454],{"class":434},[424,706,457],{"class":434},[424,708,709],{"class":426,"line":460},[424,710,464],{"emptyLinePlaceholder":463},[424,712,713],{"class":426,"line":467},[424,714,715],{"class":470},"\u002F\u002F the route handler is mounted under \u002Fapi; the client uses the same prefix\n",[424,717,718,721,724,727,730,732,735,738,740,742,744,746,748,750],{"class":426,"line":474},[424,719,720],{"class":628},"const",[424,722,723],{"class":438}," mion ",[424,725,726],{"class":434},"=",[424,728,729],{"class":486}," createMionRouter",[424,731,490],{"class":438},[424,733,734],{"class":434},"{",[424,736,737],{"class":499},"basePath",[424,739,503],{"class":434},[424,741,447],{"class":434},[424,743,563],{"class":450},[424,745,454],{"class":434},[424,747,441],{"class":434},[424,749,518],{"class":438},[424,751,457],{"class":434},[424,753,754],{"class":426,"line":496},[424,755,464],{"emptyLinePlaceholder":463},[424,757,758,760,763,767],{"class":426,"line":513},[424,759,477],{"class":430},[424,761,762],{"class":628}," interface",[424,764,766],{"class":765},"sBMFI"," User",[424,768,769],{"class":434}," {\n",[424,771,773,776,778,781],{"class":426,"line":772},7,[424,774,775],{"class":499},"  id",[424,777,503],{"class":434},[424,779,780],{"class":765}," string",[424,782,457],{"class":434},[424,784,786,789,791,793],{"class":426,"line":785},8,[424,787,788],{"class":499},"  name",[424,790,503],{"class":434},[424,792,780],{"class":765},[424,794,457],{"class":434},[424,796,798,801,803,805],{"class":426,"line":797},9,[424,799,800],{"class":499},"  email",[424,802,503],{"class":434},[424,804,780],{"class":765},[424,806,457],{"class":434},[424,808,810],{"class":426,"line":809},10,[424,811,812],{"class":434},"}\n",[424,814,816],{"class":426,"line":815},11,[424,817,464],{"emptyLinePlaceholder":463},[424,819,821,823,825,828,830],{"class":426,"line":820},12,[424,822,477],{"class":430},[424,824,629],{"class":628},[424,826,827],{"class":438}," routes ",[424,829,726],{"class":434},[424,831,769],{"class":434},[424,833,835,838,840],{"class":426,"line":834},13,[424,836,837],{"class":499},"  users",[424,839,503],{"class":434},[424,841,769],{"class":434},[424,843,845,848,850,853,856,859,861,863,867,869,872,874,876,879,881,884],{"class":426,"line":844},14,[424,846,847],{"class":499},"    getById",[424,849,503],{"class":434},[424,851,852],{"class":438}," mion",[424,854,855],{"class":434},".",[424,857,858],{"class":486},"route",[424,860,490],{"class":438},[424,862,490],{"class":434},[424,864,866],{"class":865},"sHdIc","ctx",[424,868,637],{"class":434},[424,870,871],{"class":865}," id",[424,873,503],{"class":434},[424,875,780],{"class":765},[424,877,878],{"class":434},"):",[424,880,766],{"class":765},[424,882,883],{"class":628}," =>",[424,885,769],{"class":434},[424,887,889,892,894,897,899,902,904,906,909,911,913,916,918,920,923,925],{"class":426,"line":888},15,[424,890,891],{"class":430},"      return",[424,893,435],{"class":434},[424,895,896],{"class":438},"id",[424,898,637],{"class":434},[424,900,901],{"class":499}," name",[424,903,503],{"class":434},[424,905,447],{"class":434},[424,907,908],{"class":450},"John",[424,910,454],{"class":434},[424,912,637],{"class":434},[424,914,915],{"class":499}," email",[424,917,503],{"class":434},[424,919,447],{"class":434},[424,921,922],{"class":450},"john@example.com",[424,924,454],{"class":434},[424,926,927],{"class":434},"};\n",[424,929,931,934,936],{"class":426,"line":930},16,[424,932,933],{"class":434},"    }",[424,935,518],{"class":438},[424,937,510],{"class":434},[424,939,941,944,946,948,950,952,954,956,958,960,963,965,968,971,974,976,978,980,982,985,987,989],{"class":426,"line":940},17,[424,942,943],{"class":499},"    create",[424,945,503],{"class":434},[424,947,852],{"class":438},[424,949,855],{"class":434},[424,951,858],{"class":486},[424,953,490],{"class":438},[424,955,490],{"class":434},[424,957,866],{"class":865},[424,959,637],{"class":434},[424,961,962],{"class":865}," user",[424,964,503],{"class":434},[424,966,967],{"class":765}," Omit",[424,969,970],{"class":434},"\u003C",[424,972,973],{"class":765},"User",[424,975,637],{"class":434},[424,977,447],{"class":434},[424,979,896],{"class":450},[424,981,454],{"class":434},[424,983,984],{"class":434},">):",[424,986,766],{"class":765},[424,988,883],{"class":628},[424,990,769],{"class":434},[424,992,994,996,998,1000,1002,1004,1007,1009,1011,1014,1017],{"class":426,"line":993},18,[424,995,891],{"class":430},[424,997,435],{"class":434},[424,999,896],{"class":499},[424,1001,503],{"class":434},[424,1003,447],{"class":434},[424,1005,1006],{"class":450},"USER-123",[424,1008,454],{"class":434},[424,1010,637],{"class":434},[424,1012,1013],{"class":434}," ...",[424,1015,1016],{"class":438},"user",[424,1018,927],{"class":434},[424,1020,1022,1024,1026],{"class":426,"line":1021},19,[424,1023,933],{"class":434},[424,1025,518],{"class":438},[424,1027,510],{"class":434},[424,1029,1031],{"class":426,"line":1030},20,[424,1032,1033],{"class":434},"  },\n",[424,1035,1037,1039,1042,1044],{"class":426,"line":1036},21,[424,1038,441],{"class":434},[424,1040,1041],{"class":430}," satisfies",[424,1043,688],{"class":765},[424,1045,457],{"class":434},[424,1047,1049],{"class":426,"line":1048},22,[424,1050,464],{"emptyLinePlaceholder":463},[424,1052,1054,1056,1058,1061,1063,1065,1067,1070,1073],{"class":426,"line":1053},23,[424,1055,477],{"class":430},[424,1057,629],{"class":628},[424,1059,1060],{"class":438}," myApi ",[424,1062,726],{"class":434},[424,1064,852],{"class":438},[424,1066,855],{"class":434},[424,1068,1069],{"class":486},"initRoutes",[424,1071,1072],{"class":438},"(routes)",[424,1074,457],{"class":434},[424,1076,1078,1080,1083,1086,1088,1090,1093,1096],{"class":426,"line":1077},24,[424,1079,477],{"class":430},[424,1081,1082],{"class":628}," type",[424,1084,1085],{"class":765}," MyApi",[424,1087,660],{"class":434},[424,1089,693],{"class":765},[424,1091,1092],{"class":434},"\u003Ctypeof",[424,1094,1095],{"class":438}," routes",[424,1097,1098],{"class":434},">;\n",[414,1100,1103],{"className":416,"code":1101,"filename":1102,"language":419,"meta":420,"style":420},"import {initClient} from '@mionjs\u002Fclient';\n\n\u002F\u002F type only, from the routes module the route handler registers\nimport type {MyApi} from '.\u002Froutes-example.ts';\n\n\u002F\u002F same \u002Fapi prefix as the router, so baseURL stays at the app's own origin\nconst {routes} = initClient\u003CMyApi>({\n  baseURL: 'https:\u002F\u002Fmy-app.example.com',\n  basePath: '\u002Fapi',\n});\n\nexport const greeting = await routes.users.getById('USER-123').call();\n","client.ts",[409,1104,1105,1127,1131,1136,1159,1163,1168,1195,1211,1226,1234,1238],{"__ignoreMap":420},[424,1106,1107,1109,1111,1114,1116,1118,1120,1123,1125],{"class":426,"line":427},[424,1108,431],{"class":430},[424,1110,435],{"class":434},[424,1112,1113],{"class":438},"initClient",[424,1115,441],{"class":434},[424,1117,444],{"class":430},[424,1119,447],{"class":434},[424,1121,1122],{"class":450},"@mionjs\u002Fclient",[424,1124,454],{"class":434},[424,1126,457],{"class":434},[424,1128,1129],{"class":426,"line":460},[424,1130,464],{"emptyLinePlaceholder":463},[424,1132,1133],{"class":426,"line":467},[424,1134,1135],{"class":470},"\u002F\u002F type only, from the routes module the route handler registers\n",[424,1137,1138,1140,1142,1144,1147,1149,1151,1153,1155,1157],{"class":426,"line":474},[424,1139,431],{"class":430},[424,1141,1082],{"class":430},[424,1143,435],{"class":434},[424,1145,1146],{"class":438},"MyApi",[424,1148,441],{"class":434},[424,1150,444],{"class":430},[424,1152,447],{"class":434},[424,1154,608],{"class":450},[424,1156,454],{"class":434},[424,1158,457],{"class":434},[424,1160,1161],{"class":426,"line":496},[424,1162,464],{"emptyLinePlaceholder":463},[424,1164,1165],{"class":426,"line":513},[424,1166,1167],{"class":470},"\u002F\u002F same \u002Fapi prefix as the router, so baseURL stays at the app's own origin\n",[424,1169,1170,1172,1174,1177,1179,1181,1184,1186,1188,1191,1193],{"class":426,"line":772},[424,1171,720],{"class":628},[424,1173,435],{"class":434},[424,1175,1176],{"class":438},"routes",[424,1178,441],{"class":434},[424,1180,660],{"class":434},[424,1182,1183],{"class":486}," initClient",[424,1185,970],{"class":434},[424,1187,1146],{"class":765},[424,1189,1190],{"class":434},">",[424,1192,490],{"class":438},[424,1194,493],{"class":434},[424,1196,1197,1200,1202,1204,1207,1209],{"class":426,"line":785},[424,1198,1199],{"class":499},"  baseURL",[424,1201,503],{"class":434},[424,1203,447],{"class":434},[424,1205,1206],{"class":450},"https:\u002F\u002Fmy-app.example.com",[424,1208,454],{"class":434},[424,1210,510],{"class":434},[424,1212,1213,1216,1218,1220,1222,1224],{"class":426,"line":797},[424,1214,1215],{"class":499},"  basePath",[424,1217,503],{"class":434},[424,1219,447],{"class":434},[424,1221,563],{"class":450},[424,1223,454],{"class":434},[424,1225,510],{"class":434},[424,1227,1228,1230,1232],{"class":426,"line":809},[424,1229,441],{"class":434},[424,1231,518],{"class":438},[424,1233,457],{"class":434},[424,1235,1236],{"class":426,"line":815},[424,1237,464],{"emptyLinePlaceholder":463},[424,1239,1240,1242,1244,1247,1249,1251,1253,1255,1258,1260,1263,1265,1267,1269,1271,1273,1275,1278,1280],{"class":426,"line":820},[424,1241,477],{"class":430},[424,1243,629],{"class":628},[424,1245,1246],{"class":438}," greeting ",[424,1248,726],{"class":434},[424,1250,483],{"class":430},[424,1252,1095],{"class":438},[424,1254,855],{"class":434},[424,1256,1257],{"class":438},"users",[424,1259,855],{"class":434},[424,1261,1262],{"class":486},"getById",[424,1264,490],{"class":438},[424,1266,454],{"class":434},[424,1268,1006],{"class":450},[424,1270,454],{"class":434},[424,1272,518],{"class":438},[424,1274,855],{"class":434},[424,1276,1277],{"class":486},"call",[424,1279,666],{"class":438},[424,1281,457],{"class":434},[525,1283,1285],{"id":1284},"batches-in-your-next-app","Batches in Your Next App",[405,1287,1288,1289,1292],{},"Nothing to configure. The build reads your ",[557,1290,1291],{"href":96},"batches"," and compiles them into the route handler. Batches need the API in this app's build.",[525,1294,1296],{"id":1295},"editing-types-while-the-dev-server-runs","Editing Types While the Dev Server Runs",[405,1298,1299,1300,1303,1304,1307],{},"Edit a type and every file rewritten from it recompiles, even when the type sits in a ",[409,1301,1302],{},".d.ts"," with no import to follow. ",[409,1305,1306],{},"next dev"," stays correct without a restart.",[525,1309,1311],{"id":1310},"options","Options",[405,1313,1314,1316,1317,1320,1321,1324,1325,1328,1329,1333,1334,503],{},[409,1315,411],{}," takes the same ",[409,1318,1319],{},"tsConfig",", ",[409,1322,1323],{},"client"," and ",[409,1326,1327],{},"runTypes"," options as the ",[557,1330,1332],{"href":1331},"\u002Frpc\u002Fdevtools\u002Fvite#all-plugin-options","Vite plugin",", for example to ",[557,1335,1337],{"href":1336},"\u002Frpc\u002Fmiddlewares\u002Ffetch-metadata#disabling-routes-metadata-bundling","fetch route metadata",[414,1339,1341],{"className":416,"code":1340,"filename":418,"language":419,"meta":420,"style":420},"import {withMion} from '@mionjs\u002Fdevtools\u002Fnext';\n\nexport default await withMion(\n  {reactStrictMode: true},\n  {\n    \u002F\u002F fetch each route's metadata from the server on first use\n    client: {routes: 'fetch'},\n  }\n);\n",[409,1342,1343,1363,1367,1380,1395,1400,1405,1427,1432],{"__ignoreMap":420},[424,1344,1345,1347,1349,1351,1353,1355,1357,1359,1361],{"class":426,"line":427},[424,1346,431],{"class":430},[424,1348,435],{"class":434},[424,1350,411],{"class":438},[424,1352,441],{"class":434},[424,1354,444],{"class":430},[424,1356,447],{"class":434},[424,1358,451],{"class":450},[424,1360,454],{"class":434},[424,1362,457],{"class":434},[424,1364,1365],{"class":426,"line":460},[424,1366,464],{"emptyLinePlaceholder":463},[424,1368,1369,1371,1373,1375,1377],{"class":426,"line":467},[424,1370,477],{"class":430},[424,1372,480],{"class":430},[424,1374,483],{"class":430},[424,1376,487],{"class":486},[424,1378,1379],{"class":438},"(\n",[424,1381,1382,1385,1388,1390,1392],{"class":426,"line":474},[424,1383,1384],{"class":434},"  {",[424,1386,1387],{"class":499},"reactStrictMode",[424,1389,503],{"class":434},[424,1391,507],{"class":506},[424,1393,1394],{"class":434},"},\n",[424,1396,1397],{"class":426,"line":496},[424,1398,1399],{"class":434},"  {\n",[424,1401,1402],{"class":426,"line":513},[424,1403,1404],{"class":470},"    \u002F\u002F fetch each route's metadata from the server on first use\n",[424,1406,1407,1410,1412,1414,1416,1418,1420,1423,1425],{"class":426,"line":772},[424,1408,1409],{"class":499},"    client",[424,1411,503],{"class":434},[424,1413,435],{"class":434},[424,1415,1176],{"class":499},[424,1417,503],{"class":434},[424,1419,447],{"class":434},[424,1421,1422],{"class":450},"fetch",[424,1424,454],{"class":434},[424,1426,1394],{"class":434},[424,1428,1429],{"class":426,"line":785},[424,1430,1431],{"class":434},"  }\n",[424,1433,1434,1436],{"class":426,"line":797},[424,1435,518],{"class":438},[424,1437,457],{"class":434},[405,1439,1440,1441,1444],{},"The Vite ",[409,1442,1443],{},"server"," block is refused, and the Vue single file component switch is ignored. Next runs its own dev server and builds your API route with everything else.",[1446,1447,1448],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}","Run mion's build transform in a Next.js app, on Turbopack or webpack.","md",null,{"toc":24},{"title":151,"description":1449},"dsNsGJM6D5wsa2NyzAdyu0a5a7WghzpkYUTp-iu7xWw",1793324371372]