Postgres in your Nuxt app, no server to run.

Nuxt PGlite wires PGlite, Postgres compiled to WebAssembly, into Nuxt: an instance for your server routes, the same database over a Postgres URL while nuxt dev runs, and an in-browser database with live queries.

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['nuxt-pglite'],
  pglite: {
    socket: { port: 5433 }, // a Postgres URL while `nuxt dev` runs
    client: { enabled: true },
  },
})

Three pieces, use any of them

    Server instance

    usePGlite() in your Nitro routes: a lazily created PGlite, configured in server/pglite.config.ts, typed from its extensions.

    Development socket

    The same database over the Postgres wire protocol in nuxt dev. pg, postgres.js, Drizzle, drizzle-kit and psql connect through DATABASE_URL.

    In-browser database

    PGlite in a Web Worker shared between tabs, with useLiveQuery() keeping your components in sync with the data.

And what goes with them

    PGlite in dev, Postgres in prod

    Develop against PGlite with no database to install, deploy against any Postgres with the same driver code and nothing of PGlite in the build.

    Migrations

    A folder of SQL files, applied from init in development and by you or your platform in production.

    Testing

    A database built from your app's config for the test suite, in memory and forkable per test.

    DevTools tab

    Inspect each instance, run SQL against it and trigger your own actions: seeding, resets, migration CLIs.

    Outside Nuxt

    The config helper, the lazy provider and the socket server ship as their own entries, usable from any Node, Bun or Deno server.

    Reference

    Every option, export, hook and environment variable, with its type and default.