create-pg
v1.1.3
Published
Instantly create a temporary Prisma Postgres database with one command, then claim and persist it in your Prisma Data Platform project when ready.
Readme
create-pg
create-pg is an alias for create-db - an open-source CLI tool and library that provisions temporary Prisma Postgres databases with a single command.
Each database is available for 24 hours by default. To keep the database permanently, you can claim it for free using the URL displayed in the output.
Quick Start
npx create-pg@latestCLI Usage
# Create database in auto-detected nearest region
npx create-pg
# Create database in a specific region
npx create-pg --region eu-west-3
npx create-pg -r us-east-1
# Interactive region selection
npx create-pg --interactive
npx create-pg -i
# Output as JSON
npx create-pg --json
npx create-pg -j
# Write connection string to .env file
npx create-pg --env .env
npx create-pg -e .env.local
# List available regions
npx create-pg regionsOptions
| Flag | Alias | Description |
|------|-------|-------------|
| --region <region> | -r | AWS region for the database |
| --interactive | -i | Interactive mode to select a region |
| --json | -j | Output machine-readable JSON |
| --env <path> | -e | Write DATABASE_URL and CLAIM_URL to specified .env file |
| --help | -h | Show help message |
Programmatic API
import { create, regions } from "create-pg";
// Create a database
const result = await create({ region: "us-east-1" });
if (result.success) {
console.log(`Connection string: ${result.connectionString}`);
console.log(`Claim URL: ${result.claimUrl}`);
} else {
console.error(`Error: ${result.message}`);
}
// List available regions
const availableRegions = await regions();Aliases
You can also use:
npx create-db@latest
npx create-postgres@latestDocumentation
For full documentation, see the create-db README.
