API
Module
@wervt/nuxt options and what the module sets up.
nuxt.config.ts
export default defineNuxtConfig({
modules: ['@wervt/nuxt'],
wervt: {
app: 'todos', // defaults to the package.json name
timezone: 'Europe/Berlin', // of nitro.scheduledTasks, UTC by default
dev: {
adminUrl: 'postgres://postgres:postgres@localhost:5432/wervt',
dbSecret: 'dev-secret',
electricUrl: 'http://localhost:3030',
electricSecret: 'dev-electric-secret',
},
},
})
All options are optional; the defaults match the wervt compose.yml. The dev values can also come
from WERVT_PG_ADMIN_URL, WERVT_DB_SECRET, ELECTRIC_URL and ELECTRIC_SECRET.
What it does
| Build | Sets the deno-server Nitro preset for production builds. |
| Runtime | Injects Buffer, setImmediate and clearImmediate from Node builtins, which Deno doesn't define globally. |
| Client | Auto-imports useShape. |
| Dev | Creates the app's role and schema, runs migrations (again when drizzle/ changes) and sets DATABASE_URL and the Electric env vars. |
| Logs | Sets up evlog: one wide event per request, useLogger(event) and log. |
| Tasks | Turns on Nitro tasks; production builds hand nitro.scheduledTasks to wervt (see Tasks). |
| Files | With ablage installed, connects it to the app's bucket, in dev too (see Files). |
Exports
| Import | |
|---|---|
@wervt/nuxt/server | useDb, proxyShape, validation helpers, useWervtUser, useLogger, log, defineTask |
@wervt/nuxt/provision | provisionDatabase, appDatabaseUrl, dbRole, storageCredentials, createStorage (Node, used by the control plane and nuxt dev) |