Hosted: getting started

Haystash can run Haystash DB for you. You sign up, create a project, and copy its address and key into your app. Each project gets its own Postgres database. You don't run a server.

Status: not open yet. The hosted service is invite-only and not yet running publicly. Like the rest of Haystash DB it is a prototype and has not been audited. Don't put production data in it yet. Prefer to run it yourself? See Self-hosting.

Sign up

  1. Open the dashboard and create an account with your email and a password.
  2. Sign-up is invite-only for now. Enter the invite code you were given. An invite link fills it in for you.
  3. We send you an email. Open the link in it to confirm your address. You can sign in before that, but you can't create a project until it is confirmed.

Forgot your password? Use Forgot your password? on the sign-in page; we email a reset link.

Create a project

Press New project and give it a name. It takes about a minute. You get:

Save the backend key now. We keep only its hash, so we can't show it again. Put it in your backend's secret settings, never in a web page or an app. It reaches every row of every table, but sees locked columns only as ciphertext. Lost it? Make a new one on the project's Connect page; the old one stops working at once.

Inside a project the dashboard has the same screens as the self-hosted console: Overview, Tables (create tables, lock a column with a dry run first), Users and Connect. The concepts are the same too. You never see or need the project's admin token.

Connect your app

Use the address from the dashboard's Connect page with the JavaScript client:

import { createClient } from '@haystash/db'

const db = await createClient('https://<ref>.<domain>', {
  pinned: ['notes.body'],   // refuse to run unless notes.body is locked
})

Your backend uses the backend key:

import { createServiceClient } from '@haystash/db'

const svc = createServiceClient(process.env.HAYSTASH_URL, process.env.HAYSTASH_SERVICE_KEY)

A project's address answers only the data API (/v1), the Key Gate (/gate), the client (/sdk) and /health. There is no console or admin API on it: you manage the project in the dashboard.

When the service runs on one local address (development and previews), projects are reached by path instead, for example http://127.0.0.1:7600/p/<ref>. Use whatever address the Connect page shows.

The first request after the project has been idle for a while waits a few seconds while its database wakes up.

Settings

Each project's Settings page has:

The Usage page shows the project's compute time and storage this month against your plan. The numbers are updated once a day.

The command-line tool

The haystash tool imports users and tables and locks columns (see Migrating). On a hosted project it uses a CLI token instead of an admin token:

  1. In the project, open CLI tokens and press New token. Name it after the computer it is for. The token is shown once.
  2. Set the two values the page shows:
export HAYSTASH_URL=https://app.<domain>/api/cli/<ref>
export HAYSTASH_CLI_TOKEN=<your token>

A CLI token works only for its own project. It can change tables and users but can't read locked values. Revoke it on the same page if the computer is lost.

Not finished: the haystash tool in the repository still sends only an admin token. Using it with a CLI token needs a small change to the tool that is not made yet.

Plans and prices

Payments are not switched on yet, so every account is on Free for now. These are the planned prices, in US dollars:

FreePro: $25 a month per account
Projects23 included, then $10 a month each (up to 10)
Compute time20 unit-hours per project a month, then the project pauses until next month$10 of usage included each month; above it, $0.16 per unit-hour
Storage per project500 MB8 GB included; above it, $0.50 per GB a month
Card neededNoYes
Monthly spending maximumNone needed$50 above the base fee by default; you can change it

Compute time is how long the database is awake, times its size. A project's database is a quarter of a unit and sleeps after 5 minutes without requests. Sleeping costs nothing. So 20 unit-hours is about 80 hours awake.

Pausing

A paused project keeps all its data, but your apps get an error (project_paused) until it runs again. A project pauses when:

We email you at 80% and at 100% of a limit or of the spending maximum, and the Usage and Billing pages show how close you are. Nothing is ever deleted because of a limit.

Idle is not the same as paused: an idle project's database sleeps and wakes on the next request by itself.

Billing

Until payments are switched on, the Billing page says so and every account stays on Free.

Backups

Each project's database keeps 7 days of history. A project can be restored to any moment within the last 7 days.

A project's data and its key store (users, devices, wrapped keys, the signed list of locked columns) live in the same database, so a restore brings both back to the same moment. Accounts and changes made after that moment are gone.

There is no restore button in the dashboard yet: ask support. After a restore, devices that saw a newer list of locked columns refuse the project until one more step is done on our side. We do it as part of the restore. Locks made after the restored moment have to be made again.

Deleting a project

On the Settings page, press Delete project and type the project's name. The project stops at once and its address stops answering.

For 7 days we keep its database and keys, in case it was a mistake: contact support and we can bring it back. After 7 days the database, the users and their keys are erased for good, and nobody can get them back.

What we can and cannot see

When Haystash hosts your project, Haystash is the server operator in the threat model. Plainly:

We holdWhy
Your project's Postgres database, with Neon as our database providerYour tables and the project's key store live there
The project's master key, admin token and database address, encrypted under our own control keySo our program can run the project's Key Gate and admin actions
Your account: email, password hash, plan, usageTo run the dashboard and bill you

We can: read and change every column you have not locked; see your users' emails, and the passwords they send when they sign in with a password; pause, delete and restore projects; replace a locked value with another one (locked means private, not tamper-proof); and, if your app loads the client from the project's /sdk/, serve changed client code. Bundle the client with your app to take that last one away.

We cannot: read a locked value. Each user's key needs a part that is only on their device (or in their recovery code or passkey). We hold the other part, and it is not enough on its own. A copy of the database, even together with our keys, opens no locked value.

Neon, our database provider, stores the database: locked values only as ciphertext, the key store encrypted under a master key Neon does not have, and your other columns readable. Stripe holds card details.

Every action on our admin page is written to an audit list (who, what, when). One program serves every project, each in its own compartment with its own database. A request for one project must never reach another, but a bug in that one program could affect every project at once. None of this has been reviewed from outside yet. The full details are in docs/db/SECURITY.md in the repository.