Introduction
@powersync/nuxt is a Nuxt module that wraps @powersync/vue and provides everything you need to build offline-first Nuxt applications. It re-exports all @powersync/vue composables so this is the only PowerSync dependency you need, and it adds a Nuxt Devtools integration with a PowerSync diagnostics panel for inspecting sync status, local data, config, and logs.
npm: @powersync/nuxt
PowerSync is tailored for client-side applications — there isn’t much benefit to using SSR with PowerSync. Nuxt evaluates plugins server-side unless you use the
.client.ts suffix. The PowerSync Web SDK requires browser APIs that are not available in Node.js; it performs no-ops in a Node.js runtime rather than throwing errors, but you should not expect any data from PowerSync during server-side rendering. Always create your PowerSync plugin as plugins/powersync.client.ts to ensure it runs only in the browser.Setup
Install PowerSync Dependencies
With npm (v7+), peer dependencies are installed automatically. With pnpm, you must install peer dependencies explicitly, as shown above.
Add the Module
Add@powersync/nuxt to the modules array in nuxt.config.ts and include the required Vite configuration:
nuxt.config.ts
Configure PowerSync in Your Project
Define your Schema
Create a file atpowersync/AppSchema.ts and define your local SQLite schema. PowerSync will hydrate these tables once the SDK connects to your PowerSync instance.
powersync/AppSchema.ts
Create your Connector
Create a file atpowersync/PowerSyncConnector.ts. The connector handles authentication and uploading local changes to your backend.
powersync/PowerSyncConnector.ts
Create the Plugin
Create a Nuxt plugin atplugins/powersync.client.ts. The .client.ts suffix ensures this only runs in the browser.
plugins/powersync.client.ts
Using PowerSync
The module automatically exposes all@powersync/vue composables. You can import and use them directly in any component or composable.
Reading Data
components/TodoList.vue
Writing Data
Useexecute to write to the local SQLite database. Changes are queued and uploaded to your backend via uploadData in the connector.
Kysely ORM (Optional)
The module optionally exposes ausePowerSyncKysely() composable for type-safe query building. You must install the driver and opt in via config.
Install the driver:
nuxt.config.ts:
nuxt.config.ts
usePowerSyncKysely with your schema’s Database type for full type safety:
DevTools
The@powersync/nuxt module includes a PowerSync diagnostics panel that integrates with Nuxt DevTools. It shows sync status, local data, config, and logs. See Nuxt DevTools Integration for setup instructions and available views.