Start a TypeScript app with Strata Postgres for free
Create a database in under a minute, connect a fresh TypeScript project to it, and run a typed query. You will not need a credit card.
1. Create the project
- npm
- pnpm
- bun
npm create strata@latest -- --template minimalpnpm create strata@latest --template minimalbun create strata@latest --template minimal2. Create a database
npx strata postgres create --name quickstart --region eu-centralThe command writes DATABASE_URL to your .env file. It is a pooled connection string — keep it out of version control.
The free plan pauses a database after seven days with no queries. Your data is kept; the first query after a pause takes a few seconds longer.
3. Model and migrate
import { model, text, id, boolean, timestamp } from "@strata/contract";
export const Note = model("Note", {
id: id(),
body: text(),
pinned: boolean().default(false),
createdAt: timestamp().defaultNow(),
});npx strata migrate dev --name init4. Query it
import { db } from "./strata/db";
await db.note.create({ data: { body: "Hello from Strata" } });
console.log(await db.note.where({ pinned: false }).all());You should see one note printed. That is the whole loop: change the contract, migrate, and the client's types follow.
Updated
Was this page helpful?