[{"data":1,"prerenderedAt":538},["ShallowReactive",2],{"page:\u002Fdocs\u002F5.x\u002Fintroduction\u002Finstallation":3},{"id":4,"title":5,"body":6,"description":520,"extension":521,"frontmatter":522,"heading":5,"meta":529,"navigation":531,"order":525,"path":532,"seo":533,"sitemap":534,"source":535,"stem":536,"__hash__":537},"docs\u002Fdocs\u002F5.x\u002Fintroduction\u002Finstallation.md","Install Kubb with npm, pnpm, Yarn, or Bun",{"type":7,"value":8,"toc":504},"minimark",[9,19,24,38,42,69,135,154,158,386,390,413,417,427],[10,11,12,13,18],"p",{},"Add Kubb to an existing project. To learn with a sample spec first, follow ",[14,15,17],"a",{"href":16},"\u002Fdocs\u002F5.x\u002Ftutorials\u002Fquickstart","Generate your first client",".",[20,21,23],"h2",{"id":22},"prerequisites","Prerequisites",[25,26,27,35],"ul",{},[28,29,30,34],"li",{},[14,31,33],{"href":32},"https:\u002F\u002Fnodejs.org\u002F","Node.js"," 22.22 or later.",[28,36,37],{},"TypeScript 5 or later to type-check the generated code. Kubb works with TypeScript 7, the native compiler.",[20,39,41],{"id":40},"set-up-with-the-wizard","Set up with the wizard",[10,43,44,48,49,52,53,56,57,60,61,64,65,68],{},[45,46,47],"code",{},"kubb init"," installs ",[45,50,51],{},"kubb"," and the plugins you pick, writes ",[45,54,55],{},"kubb.config.ts",", adds a ",[45,58,59],{},"generate"," script to ",[45,62,63],{},"package.json"," if it has none, and runs Kubb once. It uses the package manager in your ",[45,66,67],{},"packageManager"," field or lockfile, or npm.",[70,71,73,96,109,122],"code-group",{"sync":72},"package-manager",[74,75,80],"pre",{"language":76,"filename":77,"code":78,"class":79},"shell","pnpm","pnpm dlx kubb init","highlights",[45,81,83],{"class":82},"language-shell",[84,85,88,92],"span",{"class":86,"style":87},"line","display: inline",[84,89,91],{"style":90},"color:#6f42c1;--hls-dark:#b392f0","pnpm ",[84,93,95],{"style":94},"color:#24292e;--hls-dark:#e1e4e8","dlx kubb init",[74,97,100],{"language":76,"filename":98,"code":99,"class":79},"npm","npx kubb init",[45,101,102],{"class":82},[84,103,104,107],{"class":86,"style":87},[84,105,106],{"style":90},"npx ",[84,108,47],{"style":94},[74,110,113],{"language":76,"filename":111,"code":112,"class":79},"yarn","yarn dlx kubb init",[45,114,115],{"class":82},[84,116,117,120],{"class":86,"style":87},[84,118,119],{"style":90},"yarn ",[84,121,95],{"style":94},[74,123,126],{"language":76,"filename":124,"code":125,"class":79},"bun","bunx kubb init",[45,127,128],{"class":82},[84,129,130,133],{"class":86,"style":87},[84,131,132],{"style":90},"bunx ",[84,134,47],{"style":94},[10,136,137,142,143,146,147,150,151,18],{},[14,138,140],{"href":139},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Finit",[45,141,47],{}," lists its questions and flags, such as ",[45,144,145],{},"--yes",", ",[45,148,149],{},"--input",", and ",[45,152,153],{},"--plugins",[20,155,157],{"id":156},"install-by-hand","Install by hand",[159,160,162,167,182,251,255,303,307,330,333,381],"steps",{"level":161},"3",[163,164,166],"h3",{"id":165},"install-kubb-and-your-plugins","Install Kubb and your plugins",[10,168,169,170,172,173,177,178,181],{},"Install ",[45,171,51],{}," and the ",[14,174,176],{"href":175},"\u002Fextensions\u002Fkind\u002Fplugins","plugins"," you need, one package per output. The example adds ",[45,179,180],{},"@kubb\u002Fplugin-ts",":",[70,183,184,202,219,234],{"sync":72},[74,185,187],{"language":76,"filename":77,"code":186,"class":79},"pnpm add -D kubb @kubb\u002Fplugin-ts typescript",[45,188,189],{"class":82},[84,190,191,193,196,199],{"class":86,"style":87},[84,192,91],{"style":90},[84,194,195],{"style":94},"add -D kubb ",[84,197,198],{"style":94},"@",[84,200,201],{"style":94},"kubb\u002Fplugin-ts typescript",[74,203,205],{"language":76,"filename":98,"code":204,"class":79},"npm install -D kubb @kubb\u002Fplugin-ts typescript",[45,206,207],{"class":82},[84,208,209,212,215,217],{"class":86,"style":87},[84,210,211],{"style":90},"npm ",[84,213,214],{"style":94},"install -D kubb ",[84,216,198],{"style":94},[84,218,201],{"style":94},[74,220,222],{"language":76,"filename":111,"code":221,"class":79},"yarn add -D kubb @kubb\u002Fplugin-ts typescript",[45,223,224],{"class":82},[84,225,226,228,230,232],{"class":86,"style":87},[84,227,119],{"style":90},[84,229,195],{"style":94},[84,231,198],{"style":94},[84,233,201],{"style":94},[74,235,237],{"language":76,"filename":124,"code":236,"class":79},"bun add -d kubb @kubb\u002Fplugin-ts typescript",[45,238,239],{"class":82},[84,240,241,244,247,249],{"class":86,"style":87},[84,242,243],{"style":90},"bun ",[84,245,246],{"style":94},"add -d kubb ",[84,248,198],{"style":94},[84,250,201],{"style":94},[163,252,254],{"id":253},"verify-the-installation","Verify the installation",[70,256,257,269,281,292],{"sync":72},[74,258,260],{"language":76,"filename":77,"code":259,"class":79},"pnpm exec kubb --version",[45,261,262],{"class":82},[84,263,264,266],{"class":86,"style":87},[84,265,91],{"style":90},[84,267,268],{"style":94},"exec kubb --version",[74,270,272],{"language":76,"filename":98,"code":271,"class":79},"npx kubb --version",[45,273,274],{"class":82},[84,275,276,278],{"class":86,"style":87},[84,277,106],{"style":90},[84,279,280],{"style":94},"kubb --version",[74,282,284],{"language":76,"filename":111,"code":283,"class":79},"yarn kubb --version",[45,285,286],{"class":82},[84,287,288,290],{"class":86,"style":87},[84,289,119],{"style":90},[84,291,280],{"style":94},[74,293,295],{"language":76,"filename":124,"code":294,"class":79},"bunx kubb --version",[45,296,297],{"class":82},[84,298,299,301],{"class":86,"style":87},[84,300,132],{"style":90},[84,302,280],{"style":94},[163,304,306],{"id":305},"create-the-config","Create the config",[10,308,309,310,312,313,316,317,320,321,325,326,18],{},"Write ",[45,311,55],{}," in the project root with your spec as ",[45,314,315],{},"input",", an ",[45,318,319],{},"output.path",", and your plugins. Start from ",[14,322,324],{"href":323},"\u002Fdocs\u002F5.x\u002Fhow-to\u002Frecipes#pick-a-stack","Pick a stack",", or see ",[14,327,329],{"href":328},"\u002Fdocs\u002F5.x\u002Freference\u002Fconfiguration","Configuration",[163,331,332],{"id":59},"Generate",[70,334,335,347,359,370],{"sync":72},[74,336,338],{"language":76,"filename":77,"code":337,"class":79},"pnpm exec kubb generate",[45,339,340],{"class":82},[84,341,342,344],{"class":86,"style":87},[84,343,91],{"style":90},[84,345,346],{"style":94},"exec kubb generate",[74,348,350],{"language":76,"filename":98,"code":349,"class":79},"npx kubb generate",[45,351,352],{"class":82},[84,353,354,356],{"class":86,"style":87},[84,355,106],{"style":90},[84,357,358],{"style":94},"kubb generate",[74,360,362],{"language":76,"filename":111,"code":361,"class":79},"yarn kubb generate",[45,363,364],{"class":82},[84,365,366,368],{"class":86,"style":87},[84,367,119],{"style":90},[84,369,358],{"style":94},[74,371,373],{"language":76,"filename":124,"code":372,"class":79},"bunx kubb generate",[45,374,375],{"class":82},[84,376,377,379],{"class":86,"style":87},[84,378,132],{"style":90},[84,380,358],{"style":94},[10,382,383,384,18],{},"Kubb writes the generated files to ",[45,385,319],{},[20,387,389],{"id":388},"install-runtime-libraries","Install runtime libraries",[391,392,394,395,397,398,401,402,405,406,397,409,412],"blockquote",{"as":393},"important","Install the libraries your generated code imports yourself. ",[45,396,47],{}," and ",[45,399,400],{},"kubb add"," install only Kubb packages. An Axios client needs ",[45,403,404],{},"axios",", and React Query hooks need ",[45,407,408],{},"react",[45,410,411],{},"@tanstack\u002Freact-query",". Each plugin page lists its requirements.",[20,414,416],{"id":415},"add-plugins-later","Add plugins later",[10,418,419,420,422,423,181],{},"After ",[45,421,55],{}," exists, manage extensions from the ",[14,424,426],{"href":425},"\u002Fextensions","extension registry",[428,429,430,443],"table",{},[431,432,433],"thead",{},[434,435,436,440],"tr",{},[437,438,439],"th",{},"Command",[437,441,442],{},"What it does",[444,445,446,462,475,488],"tbody",{},[434,447,448,457],{},[449,450,451],"td",{},[14,452,454],{"href":453},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Fadd",[45,455,456],{},"kubb add plugin-zod",[449,458,459,460],{},"Installs the plugin at the version the registry pins and adds it to ",[45,461,55],{},[434,463,464,472],{},[449,465,466],{},[14,467,469],{"href":468},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Flist",[45,470,471],{},"kubb list",[449,473,474],{},"Lists installed extensions, their versions, and available updates",[434,476,477,485],{},[449,478,479],{},[14,480,482],{"href":481},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Fupdate",[45,483,484],{},"kubb update",[449,486,487],{},"Moves installed extensions to the pinned versions, generates again, and summarizes the file changes",[434,489,490,498],{},[449,491,492],{},[14,493,495],{"href":494},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Fremove",[45,496,497],{},"kubb remove plugin-zod",[449,499,500,501,503],{},"Removes the plugin from ",[45,502,55],{}," and uninstalls its package",{"title":505,"searchDepth":506,"depth":506,"links":507},"",5,[508,510,511,518,519],{"id":22,"depth":509,"text":23},2,{"id":40,"depth":509,"text":41},{"id":156,"depth":509,"text":157,"children":512},[513,515,516,517],{"id":165,"depth":514,"text":166},3,{"id":253,"depth":514,"text":254},{"id":305,"depth":514,"text":306},{"id":59,"depth":514,"text":332},{"id":388,"depth":509,"text":389},{"id":415,"depth":509,"text":416},"Set up Kubb in an existing project with the kubb init wizard or by hand with npm, pnpm, Yarn, or Bun, verify the version, and add plugins later with kubb add.","md",{"layout":523,"title":5,"description":520,"outline":524,"order":525,"navigation":526},"doc",[509,514],1,{"title":527,"icon":528},"Installation","i-iconoir-download",{"layout":523,"outline":530},[509,514],{"title":527,"icon":528},"\u002Fdocs\u002F5.x\u002Fintroduction\u002Finstallation",{"title":5,"description":520},{"loc":532},"kubb-labs\u002Fkubb\u002Fdocs\u002F5.x\u002Fintroduction\u002Finstallation.md","docs\u002F5.x\u002Fintroduction\u002Finstallation","aTLPypTu7MkNjnvwQx2FOVYsU03g_ENkMclv7-Owzqs",1795021320230]