[{"data":1,"prerenderedAt":879},["ShallowReactive",2],{"navigation":3,"-docs-storage":224,"-docs-storage-surround":875},[4,83,208,214,221],{"title":5,"path":6,"stem":7,"children":8,"icon":82},"","/docs","1.docs/1.index",[9,12,17,22,27,32,37,42,47,52,57,62,67,72,77],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-compass",{"title":13,"path":14,"stem":15,"icon":16},"Quick Start","/docs/quick-start","1.docs/2.quick-start","i-lucide-zap",{"title":18,"path":19,"stem":20,"icon":21},"Renderer","/docs/renderer","1.docs/4.renderer","ri:layout-masonry-line",{"title":23,"path":24,"stem":25,"icon":26},"Routing","/docs/routing","1.docs/5.routing","ri:direction-line",{"title":28,"path":29,"stem":30,"icon":31},"Assets","/docs/assets","1.docs/50.assets","ri:image-2-line",{"title":33,"path":34,"stem":35,"icon":36},"Configuration","/docs/configuration","1.docs/50.configuration","ri:settings-3-line",{"title":38,"path":39,"stem":40,"icon":41},"Database","/docs/database","1.docs/50.database","ri:database-2-line",{"title":43,"path":44,"stem":45,"icon":46},"Lifecycle","/docs/lifecycle","1.docs/50.lifecycle","i-lucide-layers",{"title":48,"path":49,"stem":50,"icon":51},"Plugins","/docs/plugins","1.docs/50.plugins","ri:plug-line",{"title":53,"path":54,"stem":55,"icon":56},"Tasks","/docs/tasks","1.docs/50.tasks","codicon:run-all",{"title":58,"path":59,"stem":60,"icon":61},"Server Entry","/docs/server-entry","1.docs/6.server-entry","ri:server-line",{"title":63,"path":64,"stem":65,"icon":66},"Cache","/docs/cache","1.docs/7.cache","ri:speed-line",{"title":68,"path":69,"stem":70,"icon":71},"KV Storage","/docs/storage","1.docs/8.storage","carbon:datastore",{"title":73,"path":74,"stem":75,"icon":76},"Migration Guide","/docs/migration","1.docs/99.migration","ri:arrow-right-up-line",{"title":78,"path":79,"stem":80,"icon":81},"Nightly Channel","/docs/nightly","1.docs/99.nightly","ri:moon-fill","i-lucide-book-open",{"title":84,"path":85,"stem":86,"children":87,"icon":89},"Deploy","/deploy","2.deploy/0.index",[88,90,111],{"title":84,"path":85,"stem":86,"icon":89},"ri:upload-cloud-2-line",{"title":91,"path":92,"stem":93,"children":94,"page":110},"Runtimes","/deploy/runtimes","2.deploy/10.runtimes",[95,100,105],{"title":96,"path":97,"stem":98,"icon":99},"Node.js","/deploy/runtimes/node","2.deploy/10.runtimes/1.node","akar-icons:node-fill",{"title":101,"path":102,"stem":103,"icon":104},"Bun","/deploy/runtimes/bun","2.deploy/10.runtimes/bun","simple-icons:bun",{"title":106,"path":107,"stem":108,"icon":109},"Deno","/deploy/runtimes/deno","2.deploy/10.runtimes/deno","simple-icons:deno",false,{"title":112,"path":113,"stem":114,"children":115,"page":110},"Providers","/deploy/providers","2.deploy/20.providers",[116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204],{"title":117,"path":118,"stem":119},"Alwaysdata","/deploy/providers/alwaysdata","2.deploy/20.providers/alwaysdata",{"title":121,"path":122,"stem":123},"AWS Lambda","/deploy/providers/aws","2.deploy/20.providers/aws",{"title":125,"path":126,"stem":127},"AWS Amplify","/deploy/providers/aws-amplify","2.deploy/20.providers/aws-amplify",{"title":129,"path":130,"stem":131},"Azure","/deploy/providers/azure","2.deploy/20.providers/azure",{"title":133,"path":134,"stem":135},"Cleavr","/deploy/providers/cleavr","2.deploy/20.providers/cleavr",{"title":137,"path":138,"stem":139},"Cloudflare","/deploy/providers/cloudflare","2.deploy/20.providers/cloudflare",{"title":141,"path":142,"stem":143},"Deno Deploy","/deploy/providers/deno-deploy","2.deploy/20.providers/deno-deploy",{"title":145,"path":146,"stem":147},"DigitalOcean","/deploy/providers/digitalocean","2.deploy/20.providers/digitalocean",{"title":149,"path":150,"stem":151},"Firebase","/deploy/providers/firebase","2.deploy/20.providers/firebase",{"title":153,"path":154,"stem":155},"Flightcontrol","/deploy/providers/flightcontrol","2.deploy/20.providers/flightcontrol",{"title":157,"path":158,"stem":159},"Genezio","/deploy/providers/genezio","2.deploy/20.providers/genezio",{"title":161,"path":162,"stem":163},"GitHub Pages","/deploy/providers/github-pages","2.deploy/20.providers/github-pages",{"title":165,"path":166,"stem":167},"GitLab Pages","/deploy/providers/gitlab-pages","2.deploy/20.providers/gitlab-pages",{"title":169,"path":170,"stem":171},"Heroku","/deploy/providers/heroku","2.deploy/20.providers/heroku",{"title":173,"path":174,"stem":175},"IIS","/deploy/providers/iis","2.deploy/20.providers/iis",{"title":177,"path":178,"stem":179},"Koyeb","/deploy/providers/koyeb","2.deploy/20.providers/koyeb",{"title":181,"path":182,"stem":183},"Netlify","/deploy/providers/netlify","2.deploy/20.providers/netlify",{"title":185,"path":186,"stem":187},"Platform.sh","/deploy/providers/platform-sh","2.deploy/20.providers/platform-sh",{"title":189,"path":190,"stem":191},"Render.com","/deploy/providers/render","2.deploy/20.providers/render",{"title":193,"path":194,"stem":195},"StormKit","/deploy/providers/stormkit","2.deploy/20.providers/stormkit",{"title":197,"path":198,"stem":199},"Vercel","/deploy/providers/vercel","2.deploy/20.providers/vercel",{"title":201,"path":202,"stem":203},"Zeabur","/deploy/providers/zeabur","2.deploy/20.providers/zeabur",{"title":205,"path":206,"stem":207},"Zerops","/deploy/providers/zerops","2.deploy/20.providers/zerops",{"title":209,"path":210,"stem":211,"children":212,"icon":36},"Config","/config","3.config/0.index",[213],{"title":209,"path":210,"stem":211,"icon":36},{"title":215,"path":216,"stem":217,"children":218,"icon":220},"Examples","/examples","4.examples/0.index",[219],{"title":215,"path":216,"stem":217,"icon":220},"i-lucide-folder-code",{"title":5,"path":222,"stem":223},"/","index",{"id":225,"title":68,"body":226,"description":869,"extension":870,"meta":871,"navigation":872,"path":69,"seo":873,"stem":70,"__hash__":874},"content/1.docs/8.storage.md",{"type":227,"value":228,"toc":864,"icon":71},"minimark",[229,236,247,252,268,552,555,558,565,568,647,654,665,669,676,850,860],[230,231,232],"warning",{},[233,234,235],"p",{},"Nitro v3 Alpha docs are a work in progress — expect updates, rough edges, and occasional inaccuracies.",[233,237,238,239,246],{},"Nitro has built-in integration with ",[240,241,245],"a",{"href":242,"rel":243},"https://unstorage.unjs.io",[244],"nofollow","unstorage"," to provide a runtime agnostic persistent layer.",[248,249,251],"h2",{"id":250},"usage","Usage",[233,253,254,255,259,260,263,264,267],{},"To use the storage layer, you can use the ",[256,257,258],"code",{},"useStorage()"," and call ",[256,261,262],{},"get(key)"," to retrieve an item and ",[256,265,266],{},"set(key, value)"," to set an item.",[269,270,274],"pre",{"className":271,"code":272,"language":273,"meta":5,"style":5},"language-ts shiki shiki-themes github-light github-dark github-dark","import { useStorage } from \"nitro/storage\";\n\n// Default storage is in memory\nawait useStorage().set(\"test:foo\", { hello: \"world\" })\nawait useStorage().get(\"test:foo\")\n\n// You can use data storage to write data to default .data/kv directory\nconst dataStorage = useStorage(\"data\")\nawait dataStorage.set(\"test\", \"works\")\nawait dataStorage.get(\"data:test\") // Value persists\n\n// You can also specify the base in useStorage(base)\nawait useStorage(\"test\").set(\"foo\", { hello: \"world\" })\n\n// You can use generics to define types\nawait useStorage\u003C{ hello: string }>(\"test\").get(\"foo\")\nawait useStorage(\"test\").get\u003C{ hello: string }>(\"foo\")\n","ts",[256,275,276,299,306,313,344,363,368,374,396,419,439,444,450,477,482,488,523],{"__ignoreMap":5},[277,278,281,285,289,292,296],"span",{"class":279,"line":280},"line",1,[277,282,284],{"class":283},"so5gQ","import",[277,286,288],{"class":287},"slsVL"," { useStorage } ",[277,290,291],{"class":283},"from",[277,293,295],{"class":294},"sfrk1"," \"nitro/storage\"",[277,297,298],{"class":287},";\n",[277,300,302],{"class":279,"line":301},2,[277,303,305],{"emptyLinePlaceholder":304},true,"\n",[277,307,309],{"class":279,"line":308},3,[277,310,312],{"class":311},"sCsY4","// Default storage is in memory\n",[277,314,316,319,323,326,329,332,335,338,341],{"class":279,"line":315},4,[277,317,318],{"class":283},"await",[277,320,322],{"class":321},"shcOC"," useStorage",[277,324,325],{"class":287},"().",[277,327,328],{"class":321},"set",[277,330,331],{"class":287},"(",[277,333,334],{"class":294},"\"test:foo\"",[277,336,337],{"class":287},", { hello: ",[277,339,340],{"class":294},"\"world\"",[277,342,343],{"class":287}," })\n",[277,345,347,349,351,353,356,358,360],{"class":279,"line":346},5,[277,348,318],{"class":283},[277,350,322],{"class":321},[277,352,325],{"class":287},[277,354,355],{"class":321},"get",[277,357,331],{"class":287},[277,359,334],{"class":294},[277,361,362],{"class":287},")\n",[277,364,366],{"class":279,"line":365},6,[277,367,305],{"emptyLinePlaceholder":304},[277,369,371],{"class":279,"line":370},7,[277,372,373],{"class":311},"// You can use data storage to write data to default .data/kv directory\n",[277,375,377,380,384,387,389,391,394],{"class":279,"line":376},8,[277,378,379],{"class":283},"const",[277,381,383],{"class":382},"suiK_"," dataStorage",[277,385,386],{"class":283}," =",[277,388,322],{"class":321},[277,390,331],{"class":287},[277,392,393],{"class":294},"\"data\"",[277,395,362],{"class":287},[277,397,399,401,404,406,408,411,414,417],{"class":279,"line":398},9,[277,400,318],{"class":283},[277,402,403],{"class":287}," dataStorage.",[277,405,328],{"class":321},[277,407,331],{"class":287},[277,409,410],{"class":294},"\"test\"",[277,412,413],{"class":287},", ",[277,415,416],{"class":294},"\"works\"",[277,418,362],{"class":287},[277,420,422,424,426,428,430,433,436],{"class":279,"line":421},10,[277,423,318],{"class":283},[277,425,403],{"class":287},[277,427,355],{"class":321},[277,429,331],{"class":287},[277,431,432],{"class":294},"\"data:test\"",[277,434,435],{"class":287},") ",[277,437,438],{"class":311},"// Value persists\n",[277,440,442],{"class":279,"line":441},11,[277,443,305],{"emptyLinePlaceholder":304},[277,445,447],{"class":279,"line":446},12,[277,448,449],{"class":311},"// You can also specify the base in useStorage(base)\n",[277,451,453,455,457,459,461,464,466,468,471,473,475],{"class":279,"line":452},13,[277,454,318],{"class":283},[277,456,322],{"class":321},[277,458,331],{"class":287},[277,460,410],{"class":294},[277,462,463],{"class":287},").",[277,465,328],{"class":321},[277,467,331],{"class":287},[277,469,470],{"class":294},"\"foo\"",[277,472,337],{"class":287},[277,474,340],{"class":294},[277,476,343],{"class":287},[277,478,480],{"class":279,"line":479},14,[277,481,305],{"emptyLinePlaceholder":304},[277,483,485],{"class":279,"line":484},15,[277,486,487],{"class":311},"// You can use generics to define types\n",[277,489,491,493,495,498,502,505,508,511,513,515,517,519,521],{"class":279,"line":490},16,[277,492,318],{"class":283},[277,494,322],{"class":321},[277,496,497],{"class":287},"\u003C{ ",[277,499,501],{"class":500},"sQHwn","hello",[277,503,504],{"class":283},":",[277,506,507],{"class":382}," string",[277,509,510],{"class":287}," }>(",[277,512,410],{"class":294},[277,514,463],{"class":287},[277,516,355],{"class":321},[277,518,331],{"class":287},[277,520,470],{"class":294},[277,522,362],{"class":287},[277,524,526,528,530,532,534,536,538,540,542,544,546,548,550],{"class":279,"line":525},17,[277,527,318],{"class":283},[277,529,322],{"class":321},[277,531,331],{"class":287},[277,533,410],{"class":294},[277,535,463],{"class":287},[277,537,355],{"class":321},[277,539,497],{"class":287},[277,541,501],{"class":500},[277,543,504],{"class":283},[277,545,507],{"class":382},[277,547,510],{"class":287},[277,549,470],{"class":294},[277,551,362],{"class":287},[553,554],"read-more",{"to":242},[248,556,33],{"id":557},"configuration",[233,559,560,561,564],{},"You can mount one or multiple custom storage drivers using the ",[256,562,563],{},"storage"," option.",[233,566,567],{},"The key is the mount point name, and the value is the driver name and configuration.",[269,569,572],{"className":271,"code":570,"filename":571,"language":273,"meta":5,"style":5},"import { defineNitroConfig } from \"nitro/config\";\n\nexport default defineNitroConfig({\n  storage: {\n    redis: {\n      driver: \"redis\",\n      /* redis connector options */\n    }\n  }\n})\n","nitro.config.ts",[256,573,574,588,592,606,611,616,627,632,637,642],{"__ignoreMap":5},[277,575,576,578,581,583,586],{"class":279,"line":280},[277,577,284],{"class":283},[277,579,580],{"class":287}," { defineNitroConfig } ",[277,582,291],{"class":283},[277,584,585],{"class":294}," \"nitro/config\"",[277,587,298],{"class":287},[277,589,590],{"class":279,"line":301},[277,591,305],{"emptyLinePlaceholder":304},[277,593,594,597,600,603],{"class":279,"line":308},[277,595,596],{"class":283},"export",[277,598,599],{"class":283}," default",[277,601,602],{"class":321}," defineNitroConfig",[277,604,605],{"class":287},"({\n",[277,607,608],{"class":279,"line":315},[277,609,610],{"class":287},"  storage: {\n",[277,612,613],{"class":279,"line":346},[277,614,615],{"class":287},"    redis: {\n",[277,617,618,621,624],{"class":279,"line":365},[277,619,620],{"class":287},"      driver: ",[277,622,623],{"class":294},"\"redis\"",[277,625,626],{"class":287},",\n",[277,628,629],{"class":279,"line":370},[277,630,631],{"class":311},"      /* redis connector options */\n",[277,633,634],{"class":279,"line":376},[277,635,636],{"class":287},"    }\n",[277,638,639],{"class":279,"line":398},[277,640,641],{"class":287},"  }\n",[277,643,644],{"class":279,"line":421},[277,645,646],{"class":287},"})\n",[233,648,649,650,653],{},"Then, you can use the redis storage using the ",[256,651,652],{},"useStorage(\"redis\")"," function.",[553,655,657],{"to":656},"https://unstorage.unjs.io/",[233,658,659,660,664],{},"You can find the driver list on ",[240,661,663],{"href":656,"rel":662},[244],"unstorage documentation"," with their configuration.",[248,666,668],{"id":667},"runtime-configuration","Runtime configuration",[233,670,671,672,675],{},"In scenarios where the mount point configuration is not known until runtime, Nitro can dynamically add mount points during startup using ",[240,673,674],{"href":49},"plugins",".",[269,677,680],{"className":271,"code":678,"filename":679,"language":273,"meta":5,"style":5},"import { useStorage } from \"nitro/storage\";\nimport { definePlugin } from \"nitro\";\nimport redisDriver from \"unstorage/drivers/redis\";\n\nexport default definePlugin(() => {\n  const storage = useStorage()\n\n  // Dynamically pass in credentials from runtime configuration, or other sources\n  const driver = redisDriver({\n    base: \"redis\",\n    host: process.env.REDIS_HOST,\n    port: process.env.REDIS_PORT,\n    /* other redis connector options */\n  })\n\n  // Mount driver\n  storage.mount(\"redis\", driver)\n})\n","plugins/storage.ts",[256,681,682,694,708,722,726,744,759,763,768,782,791,801,811,816,821,825,830,845],{"__ignoreMap":5},[277,683,684,686,688,690,692],{"class":279,"line":280},[277,685,284],{"class":283},[277,687,288],{"class":287},[277,689,291],{"class":283},[277,691,295],{"class":294},[277,693,298],{"class":287},[277,695,696,698,701,703,706],{"class":279,"line":301},[277,697,284],{"class":283},[277,699,700],{"class":287}," { definePlugin } ",[277,702,291],{"class":283},[277,704,705],{"class":294}," \"nitro\"",[277,707,298],{"class":287},[277,709,710,712,715,717,720],{"class":279,"line":308},[277,711,284],{"class":283},[277,713,714],{"class":287}," redisDriver ",[277,716,291],{"class":283},[277,718,719],{"class":294}," \"unstorage/drivers/redis\"",[277,721,298],{"class":287},[277,723,724],{"class":279,"line":315},[277,725,305],{"emptyLinePlaceholder":304},[277,727,728,730,732,735,738,741],{"class":279,"line":346},[277,729,596],{"class":283},[277,731,599],{"class":283},[277,733,734],{"class":321}," definePlugin",[277,736,737],{"class":287},"(() ",[277,739,740],{"class":283},"=>",[277,742,743],{"class":287}," {\n",[277,745,746,749,752,754,756],{"class":279,"line":365},[277,747,748],{"class":283},"  const",[277,750,751],{"class":382}," storage",[277,753,386],{"class":283},[277,755,322],{"class":321},[277,757,758],{"class":287},"()\n",[277,760,761],{"class":279,"line":370},[277,762,305],{"emptyLinePlaceholder":304},[277,764,765],{"class":279,"line":376},[277,766,767],{"class":311},"  // Dynamically pass in credentials from runtime configuration, or other sources\n",[277,769,770,772,775,777,780],{"class":279,"line":398},[277,771,748],{"class":283},[277,773,774],{"class":382}," driver",[277,776,386],{"class":283},[277,778,779],{"class":321}," redisDriver",[277,781,605],{"class":287},[277,783,784,787,789],{"class":279,"line":421},[277,785,786],{"class":287},"    base: ",[277,788,623],{"class":294},[277,790,626],{"class":287},[277,792,793,796,799],{"class":279,"line":441},[277,794,795],{"class":287},"    host: process.env.",[277,797,798],{"class":382},"REDIS_HOST",[277,800,626],{"class":287},[277,802,803,806,809],{"class":279,"line":446},[277,804,805],{"class":287},"    port: process.env.",[277,807,808],{"class":382},"REDIS_PORT",[277,810,626],{"class":287},[277,812,813],{"class":279,"line":452},[277,814,815],{"class":311},"    /* other redis connector options */\n",[277,817,818],{"class":279,"line":479},[277,819,820],{"class":287},"  })\n",[277,822,823],{"class":279,"line":484},[277,824,305],{"emptyLinePlaceholder":304},[277,826,827],{"class":279,"line":490},[277,828,829],{"class":311},"  // Mount driver\n",[277,831,832,835,838,840,842],{"class":279,"line":525},[277,833,834],{"class":287},"  storage.",[277,836,837],{"class":321},"mount",[277,839,331],{"class":287},[277,841,623],{"class":294},[277,843,844],{"class":287},", driver)\n",[277,846,848],{"class":279,"line":847},18,[277,849,646],{"class":287},[230,851,852],{},[233,853,854,855,675],{},"This is a temporary workaround, with a better solution coming in the future! Keep a lookout on the GitHub issue ",[240,856,859],{"href":857,"rel":858},"https://github.com/nitrojs/nitro/issues/1161#issuecomment-1511444675",[244],"here",[861,862,863],"style",{},"html pre.shiki code .so5gQ, html code.shiki .so5gQ{--shiki-light:#D73A49;--shiki-default:#F97583;--shiki-dark:#F97583}html pre.shiki code .slsVL, html code.shiki .slsVL{--shiki-light:#24292E;--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}html pre.shiki code .sfrk1, html code.shiki .sfrk1{--shiki-light:#032F62;--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF}html pre.shiki code .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .shcOC, html code.shiki .shcOC{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0}html pre.shiki code .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}html pre.shiki code .sQHwn, html code.shiki .sQHwn{--shiki-light:#E36209;--shiki-default:#FFAB70;--shiki-dark:#FFAB70}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);}",{"title":5,"searchDepth":301,"depth":301,"links":865},[866,867,868],{"id":250,"depth":301,"text":251},{"id":557,"depth":301,"text":33},{"id":667,"depth":301,"text":668},"Nitro provides a built-in storage layer that can abstract filesystem or database or any other data source.","md",{"icon":71},{"icon":71},{"title":68,"description":869},"sVZTXrRh3gxOPAYGtQed3ThD2w6LMdGsJHdf6N_se6U",[876,878],{"title":63,"path":64,"stem":65,"description":877,"icon":66,"children":-1},"Nitro provides a caching system built on top of the storage layer.",{"title":73,"path":74,"stem":75,"description":5,"icon":76,"children":-1},1773050251047]