Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 87 additions & 29 deletions create-db/README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,108 @@
# Create DB CLI
## **What is `create-db`?**

CLI tool for provisioning a [temporary Prisma Postgres databases](https://www.prisma.io/postgres?utm_source=create_db_npm_docs).
`create-db` is an open-source CLI tool that provisions [**temporary Prisma Postgres databases**](https://www.prisma.io/postgres?utm_source=create_db_npm_docs) with a single command.

## Usage
![Demo Gif](demo.gif)

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 CLI output.

This tool is designed for developers who need a fast way to test, prototype, or integrate Prisma Postgres without manual setup or creating an account.

## **Installation and usage**

There is no need to install the tool globally. Simply run:

```bash
npx create-db # Default region (us-east-1)
npx create-db --region eu-west-1 # Custom region
npx create-db --i # Interactive region selection
npx create-db@latest
```

## Key Files
You can also use the following aliases:

- **Main Logic:** [`index.js`](index.js) - Argument parsing, API requests, and output
- **Configuration:** [`package.json`](package.json) - CLI entry point and dependencies
- **Environment:** `.env` - Worker endpoints configuration
```bash
npx create-pg@latest
npx create-postgres@latest
```

## Development
## **Examples**

```bash
npm install
npx create-db # Creates a database in the default region
npx create-db --region eu-west-1 # Creates a database in a specific region
npx create-db --i # Interactive region selection

```

Create `.env` for local development:
## **Available options**

```env
# LOCAL
CREATE_DB_WORKER_URL="http://127.0.0.1:8787"
CLAIM_DB_WORKER_URL="http://127.0.0.1:8787"
You can run `npx create-db --help` or `npx create-db -h` to see all the available CLI options:

# PROD
# CLAIM_DB_WORKER_URL="https://create-db.prisma.io"
# CREATE_DB_WORKER_URL="https://create-db-temp.prisma.io"
```
npx create-db [options]

Options:
--region <region>, -r <region> Specify a region
Available regions:
ap-southeast-1, ap-northeast-1,
eu-central-1, eu-west-3,
us-east-1, us-west-1

--interactive, -i Run in interactive mode

If running both workers locally, use a different port for one and update the URL:
--help, -h Show this help message

```env
CREATE_DB_WORKER_URL="http://127.0.0.1:9999"
CLAIM_DB_WORKER_URL="http://127.0.0.1:8787"
```

## Test Locally
## **CLI output example**

```
┌ 🚀 Creating a Prisma Postgres database
│ Provisioning a temporary database in us-east-1...
│ It will be automatically deleted in 24 hours, but you can claim it.
◇ Database created successfully!
● Connect to your database →
│ Prisma connection string:
│ prisma+postgres://accelerate.prisma-data.net/?api_key=...
│ Standard connection string:
│ postgresql://<username>:<password>@db.prisma.io:5432/postgres
◆ Claim your database →
│ Want to keep your database? Claim for free:
│ https://create-db.prisma.io?projectID=proj_...

```bash
npx create-db
npx create-db --region eu-west-1
npx create-db --i
```

## **Claiming a database**

When you create a database using `create-db`, it is temporary and will be deleted automatically after **24 hours**.

The CLI output includes a **claim URL** that allows you to keep the database permanently for free.

**What claiming does:**

- Moves the database into your Prisma Postgres account.
- Prevents it from being auto-deleted.
- Lets you continue using the database as a long-term instance.

Example:

```
◆ Claim your database →
│ Want to keep your database? Claim for free:
|
│ https://create-db.prisma.io?projectID=proj_...
│ Your database will be deleted on 7/24/2025, 2:25:41 AM if not claimed.
```

## **Next steps**

- Refer to the section in the official [Prisma Postgres documentation](https://www.prisma.io/docs/postgres/introduction/npx-create-db).
Binary file added create-db/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions create-db/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-db",
"version": "0.0.9",
"version": "0.0.10",
"description": "Instantly create a temporary Prisma Postgres database with one command, then claim and persist it in your Prisma Data Platform project when ready.",
"main": "index.js",
"author": "",
Expand Down Expand Up @@ -38,6 +38,7 @@
},
"files": [
"index.js",
"README.md"
"README.md",
"demo.gif"
]
}
114 changes: 85 additions & 29 deletions create-pg/README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,106 @@
# Create DB CLI
## **What is `create-pg`?**

CLI tool for provisioning a [temporary Prisma Postgres databases](https://www.prisma.io/postgres?utm_source=create_pg_npm_docs).
`create-pg` is an open-source CLI tool that provisions [**temporary Prisma Postgres databases**](https://www.prisma.io/postgres?utm_source=create_db_npm_docs) with a single command.

## Usage
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 CLI output.

This tool is designed for developers who need a fast way to test, prototype, or integrate Prisma Postgres without manual setup or creating an account.

## **Installation and usage**

There is no need to install the tool globally. Simply run:

```bash
npx create-pg # Default region (us-east-1)
npx create-pg --region eu-west-1 # Custom region
npx create-pg --i # Interactive region selection
npx create-pg@latest
```

## Key Files
You can also use the following aliases:

- **Main Logic:** [`index.js`](index.js) - Argument parsing, API requests, and output
- **Configuration:** [`package.json`](package.json) - CLI entry point and dependencies
- **Environment:** `.env` - Worker endpoints configuration
```bash
npx create-db@latest
npx create-postgres@latest
```

## Development
## **Examples**

```bash
npm install
npx create-pg # Creates a database in the default region
npx create-pg --region eu-west-1 # Creates a database in a specific region
npx create-pg --i # Interactive region selection

```

Create `.env` for local development:
## **Available options**

```env
# LOCAL
CREATE_DB_WORKER_URL="http://127.0.0.1:8787"
CLAIM_DB_WORKER_URL="http://127.0.0.1:8787"
You can run `npx create-pg --help` or `npx create-pg -h` to see all the available CLI options:

# PROD
# CLAIM_DB_WORKER_URL="https://create-db.prisma.io"
# CREATE_DB_WORKER_URL="https://create-db-temp.prisma.io"
```
npx create-pg [options]

If running both workers locally, use a different port for one and update the URL:
Options:
--region <region>, -r <region> Specify a region
Available regions:
ap-southeast-1, ap-northeast-1,
eu-central-1, eu-west-3,
us-east-1, us-west-1

--interactive, -i Run in interactive mode

--help, -h Show this help message

```env
CREATE_DB_WORKER_URL="http://127.0.0.1:9999"
CLAIM_DB_WORKER_URL="http://127.0.0.1:8787"
```

## Test Locally
## **CLI output example**

```
┌ 🚀 Creating a Prisma Postgres database
│ Provisioning a temporary database in us-east-1...
│ It will be automatically deleted in 24 hours, but you can claim it.
◇ Database created successfully!
● Connect to your database →
│ Prisma connection string:
│ prisma+postgres://accelerate.prisma-data.net/?api_key=...
│ Standard connection string:
│ postgresql://<username>:<password>@db.prisma.io:5432/postgres
◆ Claim your database →
│ Want to keep your database? Claim for free:
│ https://create-db.prisma.io?projectID=proj_...

```bash
npx create-pg
npx create-pg --region eu-west-1
npx create-pg --i
```

## **Claiming a database**

When you create a database using `create-pg`, it is temporary and will be deleted automatically after **24 hours**.

The CLI output includes a **claim URL** that allows you to keep the database permanently for free.

**What claiming does:**

- Moves the database into your Prisma Postgres account.
- Prevents it from being auto-deleted.
- Lets you continue using the database as a long-term instance.

Example:

```
◆ Claim your database →
│ Want to keep your database? Claim for free:
|
│ https://create-db.prisma.io?projectID=proj_...
│ Your database will be deleted on 7/24/2025, 2:25:41 AM if not claimed.
```

## **Next steps**

- Refer to the section in the official [Prisma Postgres documentation](https://www.prisma.io/docs/postgres/introduction/npx-create-db).
2 changes: 1 addition & 1 deletion create-pg/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-pg",
"version": "0.0.9",
"version": "0.0.10",
"description": "Instantly create a temporary Prisma Postgres database with one command, then claim and persist it in your Prisma Data Platform project when ready.",
"main": "index.js",
"author": "",
Expand Down
Loading