[{"data":1,"prerenderedAt":1411},["ShallowReactive",2],{"navigation":3,"\u002Fguide\u002Fsocket":208,"\u002Fguide\u002Fsocket-surround":1406},[4,98,175],{"title":5,"path":6,"stem":7,"children":8,"icon":97},"Guide","\u002Fguide","1.guide\u002F1.index",[9,12,17,22,46,61,79],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-house",{"title":13,"path":14,"stem":15,"icon":16},"Installation","\u002Fguide\u002Finstallation","1.guide\u002F2.installation","i-lucide-download",{"title":18,"path":19,"stem":20,"icon":21},"Quick start","\u002Fguide\u002Fquick-start","1.guide\u002F3.quick-start","i-lucide-rocket",{"title":23,"path":24,"stem":25,"children":26,"icon":45},"Server","\u002Fguide\u002Fserver","1.guide\u002F4.server\u002F1.index",[27,30,35,40],{"title":28,"path":24,"stem":25,"icon":29},"Usage","i-lucide-server",{"title":31,"path":32,"stem":33,"icon":34},"Config file","\u002Fguide\u002Fserver\u002Fconfig-file","1.guide\u002F4.server\u002F2.config-file","i-lucide-file-cog",{"title":36,"path":37,"stem":38,"icon":39},"Options","\u002Fguide\u002Fserver\u002Foptions","1.guide\u002F4.server\u002F3.options","i-lucide-settings",{"title":41,"path":42,"stem":43,"icon":44},"Advanced","\u002Fguide\u002Fserver\u002Fadvanced","1.guide\u002F4.server\u002F4.advanced","i-lucide-flask-conical",false,{"title":47,"path":48,"stem":49,"children":50,"icon":45},"Client","\u002Fguide\u002Fclient","1.guide\u002F5.client\u002F1.index",[51,53,58],{"title":28,"path":48,"stem":49,"icon":52},"i-lucide-monitor-smartphone",{"title":54,"path":55,"stem":56,"icon":57},"Live queries","\u002Fguide\u002Fclient\u002Flive-queries","1.guide\u002F5.client\u002F2.live-queries","i-lucide-radio",{"title":41,"path":59,"stem":60,"icon":44},"\u002Fguide\u002Fclient\u002Fadvanced","1.guide\u002F5.client\u002F3.advanced",{"title":62,"path":63,"stem":64,"children":65,"icon":45},"Development socket","\u002Fguide\u002Fsocket","1.guide\u002F6.socket\u002F1.index",[66,68,71,74],{"title":28,"path":63,"stem":64,"icon":67},"i-lucide-plug",{"title":36,"path":69,"stem":70,"icon":39},"\u002Fguide\u002Fsocket\u002Foptions","1.guide\u002F6.socket\u002F2.options",{"title":41,"path":72,"stem":73,"icon":44},"\u002Fguide\u002Fsocket\u002Fadvanced","1.guide\u002F6.socket\u002F3.advanced",{"title":75,"path":76,"stem":77,"icon":78},"PGlite in dev, Postgres in prod","\u002Fguide\u002Fsocket\u002Fdevelopment-only","1.guide\u002F6.socket\u002F4.development-only","i-lucide-cloud-upload",{"title":80,"path":81,"stem":82,"children":83,"icon":45},"DevTools & tooling","\u002Fguide\u002Fdevtools","1.guide\u002F7.devtools\u002F1.index",[84,87,92],{"title":85,"path":81,"stem":82,"icon":86},"DevTools tab","i-lucide-wrench",{"title":88,"path":89,"stem":90,"icon":91},"Actions","\u002Fguide\u002Fdevtools\u002Factions","1.guide\u002F7.devtools\u002F2.actions","i-lucide-zap",{"title":93,"path":94,"stem":95,"icon":96},"Terminal","\u002Fguide\u002Fdevtools\u002Fterminal","1.guide\u002F7.devtools\u002F3.terminal","i-lucide-square-terminal","i-lucide-book-open",{"title":99,"icon":100,"path":101,"stem":102,"children":103,"page":45},"Recipes","i-lucide-chef-hat","\u002Frecipes","2.recipes",[104,116,138,159,171],{"title":105,"path":106,"stem":107,"children":108,"icon":45},"Migrations","\u002Frecipes\u002Fmigrations","2.recipes\u002F1.migrations\u002F1.index",[109,111],{"title":28,"path":106,"stem":107,"icon":110},"i-lucide-database-backup",{"title":112,"path":113,"stem":114,"icon":115},"Edited migrations","\u002Frecipes\u002Fmigrations\u002Fedited-migrations","2.recipes\u002F1.migrations\u002F2.edited-migrations","i-lucide-file-diff",{"title":117,"path":118,"stem":119,"children":120,"icon":45},"Testing","\u002Frecipes\u002Ftesting","2.recipes\u002F2.testing\u002F1.index",[121,123,128,133],{"title":28,"path":118,"stem":119,"icon":122},"i-lucide-test-tube",{"title":124,"path":125,"stem":126,"icon":127},"Isolation","\u002Frecipes\u002Ftesting\u002Fisolation","2.recipes\u002F2.testing\u002F2.isolation","i-lucide-git-fork",{"title":129,"path":130,"stem":131,"icon":132},"vitest","\u002Frecipes\u002Ftesting\u002Fvitest","2.recipes\u002F2.testing\u002F3.vitest","i-simple-icons-vitest",{"title":134,"path":135,"stem":136,"icon":137},"@nuxt\u002Ftest-utils","\u002Frecipes\u002Ftesting\u002Fnuxt-test-utils","2.recipes\u002F2.testing\u002F4.nuxt-test-utils","i-simple-icons-nuxt",{"title":139,"path":140,"stem":141,"children":142,"icon":45},"Deploy","\u002Frecipes\u002Fdeploy","2.recipes\u002F3.deploy\u002F1.index",[143,144,149,154],{"title":139,"path":140,"stem":141},{"title":145,"path":146,"stem":147,"icon":148},"Any Postgres","\u002Frecipes\u002Fdeploy\u002Fpostgres","2.recipes\u002F3.deploy\u002F2.postgres","i-lucide-database",{"title":150,"path":151,"stem":152,"icon":153},"Netlify","\u002Frecipes\u002Fdeploy\u002Fnetlify","2.recipes\u002F3.deploy\u002F3.netlify","i-simple-icons-netlify",{"title":155,"path":156,"stem":157,"icon":158},"Neon","\u002Frecipes\u002Fdeploy\u002Fneon","2.recipes\u002F3.deploy\u002F4.neon","i-simple-icons-neon",{"title":160,"path":161,"stem":162,"children":163,"icon":45},"Outside Nuxt","\u002Frecipes\u002Foutside-nuxt","2.recipes\u002F4.outside-nuxt\u002F1.index",[164,167],{"title":165,"path":161,"stem":162,"icon":166},"Config and provider","i-lucide-package",{"title":168,"path":169,"stem":170,"icon":67},"Socket server","\u002Frecipes\u002Foutside-nuxt\u002Fsocket","2.recipes\u002F4.outside-nuxt\u002F2.socket",{"title":172,"path":173,"stem":174,"icon":67},"Nitro's useDatabase","\u002Frecipes\u002Fnitro-database","2.recipes\u002F5.nitro-database",{"title":176,"icon":177,"path":178,"stem":179,"children":180,"page":45},"Reference","i-lucide-code-xml","\u002Freference","3.reference",[181,185,189,193,198,203],{"title":182,"path":183,"stem":184,"icon":34},"Config files","\u002Freference\u002Fconfig-files","3.reference\u002F1.config-files",{"title":186,"path":187,"stem":188,"icon":39},"Module options","\u002Freference\u002Fmodule-options","3.reference\u002F2.module-options",{"title":190,"path":191,"stem":192,"icon":67},"Socket options","\u002Freference\u002Fsocket-options","3.reference\u002F3.socket-options",{"title":194,"path":195,"stem":196,"icon":197},"Exports","\u002Freference\u002Fexports","3.reference\u002F4.exports","i-lucide-boxes",{"title":199,"path":200,"stem":201,"icon":202},"Hooks","\u002Freference\u002Fhooks","3.reference\u002F5.hooks","i-lucide-anchor",{"title":204,"path":205,"stem":206,"icon":207},"Environment","\u002Freference\u002Fenvironment","3.reference\u002F6.environment","i-lucide-variable",{"id":209,"title":62,"body":210,"description":1399,"extension":1400,"links":1401,"meta":1402,"navigation":1403,"path":63,"seo":1404,"stem":64,"__hash__":1405},"docs\u002F1.guide\u002F6.socket\u002F1.index.md",{"type":211,"value":212,"toc":1388},"minimark",[213,226,315,347,373,378,381,423,427,440,678,683,694,760,816,825,829,836,852,856,859,1166,1170,1173,1312,1354,1364,1368,1379,1384],[214,215,216,217,221,222,225],"p",{},"While ",[218,219,220],"code",{},"nuxt dev"," runs, the module can serve the PGlite of your server config over TCP. Drivers, ORMs, migration tools and ",[218,223,224],{},"psql"," connect to it as they would to any Postgres server, so your code needs no PGlite-specific branch.",[227,228,234],"pre",{"className":229,"code":230,"filename":231,"language":232,"meta":233,"style":233},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","export default defineNuxtConfig({\n  pglite: {\n    socket: { port: 5433 }, \u002F\u002F or `true` for a free port\n  },\n})\n","nuxt.config.ts","ts","",[218,235,236,260,273,300,306],{"__ignoreMap":233},[237,238,241,245,248,252,256],"span",{"class":239,"line":240},"line",1,[237,242,244],{"class":243},"s7zQu","export",[237,246,247],{"class":243}," default",[237,249,251],{"class":250},"s2Zo4"," defineNuxtConfig",[237,253,255],{"class":254},"sTEyZ","(",[237,257,259],{"class":258},"sMK4o","{\n",[237,261,263,267,270],{"class":239,"line":262},2,[237,264,266],{"class":265},"swJcz","  pglite",[237,268,269],{"class":258},":",[237,271,272],{"class":258}," {\n",[237,274,276,279,281,284,287,289,293,296],{"class":239,"line":275},3,[237,277,278],{"class":265},"    socket",[237,280,269],{"class":258},[237,282,283],{"class":258}," {",[237,285,286],{"class":265}," port",[237,288,269],{"class":258},[237,290,292],{"class":291},"sbssI"," 5433",[237,294,295],{"class":258}," },",[237,297,299],{"class":298},"sHwdD"," \u002F\u002F or `true` for a free port\n",[237,301,303],{"class":239,"line":302},4,[237,304,305],{"class":258},"  },\n",[237,307,309,312],{"class":239,"line":308},5,[237,310,311],{"class":258},"}",[237,313,314],{"class":254},")\n",[227,316,320],{"className":317,"code":318,"filename":93,"language":319,"meta":233,"style":233},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","✔ PGlite socket listening at postgres:\u002F\u002Fpostgres@127.0.0.1:5433\u002Fpostgres (DATABASE_URL)\n","bash",[218,321,322],{"__ignoreMap":233},[237,323,324,328,332,335,338,341,344],{"class":239,"line":240},[237,325,327],{"class":326},"sBMFI","✔",[237,329,331],{"class":330},"sfazB"," PGlite",[237,333,334],{"class":330}," socket",[237,336,337],{"class":330}," listening",[237,339,340],{"class":330}," at",[237,342,343],{"class":330}," postgres:\u002F\u002Fpostgres@127.0.0.1:5433\u002Fpostgres",[237,345,346],{"class":254}," (DATABASE_URL)\n",[214,348,349,352,353,356,357,360,361,363,364,368,369,372],{},[218,350,351],{},"pglite.socket"," is an option of its own, next to ",[218,354,355],{},"server"," and ",[218,358,359],{},"client",", and only runs in ",[218,362,220],{},". It is created in the Nuxt process from your ",[365,366,367],"a",{"href":32},"server config",", whether or not ",[218,370,371],{},"server.enabled"," is, so it survives server reloads; a change to the config file restarts Nuxt.",[374,375,377],"h2",{"id":376},"finding-the-url","Finding the URL",[214,379,380],{},"The URL is available in three ways:",[382,383,384,401,413],"ul",{},[385,386,387,393,394,356,397,400],"li",{},[388,389,390],"strong",{},[218,391,392],{},"DATABASE_URL",": set to the socket's URL when it is still unset, so a real database configured in your environment always wins. ",[218,395,396],{},"socket.env",[218,398,399],{},"socket.provider"," change what is exported, see below.",[385,402,403,408,409,412],{},[388,404,405],{},[218,406,407],{},"useRuntimeConfig().pglite.url",": on the server, for code that should not read ",[218,410,411],{},"process.env",".",[385,414,415,418,419,422],{},[388,416,417],{},"The terminal",": the URL is printed when the socket starts, with the variables it exported. Pin ",[218,420,421],{},"port"," so that tools outside Nuxt can rely on it.",[374,424,426],{"id":425},"environment-variables","Environment variables",[214,428,429,431,432,435,436,439],{},[218,430,396],{}," decides what the socket exports: a name for the URL (",[218,433,434],{},"'DATABASE_URL'",", the default), ",[218,437,438],{},"false"," for nothing, or a map whose values are functions of the URL or strings exported as is.",[441,442,443,515],"code-group",{},[227,444,447],{"className":229,"code":445,"filename":446,"language":232,"meta":233,"style":233},"export default defineNuxtConfig({\n  pglite: {\n    socket: { port: 5433, env: 'PGLITE_URL' }, \u002F\u002F `env: false` exports nothing\n  },\n})\n","Name",[218,448,449,461,469,505,509],{"__ignoreMap":233},[237,450,451,453,455,457,459],{"class":239,"line":240},[237,452,244],{"class":243},[237,454,247],{"class":243},[237,456,251],{"class":250},[237,458,255],{"class":254},[237,460,259],{"class":258},[237,462,463,465,467],{"class":239,"line":262},[237,464,266],{"class":265},[237,466,269],{"class":258},[237,468,272],{"class":258},[237,470,471,473,475,477,479,481,483,486,489,491,494,497,500,502],{"class":239,"line":275},[237,472,278],{"class":265},[237,474,269],{"class":258},[237,476,283],{"class":258},[237,478,286],{"class":265},[237,480,269],{"class":258},[237,482,292],{"class":291},[237,484,485],{"class":258},",",[237,487,488],{"class":265}," env",[237,490,269],{"class":258},[237,492,493],{"class":258}," '",[237,495,496],{"class":330},"PGLITE_URL",[237,498,499],{"class":258},"'",[237,501,295],{"class":258},[237,503,504],{"class":298}," \u002F\u002F `env: false` exports nothing\n",[237,506,507],{"class":239,"line":302},[237,508,305],{"class":258},[237,510,511,513],{"class":239,"line":308},[237,512,311],{"class":258},[237,514,314],{"class":254},[227,516,519],{"className":229,"code":517,"filename":518,"language":232,"meta":233,"style":233},"export default defineNuxtConfig({\n  pglite: {\n    socket: {\n      port: 5433,\n      env: {\n        DATABASE_URL: (url: string) => url,\n        DATABASE_POOL_URL: (url: string) => `${url}?pool=true`,\n        DB_DRIVER: 'pg',\n      },\n    },\n  },\n})\n","Map",[218,520,521,533,541,549,561,570,602,637,654,660,666,671],{"__ignoreMap":233},[237,522,523,525,527,529,531],{"class":239,"line":240},[237,524,244],{"class":243},[237,526,247],{"class":243},[237,528,251],{"class":250},[237,530,255],{"class":254},[237,532,259],{"class":258},[237,534,535,537,539],{"class":239,"line":262},[237,536,266],{"class":265},[237,538,269],{"class":258},[237,540,272],{"class":258},[237,542,543,545,547],{"class":239,"line":275},[237,544,278],{"class":265},[237,546,269],{"class":258},[237,548,272],{"class":258},[237,550,551,554,556,558],{"class":239,"line":302},[237,552,553],{"class":265},"      port",[237,555,269],{"class":258},[237,557,292],{"class":291},[237,559,560],{"class":258},",\n",[237,562,563,566,568],{"class":239,"line":308},[237,564,565],{"class":265},"      env",[237,567,269],{"class":258},[237,569,272],{"class":258},[237,571,573,576,578,581,585,587,590,593,597,600],{"class":239,"line":572},6,[237,574,575],{"class":250},"        DATABASE_URL",[237,577,269],{"class":258},[237,579,580],{"class":258}," (",[237,582,584],{"class":583},"sHdIc","url",[237,586,269],{"class":258},[237,588,589],{"class":326}," string",[237,591,592],{"class":258},")",[237,594,596],{"class":595},"spNyl"," =>",[237,598,599],{"class":254}," url",[237,601,560],{"class":258},[237,603,605,608,610,612,614,616,618,620,622,625,627,629,632,635],{"class":239,"line":604},7,[237,606,607],{"class":250},"        DATABASE_POOL_URL",[237,609,269],{"class":258},[237,611,580],{"class":258},[237,613,584],{"class":583},[237,615,269],{"class":258},[237,617,589],{"class":326},[237,619,592],{"class":258},[237,621,596],{"class":595},[237,623,624],{"class":258}," `${",[237,626,584],{"class":254},[237,628,311],{"class":258},[237,630,631],{"class":330},"?pool=true",[237,633,634],{"class":258},"`",[237,636,560],{"class":258},[237,638,640,643,645,647,650,652],{"class":239,"line":639},8,[237,641,642],{"class":265},"        DB_DRIVER",[237,644,269],{"class":258},[237,646,493],{"class":258},[237,648,649],{"class":330},"pg",[237,651,499],{"class":258},[237,653,560],{"class":258},[237,655,657],{"class":239,"line":656},9,[237,658,659],{"class":258},"      },\n",[237,661,663],{"class":239,"line":662},10,[237,664,665],{"class":258},"    },\n",[237,667,669],{"class":239,"line":668},11,[237,670,305],{"class":258},[237,672,674,676],{"class":239,"line":673},12,[237,675,311],{"class":258},[237,677,314],{"class":254},[679,680,682],"h3",{"id":681},"provider-presets","Provider presets",[214,684,685,687,688,690,691,693],{},[218,686,392],{}," covers most hosts and tools. Some platforms provision the database themselves and set variables of their own, and code written for them reads those. Presets exist for those platforms: ",[218,689,399],{}," exports the platform's variables in place of ",[218,692,392],{},", so that code reaches the socket unchanged.",[227,695,697],{"className":229,"code":696,"filename":231,"language":232,"meta":233,"style":233},"export default defineNuxtConfig({\n  pglite: {\n    socket: { port: 5433, provider: 'netlify' },\n  },\n})\n",[218,698,699,711,719,750,754],{"__ignoreMap":233},[237,700,701,703,705,707,709],{"class":239,"line":240},[237,702,244],{"class":243},[237,704,247],{"class":243},[237,706,251],{"class":250},[237,708,255],{"class":254},[237,710,259],{"class":258},[237,712,713,715,717],{"class":239,"line":262},[237,714,266],{"class":265},[237,716,269],{"class":258},[237,718,272],{"class":258},[237,720,721,723,725,727,729,731,733,735,738,740,742,745,747],{"class":239,"line":275},[237,722,278],{"class":265},[237,724,269],{"class":258},[237,726,283],{"class":258},[237,728,286],{"class":265},[237,730,269],{"class":258},[237,732,292],{"class":291},[237,734,485],{"class":258},[237,736,737],{"class":265}," provider",[237,739,269],{"class":258},[237,741,493],{"class":258},[237,743,744],{"class":330},"netlify",[237,746,499],{"class":258},[237,748,749],{"class":258}," },\n",[237,751,752],{"class":239,"line":302},[237,753,305],{"class":258},[237,755,756,758],{"class":239,"line":308},[237,757,311],{"class":258},[237,759,314],{"class":254},[761,762,763,777],"table",{},[764,765,766],"thead",{},[767,768,769,773,775],"tr",{},[770,771,772],"th",{},"Provider",[770,774,194],{},[770,776],{},[778,779,780],"tbody",{},[767,781,782,787,796],{},[783,784,785],"td",{},[218,786,744],{},[783,788,789,792,793],{},[218,790,791],{},"NETLIFY_DB_URL",", ",[218,794,795],{},"NETLIFY_DB_DRIVER=server",[783,797,798,799,802,803,356,806,809,810,812,813,815],{},"The URL ",[365,800,801],{"href":151},"Netlify Database"," sets, and the driver switch that makes ",[218,804,805],{},"@netlify\u002Fdatabase",[218,807,808],{},"drizzle-orm\u002Fnetlify-db"," use ",[218,811,649],{}," over the wire protocol rather than Neon's serverless driver, which the socket cannot answer. No ",[218,814,392],{},", which Netlify does not set either.",[214,817,818,820,821,824],{},[218,819,744],{}," is the first preset. ",[218,822,823],{},"env"," is merged over it, to add a variable or replace one of its values.",[679,826,828],{"id":827},"when-a-variable-is-taken","When a variable is taken",[214,830,831,832,835],{},"Each variable is set only while still unset, so a real database configured in your environment always wins. Once the dev server is up, a warning names each variable that does not hold the socket's value: one set before the module ran (a ",[218,833,834],{},".env"," file, your shell), or overwritten after it, for example by another module's own database emulation. Disable the other emulation, or unset the variable, to reach PGlite.",[214,837,838,839,841,842,849,850,412],{},"The variables exported are listed when the socket starts, in the ",[365,840,85],{"href":81},", and passed to ",[365,843,845,848],{"href":844},"\u002Fguide\u002Fdevtools\u002Factions#socket-actions",[218,846,847],{},"socket"," actions"," as ",[218,851,823],{},[374,853,855],{"id":854},"connecting","Connecting",[214,857,858],{},"The socket speaks the Postgres protocol, so use the driver you would use in production.",[441,860,861,977,1081],{},[227,862,865],{"className":229,"code":863,"filename":864,"language":232,"meta":233,"style":233},"\u002F\u002F server\u002Futils\u002Fdb.ts\nimport { drizzle } from 'drizzle-orm\u002Fnode-postgres'\n\nimport { relations } from '..\u002Fdatabase\u002Frelations'\n\nexport function useDB() {\n  return drizzle(process.env.DATABASE_URL!, { relations })\n}\n","Drizzle",[218,866,867,872,896,902,922,926,941,972],{"__ignoreMap":233},[237,868,869],{"class":239,"line":240},[237,870,871],{"class":298},"\u002F\u002F server\u002Futils\u002Fdb.ts\n",[237,873,874,877,879,882,885,888,890,893],{"class":239,"line":262},[237,875,876],{"class":243},"import",[237,878,283],{"class":258},[237,880,881],{"class":254}," drizzle",[237,883,884],{"class":258}," }",[237,886,887],{"class":243}," from",[237,889,493],{"class":258},[237,891,892],{"class":330},"drizzle-orm\u002Fnode-postgres",[237,894,895],{"class":258},"'\n",[237,897,898],{"class":239,"line":275},[237,899,901],{"emptyLinePlaceholder":900},true,"\n",[237,903,904,906,908,911,913,915,917,920],{"class":239,"line":302},[237,905,876],{"class":243},[237,907,283],{"class":258},[237,909,910],{"class":254}," relations",[237,912,884],{"class":258},[237,914,887],{"class":243},[237,916,493],{"class":258},[237,918,919],{"class":330},"..\u002Fdatabase\u002Frelations",[237,921,895],{"class":258},[237,923,924],{"class":239,"line":308},[237,925,901],{"emptyLinePlaceholder":900},[237,927,928,930,933,936,939],{"class":239,"line":572},[237,929,244],{"class":243},[237,931,932],{"class":595}," function",[237,934,935],{"class":250}," useDB",[237,937,938],{"class":258},"()",[237,940,272],{"class":258},[237,942,943,946,948,950,953,955,957,959,961,964,966,968,970],{"class":239,"line":604},[237,944,945],{"class":243},"  return",[237,947,881],{"class":250},[237,949,255],{"class":265},[237,951,952],{"class":254},"process",[237,954,412],{"class":258},[237,956,823],{"class":254},[237,958,412],{"class":258},[237,960,392],{"class":254},[237,962,963],{"class":258},"!,",[237,965,283],{"class":258},[237,967,910],{"class":254},[237,969,884],{"class":258},[237,971,314],{"class":265},[237,973,974],{"class":239,"line":639},[237,975,976],{"class":258},"}\n",[227,978,980],{"className":229,"code":979,"filename":649,"language":232,"meta":233,"style":233},"\u002F\u002F server\u002Futils\u002Fdb.ts\nimport pg from 'pg'\n\nconst pool = new pg.Pool({ connectionString: process.env.DATABASE_URL })\n\nexport function useDB() {\n  return pool\n}\n",[218,981,982,986,1002,1006,1054,1058,1070,1077],{"__ignoreMap":233},[237,983,984],{"class":239,"line":240},[237,985,871],{"class":298},[237,987,988,990,993,996,998,1000],{"class":239,"line":262},[237,989,876],{"class":243},[237,991,992],{"class":254}," pg ",[237,994,995],{"class":243},"from",[237,997,493],{"class":258},[237,999,649],{"class":330},[237,1001,895],{"class":258},[237,1003,1004],{"class":239,"line":275},[237,1005,901],{"emptyLinePlaceholder":900},[237,1007,1008,1011,1014,1017,1020,1023,1025,1028,1030,1033,1036,1038,1041,1043,1045,1047,1050,1052],{"class":239,"line":302},[237,1009,1010],{"class":595},"const",[237,1012,1013],{"class":254}," pool ",[237,1015,1016],{"class":258},"=",[237,1018,1019],{"class":258}," new",[237,1021,1022],{"class":254}," pg",[237,1024,412],{"class":258},[237,1026,1027],{"class":250},"Pool",[237,1029,255],{"class":254},[237,1031,1032],{"class":258},"{",[237,1034,1035],{"class":265}," connectionString",[237,1037,269],{"class":258},[237,1039,1040],{"class":254}," process",[237,1042,412],{"class":258},[237,1044,823],{"class":254},[237,1046,412],{"class":258},[237,1048,1049],{"class":254},"DATABASE_URL ",[237,1051,311],{"class":258},[237,1053,314],{"class":254},[237,1055,1056],{"class":239,"line":308},[237,1057,901],{"emptyLinePlaceholder":900},[237,1059,1060,1062,1064,1066,1068],{"class":239,"line":572},[237,1061,244],{"class":243},[237,1063,932],{"class":595},[237,1065,935],{"class":250},[237,1067,938],{"class":258},[237,1069,272],{"class":258},[237,1071,1072,1074],{"class":239,"line":604},[237,1073,945],{"class":243},[237,1075,1076],{"class":254}," pool\n",[237,1078,1079],{"class":239,"line":639},[237,1080,976],{"class":258},[227,1082,1085],{"className":229,"code":1083,"filename":1084,"language":232,"meta":233,"style":233},"\u002F\u002F server\u002Futils\u002Fdb.ts\nimport postgres from 'postgres'\n\nconst sql = postgres(process.env.DATABASE_URL!)\n\nexport function useDB() {\n  return sql\n}\n","postgres.js",[218,1086,1087,1091,1107,1111,1139,1143,1155,1162],{"__ignoreMap":233},[237,1088,1089],{"class":239,"line":240},[237,1090,871],{"class":298},[237,1092,1093,1095,1098,1100,1102,1105],{"class":239,"line":262},[237,1094,876],{"class":243},[237,1096,1097],{"class":254}," postgres ",[237,1099,995],{"class":243},[237,1101,493],{"class":258},[237,1103,1104],{"class":330},"postgres",[237,1106,895],{"class":258},[237,1108,1109],{"class":239,"line":275},[237,1110,901],{"emptyLinePlaceholder":900},[237,1112,1113,1115,1118,1120,1123,1126,1128,1130,1132,1134,1137],{"class":239,"line":302},[237,1114,1010],{"class":595},[237,1116,1117],{"class":254}," sql ",[237,1119,1016],{"class":258},[237,1121,1122],{"class":250}," postgres",[237,1124,1125],{"class":254},"(process",[237,1127,412],{"class":258},[237,1129,823],{"class":254},[237,1131,412],{"class":258},[237,1133,392],{"class":254},[237,1135,1136],{"class":258},"!",[237,1138,314],{"class":254},[237,1140,1141],{"class":239,"line":308},[237,1142,901],{"emptyLinePlaceholder":900},[237,1144,1145,1147,1149,1151,1153],{"class":239,"line":572},[237,1146,244],{"class":243},[237,1148,932],{"class":595},[237,1150,935],{"class":250},[237,1152,938],{"class":258},[237,1154,272],{"class":258},[237,1156,1157,1159],{"class":239,"line":604},[237,1158,945],{"class":243},[237,1160,1161],{"class":254}," sql\n",[237,1163,1164],{"class":239,"line":639},[237,1165,976],{"class":258},[679,1167,1169],{"id":1168},"tools-outside-the-app","Tools outside the app",[214,1171,1172],{},"Tools that run in their own process reach the same database through the pinned port:",[441,1174,1175,1300],{},[227,1176,1179],{"className":229,"code":1177,"filename":1178,"language":232,"meta":233,"style":233},"import { defineConfig } from 'drizzle-kit'\n\nexport default defineConfig({\n  schema: '.\u002Fserver\u002Fdatabase\u002Fschema.ts',\n  out: '.\u002Fserver\u002Fdatabase\u002Fmigrations',\n  dialect: 'postgresql',\n  dbCredentials: {\n    url: 'postgres:\u002F\u002Fpostgres@127.0.0.1:5433\u002Fpostgres',\n  },\n})\n","drizzle.config.ts",[218,1180,1181,1201,1205,1217,1233,1249,1265,1274,1290,1294],{"__ignoreMap":233},[237,1182,1183,1185,1187,1190,1192,1194,1196,1199],{"class":239,"line":240},[237,1184,876],{"class":243},[237,1186,283],{"class":258},[237,1188,1189],{"class":254}," defineConfig",[237,1191,884],{"class":258},[237,1193,887],{"class":243},[237,1195,493],{"class":258},[237,1197,1198],{"class":330},"drizzle-kit",[237,1200,895],{"class":258},[237,1202,1203],{"class":239,"line":262},[237,1204,901],{"emptyLinePlaceholder":900},[237,1206,1207,1209,1211,1213,1215],{"class":239,"line":275},[237,1208,244],{"class":243},[237,1210,247],{"class":243},[237,1212,1189],{"class":250},[237,1214,255],{"class":254},[237,1216,259],{"class":258},[237,1218,1219,1222,1224,1226,1229,1231],{"class":239,"line":302},[237,1220,1221],{"class":265},"  schema",[237,1223,269],{"class":258},[237,1225,493],{"class":258},[237,1227,1228],{"class":330},".\u002Fserver\u002Fdatabase\u002Fschema.ts",[237,1230,499],{"class":258},[237,1232,560],{"class":258},[237,1234,1235,1238,1240,1242,1245,1247],{"class":239,"line":308},[237,1236,1237],{"class":265},"  out",[237,1239,269],{"class":258},[237,1241,493],{"class":258},[237,1243,1244],{"class":330},".\u002Fserver\u002Fdatabase\u002Fmigrations",[237,1246,499],{"class":258},[237,1248,560],{"class":258},[237,1250,1251,1254,1256,1258,1261,1263],{"class":239,"line":572},[237,1252,1253],{"class":265},"  dialect",[237,1255,269],{"class":258},[237,1257,493],{"class":258},[237,1259,1260],{"class":330},"postgresql",[237,1262,499],{"class":258},[237,1264,560],{"class":258},[237,1266,1267,1270,1272],{"class":239,"line":604},[237,1268,1269],{"class":265},"  dbCredentials",[237,1271,269],{"class":258},[237,1273,272],{"class":258},[237,1275,1276,1279,1281,1283,1286,1288],{"class":239,"line":639},[237,1277,1278],{"class":265},"    url",[237,1280,269],{"class":258},[237,1282,493],{"class":258},[237,1284,1285],{"class":330},"postgres:\u002F\u002Fpostgres@127.0.0.1:5433\u002Fpostgres",[237,1287,499],{"class":258},[237,1289,560],{"class":258},[237,1291,1292],{"class":239,"line":656},[237,1293,305],{"class":258},[237,1295,1296,1298],{"class":239,"line":662},[237,1297,311],{"class":258},[237,1299,314],{"class":254},[227,1301,1303],{"className":317,"code":1302,"filename":224,"language":319,"meta":233,"style":233},"psql postgres:\u002F\u002Fpostgres@127.0.0.1:5433\u002Fpostgres\n",[218,1304,1305],{"__ignoreMap":233},[237,1306,1307,1309],{"class":239,"line":240},[237,1308,224],{"class":326},[237,1310,1311],{"class":330}," postgres:\u002F\u002Fpostgres@127.0.0.1:5433\u002Fpostgres\n",[214,1313,1314,1315,1317,1318,792,1321,792,1324,1327,1328,1330,1331,1334,1335,1337,1338,1343,1344,1346,1347,1353],{},"With ",[218,1316,220],{}," running, ",[218,1319,1320],{},"drizzle-kit studio",[218,1322,1323],{},"drizzle-kit check",[218,1325,1326],{},"drizzle-kit push"," or ",[218,1329,224],{}," work against PGlite. When your schema lives in migration files, let ",[218,1332,1333],{},"init"," apply them rather than pushing: see ",[365,1336,105],{"href":106},". To launch a tool from Nuxt DevTools with the variables filled in, use a ",[365,1339,1340,1342],{"href":844},[218,1341,847],{}," action",". A test suite, which runs without ",[218,1345,220],{},", gets a socket of its own from ",[365,1348,1350],{"href":1349},"\u002Frecipes\u002Ftesting#through-the-socket",[218,1351,1352],{},"nuxt-pglite\u002Ftesting",", in front of a database built from the same config, with the same variables.",[1355,1356,1357],"note",{},[214,1358,1359,1360,1363],{},"Connections are not authenticated: any user name and password are accepted, and every database name reaches the same database. The socket listens on ",[218,1361,1362],{},"127.0.0.1"," by default.",[374,1365,1367],{"id":1366},"server-instance-and-socket-together","Server instance and socket together",[214,1369,1370,1371,1374,1375,1378],{},"The socket's instance holds the configured data directory, and PGlite allows one instance per directory. With both the server side and the socket enabled, connect to the socket from your routes too (that is what the snippets above do), rather than calling ",[218,1372,1373],{},"usePGlite()",", which refuses the directory the socket serves. See ",[365,1376,41],{"href":1377},"\u002Fguide\u002Fserver\u002Fadvanced#when-the-socket-is-running"," for the alternative.",[214,1380,1381,1382,412],{},"If PGlite is only your development database, disable the server side altogether: see ",[365,1383,75],{"href":76},[1385,1386,1387],"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 .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}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 .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 .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}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}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}",{"title":233,"searchDepth":240,"depth":262,"links":1389},[1390,1391,1395,1398],{"id":376,"depth":262,"text":377},{"id":425,"depth":262,"text":426,"children":1392},[1393,1394],{"id":681,"depth":275,"text":682},{"id":827,"depth":275,"text":828},{"id":854,"depth":262,"text":855,"children":1396},[1397],{"id":1168,"depth":275,"text":1169},{"id":1366,"depth":262,"text":1367},"Serve the development database over the Postgres wire protocol, and connect anything that speaks Postgres to it.","md",null,{},{"title":28,"icon":67},{"title":62,"description":1399},"d9J3Lud6beOHIkcbI1It8qm_efPgGbB2sTj05z8tQJE",[1407,1409],{"title":41,"path":59,"stem":60,"description":1408,"icon":44,"children":-1},"Explicit imports, data directories, the worker and the Vite requirement.",{"title":36,"path":69,"stem":70,"description":1410,"icon":39,"children":-1},"Where the socket listens, how it publishes its URL and how it treats clients.",1791474259253]