Run PostDurable locally

Start the stack, create a database, and run a query with psql.

Markdown

Before you start

  • A PostDurable checkout on macOS or Linux
  • Node.js 22.12 or later, npm, and Python 3.10 or later
  • Git, Make, OpenSSL, and a C compiler
  • The PostgreSQL psql client

Setup uses Rust 1.98.0 and installs the required WebAssembly target when needed. A Cloudflare account is unnecessary for the local stack.

Start the local stack

Run these commands from the checkout:

make setup
make dev

Keep the launcher running. Open the local site and choose Create an account. The launcher prints the exact URL and path to its loopback certificate. If Chrome shows a certificate warning, check the certificate fingerprint before deciding whether to trust it.

Create the first database

  1. Sign up with a synthetic address such as owner@example.test. The local mail is stored on disk.

  2. Read the newest verification link with the following command. Open the link in the same browser.

    node console/scripts/mail.mjs owner@example.test "$PWD/.local/dev/control"
  3. Open the console and select your account. Create a project, then a database, and wait for Ready.

  4. Open Connect. Follow the psql connection guide to start the relay and issue the SQL password.

  5. In psql, run this query to confirm the connection.

    SELECT 1 AS connected;

    Expected result

    connected
    1

Check the cost of your SQL workload

In the console, open Usage and select your database. Monthly usage shows the physical SQLite rows its SQL workload read and wrote this UTC month. A table scan can read many rows to return one result. Refresh after running a query against a table to see the change. Workspace owners and admins can view these readings. Owners can set a monthly USD budget for each database.

The estimate applies Cloudflare’s published paid-plan rates to measured rows before shared allowances and billing rounding. It excludes requests, compute, storage and internal housekeeping. A month-end projection appears after 24 hours of tracking. Your budget shows the amount remaining or over budget. SQL stays available if you exceed it. Cloudflare Durable Objects pricing

The database saves row counts in batches about once per second while SQL is active. Refreshing usage also saves outstanding counts. Completed checkpoints survive restarts. A sudden stop can lose the last unsaved batch, and an unavailable meter can extend that window. Older databases start tracking when first observed after the upgrade.

Stop or reopen the stack

Press Ctrl-C in the launcher and relay terminals. From another terminal, run make stop to stop the default stack. The next make dev reopens the state in .local/dev. To run a separate disposable stack, choose a new state directory and unused ports.

python3 scripts/local.py --state .local/second --console-port 4322 --sql-port 8789

Next step

Connect with psql to use the database from another client session.