Blog

Why we built CoyoteDB

High-availability Postgres usually means a managed cloud bill or a stack of tools to assemble. We wanted one program, real PostgreSQL 18, on your own machines.

The CoyoteDB team5 min read

A lot of useful software runs on one database on one computer. The booking app for a small clinic. The stock system in a shop’s back office. A side project that has quietly picked up paying users.

That works well until the computer stops. A power supply fails, a disk dies, an update reboots it at the wrong moment, someone unplugs the wrong cable. Then the app stops too, and anything saved since the last backup may be gone.

The fix is well known. Keep a live copy of the database on a second computer, and switch to it when the first one dies. In the database world this is called high availability. The hard part has never been the idea. The hard part is getting it.

The two usual roads

Today there are two ways most people get a PostgreSQL database that survives a dead computer.

Rent it. Managed cloud databases offer a high-availability option. Amazon RDS, for example, keeps a standby copy in a second availability zone and fails over to it for you. It is a good product. But your data lives in someone else’s building, you pay every month, and the high-availability option costs more than a single database. For a small business or a solo builder that bill adds up, and it never goes away.

Build it. You can run Postgres on your own machines and add the missing pieces yourself. A common setup is Patroni to manage failover, a three-node etcd (or Consul, or ZooKeeper) cluster for Patroni to keep its state in, and HAProxy in front so your app can find the current main server. Some teams add pgBouncer for connection pooling and keepalived for a floating address. If you already run Kubernetes, an operator such as CloudNativePG or Crunchy PGO wraps a lot of this up for you.

These tools are mature, and many teams run them in production. But each one is its own program, with its own config and its own way to fail. Putting them together, and knowing what happens when one breaks at 3 am, is a specialist’s job. Most small teams do not have that specialist. Most solo builders do not want to become one.

So in practice, many people take a third road: they run one database and hope.

What we wanted instead

We wanted the safe setup to be the easy one. Easy enough that a small business owner, a homelabber or someone building their first app with an AI coding agent would actually do it, before the day the computer dies.

That gave us a short list:

  • Real PostgreSQL. Not a new engine and not something “compatible”. Every Postgres tool, library and habit should just work, and the data should sit in a format people have trusted for decades.
  • Your own machines. The data stays on computers you control: a couple of mini PCs, an office desktop and a spare laptop that stays plugged in, or a few small servers you rent. No cloud database to pay for each month.
  • One program. Not five tools to install and wire together. One small app on each computer.
  • Plain safety rules. You should be able to read, in plain words, what happens when something fails.

What CoyoteDB is

CoyoteDB is self-hosted software that runs real PostgreSQL on one or several of your own computers and keeps them in sync, so the database can keep running when one of them stops.

You start the small coyote app on your first computer. It downloads, checks and runs PostgreSQL 18 for you. You ask it for an invite code and paste that code on the next computer. The two find each other and start syncing, over one encrypted port. Your app connects with a normal Postgres connection string.

Inside, CoyoteDB does the same jobs that the do-it-yourself stack does. It keeps copies with Postgres’s own streaming replication. It lets the computers vote on which one is in charge. It makes sure a computer that has lost touch steps aside. The difference is that these jobs live in one program that was designed as a whole, instead of separate tools you have to fit together.

Three rules hold the design together. A save counts once two computers have it: when a second data node is up, which is always the case in normal running, CoyoteDB waits until it has a copy before it says “saved”. The nodes vote on who is in charge, so there is never any doubt which one takes the writes. And a cut-off node steps aside on its own: if it loses touch with the others, it shuts its database down before another node takes over.

With three computers, or two computers plus a small “witness” that only votes, the others take over by themselves when the main one stops. We test that with real Postgres processes and with chaos tests that kill, freeze and cut off nodes on purpose, while a checker confirms that no acknowledged write was lost and that there were never two main nodes at once. In those tests a new main node was in place about 10 seconds after a hard kill (6 to 11 seconds), and writes flowed again in roughly 10 to 25 seconds (measured on one Mac, default settings).

What it is not

We would rather you hear the limits from us.

  • It is not for spreading one database across regions or around the world. It is built for a few computers on one private network, such as a LAN, Tailscale or a site-to-site VPN between a few offices.
  • The computers that hold data in one cluster must all be the same system type: all Linux, all Windows, or all Mac with the same chip family. The witness, and the apps that connect, can be anything.
  • Copies are not backups. If someone deletes a table, the delete is copied to every node at once. Keep backups as well.
  • Two computers on their own cannot fail over safely by themselves. Add a witness, or a third computer. We explain why in What “high availability” actually means for a small app.

Who it is for

CoyoteDB is built for people who want their database to stay up and do not have a database administrator: small businesses with an app in the back office, indie builders and vibe coders who want real Postgres without a cloud bill, homelabbers with a few boxes on a tailnet, and agencies who leave software running at a client’s site.

If you run a large platform team, already live in Kubernetes, or need a database in several regions, the tools above may suit you better. We compare them honestly in CoyoteDB vs. the usual ways to keep Postgres up.

There is no public download yet. If you want to hear when there is, or you have a setup you want it to handle, tell us.