Registry / devops / create-db

create-db

JSON →
library1.2.1jsnpmunverified

create-db is a CLI tool (v1.2.1) that instantly provisions a temporary Prisma Postgres database for development or testing. It integrates with the Prisma Data Platform, allowing users to claim and persist the temporary database into a permanent project. The tool is maintained by Prisma, releases are frequent (semver), and it differentiates by providing ephemeral databases without manual cloud setup, ideal for CI/CD and rapid prototyping. Requires Node 18+ and a Prisma Data Platform account for persistence.

npm install create-db
INSTALL
IMPORT
SIG · CREATE-DB
C
create-db
devopsjavascriptv1.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createDb
✓ import { createDb } from 'create-db'
✗ const createDb = require('create-db')
Package is ESM-only. No CommonJS support.
createDb
✓ import createDb from 'create-db'
Also available as default export for convenience.
claimDb
✓ import { claimDb } from 'create-db'
✗ const { claimDb } = require('create-db')
Named export works only with ESM imports.

Creates a temporary Prisma Postgres database and then claims it to a permanent project.

import { createDb, claimDb } from 'create-db'; async function main() { const db = await createDb({ projectId: process.env.PRISMA_PROJECT_ID ?? '', apiKey: process.env.PRISMA_API_KEY ?? '', }); console.log('Temporary DB:', db.url); // Later, claim it const claimed = await claimDb(db.id, { name: 'my-permanent-db', }); console.log('Claimed:', claimed.url); } main().catch(console.error);
Debug
Known issues
gotchaAPI keys must have the 'databases:create' and 'databases:claim' permissions. Without them, operations fail silently with 403.
fix
Ensure API key has required scopes in Prisma Data Platform settings.
affects: >=1.0.0
deprecatedThe `createDb` function's `region` parameter is deprecated; use `provider` instead.
fix
Replace `region` with `provider: 'aws'` or similar.
affects: >=1.2.0
breakingVersion 1.0.0 changed the return type of `createDb` from a string to an object with `id` and `url`.
fix
Access `db.url` instead of using the result directly.
affects: <1.0.0
gotchaTemporary databases are automatically deleted after 24 hours if not claimed.
fix
Call `claimDb` within 24 hours to persist the database.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'create-db'
Package not installed or wrong import path.
fix
Run `npm install create-db` and ensure you are using ESM imports.
TypeError: createDb is not a function
Using CommonJS require instead of ESM import.
fix
Use `import { createDb } from 'create-db'` or set `"type": "module"` in package.json.
Error: 403 Forbidden
API key lacks required permissions.
fix
Generate a new API key with 'databases:create' and 'databases:claim' scopes in Prisma Data Platform.
Upgrade
Version history
1.2.1latest on npm
Audit
Dependencies
@prisma/internalsrequiredUsed for Prisma engine interactions
Agent activity
12 hits · last 30 days
node
8
OpenAI (training)
1
Resources
create-db — npm install create-db · libregistry