runlot
Data

Database

Every project comes with a PostgreSQL database. Use it from your worker as env.db — no connection string, no secrets.

runlot.json
{ "database": true }
runlot deploy

After the deploy, env.db is available in your worker. The database runs on the same machine as your app and is reached through a binding, so there is no connection string to store as a secret.

const rows = await env.db.exec("select id, name from users where id = $1", [1]);

One database per project

There is no database name to choose, so the binding is always env.db. If you need more than one database, split the work into separate projects.

Pages in this section

Getting started

  • env.db — the four APIs you use from a worker
  • Your first query — from creating a table to reading rows back
  • @runlot/pg — a Pool that behaves like node-postgres

Operating

Reference

On this page