99% of queries in zero milliseconds

Zero is an entirely new way to build web applications that provides:

Zero provides these benefits completely automatically. Write your code the normal, obvious way, and it is instantaneous and realtime by default.

At the same time, Zero removes much of the complexity from modern web development. With Zero, you don’t think about server components, hydration, graphql, state management, optimistic updates, and many other miscellaneous bits of complexity that the web has accumulated. You just write queries and render UI. f(state) => UI.

You can use Zero to build all kinds of web apps, from blogs to collaborative spreadsheets. But where Zero really shines is cutting-edge “local-first” style applications like Linear and Superhuman. With Zero, these apps can be built in a fraction of the time it would take to build even an old-fashioned server-rendered web app.

How it Works

Zero has two parts: a client that runs in the browser as part of your web app’s JS (native mobile clients to follow), and a cache that runs as a service in front of your database.

Untitled

The Zero Cache connects to your database using the database’s native replication protocol. The setup is incredibly easy. Just give it permissions, tell it what tables to make available to the client, and you’re done.

Zero Cache stores a copy of the data that gets pushed into it and organizes it internally to facilitate sync. Think of it as a fancy read replica. You provide a Postgres database to write to when you start zero-cache and it can just be another db within your existing pg cluster if you have one.

Zero is open source. You can run the cache yourself under your own AWS account, but most people choose to let us run and monitor it for them – either as a service at zerosync.dev, or via a managed on-prem arrangement.

You read and write to your database with the Zero Client. Unlike common web application stacks today, Zero doesn’t require an application server at all (though you have the option to use one if you like).

Using Zero

There are basically only two APIs. Read data using the query API:

const z = new Zero({
  server: "<https://yourapp.zerodb.com/>",
  auth: "some-auth-token",
});

const issues = z.issues
	.select('id', 'title')
	.subselect('labels', q => q.traverse('labels').select('id', 'name'))
  .where('created', gt(date))
  .sort('lastModified', 'desc')
  .limit(100);

A full SQL-style query API is available, with joins, sub-selects, aggregations, etc.