Vite plugin that automatically provisions a Neon Postgres database and writes the connection string to your .env file during development. v0.8.0 is the current stable version; released occasionally. Key differentiator: zero-config, claimable databases on first dev server start. Unlike alternatives (e.g., dotenv + manual DB setup), it handles provisioning and teardown automatically. Previously named vite-plugin-db; the old package is deprecated.
npm install vite-plugin-neon-newVerified import paths — ran on the pinned version, not inferred.
Minimum Vite config using the postgres plugin with required referrer option. On first dev start, provisions a Neon DB and writes DATABASE_URL to .env.
Add `referrer: 'your-app-name'` to the plugin options.
Replace all imports and package.json references from `vite-plugin-db` to `vite-plugin-neon-new`.
Use a persistent database provider in production; the plugin is only for development.
Pass `env: '.env.local'` or your desired path in plugin options.
Add `.env` to `.gitignore` and use environment-specific env files. Alternatively, use a secrets manager.
Add `referrer: 'your-app-name'` to the `postgres()` options object.
Use `const { postgres } = require('vite-plugin-neon-new');` or switch to ESM `import { postgres } from 'vite-plugin-neon-new'`.Change to `import type { PostgresOptions } from 'vite-plugin-neon-new'`.