Run
Add a schema file to a Helix project and the next deploy gives it its own Postgres database. Every deploy after that applies your schema changes before the new code goes live.
A deal desk app gets a new field
requests = pgTable( account discount requestedBy + reasonCode: text('reason_code') )
| Account | Discount | Reason | Status |
|---|---|---|---|
| Northwind | 15% | Multi-year | Approved |
| Acme Corp | 22% | Competitive | Pending |
| Globex | 8% | Volume | Approved |
| Initech | 12% | Renewal | Pending |
The project's PostgresCreated by the first deploy, migrated by every deploy
Deploy
Run
Govern
Next week, someone renames discount in one deploy. Helix refuses it before it runs, because the old column's data would go. The deal desk keeps serving.
In short
Tray Helix now gives a project its own managed Postgres database. A team describes its tables in db/schema.ts with Drizzle ORM, and the first deploy creates the database while every later deploy applies schema changes before the new code goes live. Functions query it through ctx.db(), a typed query builder, and helix dev runs a local in-memory copy that never touches deployed data.
Most internal apps outgrow a spreadsheet the week they ship. They need records that relate to each other: requests and the people who approve them, accounts and their contracts, tickets and their history. Until now that meant asking for a database, waiting for someone to set it up, and keeping its schema in step with the code by hand.
Now in Helix, the database comes with the app. You describe the tables in one file, and the deploy does the rest: it creates the database the first time, and on every deploy after that it changes the schema to match your file before the new code goes live.
What that gives the team building it:
db/schema.ts gets its own Postgres database, with pgvector included. A project without one has no database.helix dev runs an in-memory Postgres built from the same schema. It starts fresh on every save and can’t reach deployed data.What it gives IT:
A sales team runs a deal desk app on Helix for discount approvals. Requests come in through a form, and a manager approves or declines them. Here’s the app getting its database.
They ask the AI assistant for two tables, discount requests and approvals, and it writes them into db/schema.ts: the account, the discount asked for, who asked, and each approval with the approver and a timestamp.
The team runs helix deploy. Helix sees the schema, creates the project’s Postgres database, applies the schema and only then puts the new code live. The form’s function writes each request with one call, and the manager’s view reads the open ones.
Finance wants a reason code on every request. The assistant adds a column with a default to the schema, and the next deploy adds it to the live table before the code that uses it ships. Nobody writes a migration.
Later someone renames the discount column in the same change that drops the old one. Helix reads that as data that would disappear, and the deploy is refused with a message saying to make the change in steps. The live app keeps running untouched.
Rename and remove in steps. Add the new column, copy the data across with a one-off function, and remove the old column in a later deploy. A deploy never carries data, only schema.
The first call after a quiet spell is slower. An idle database wakes when it’s next used. Helix retries a call that arrives while it wakes, for up to about 30 seconds. A statement that fails for any other reason isn’t retried, so a write never runs twice.
Some column types need a cast. Enum, numeric, array and vector values fail without one. Since Helix 1.28.0 the SDK has column types that cast for you, and helix dev fails the same way the deployed database does, so you catch it locally.
Big results are refused. A single result over about 1 MiB is rejected, so page large reads.
It’s for data that outlives a request. For a simple value or a flag, the project’s key-value store is lighter.
How to set it up, change the schema and query it is in the docs linked above.
No. The project holds only db/schema.ts. On each deploy, Helix compares it with the schema the database already has, generates the migration and applies it before the new code goes live. helix db migrations lists what has been applied.
The deploy is refused. Dropping a table or column, or narrowing a type, is destructive, so you make it in steps across separate deploys: add the new shape, copy the data across, then remove the old one.
No. The database belongs to one project, and no other project can read it. Every function in that project reads and writes the same database.
Yes. helix dev runs an in-memory Postgres built from your schema. It starts empty on every save and restart, and it never touches a deployed database.
Deploy an app you built with your AI assistant, and see what Helix does with it.
Thanks, keep an eye on your inbox for an invite.
Want to talk to someone first? Contact us