Skip to main content
Zero is a revolutionary web framework for building real-time, reactive applications with instant data synchronization. It delivers 99% of queries in zero milliseconds by maintaining incrementally updated views on the client.

What is Zero?

Zero transforms how you build web applications by automatically syncing data between your PostgreSQL database and client devices in real-time. When data changes on the server, all connected clients update instantly—no polling, no manual cache invalidation, no complex state management.

Key Features

Zero Millisecond Queries

99% of queries return instantly from local cache through Incremental View Maintenance (IVM)

Real-Time Sync

Automatic bidirectional sync between PostgreSQL and all connected clients

Type-Safe Queries

Build queries with a type-safe builder API with full TypeScript support

Offline-First

Built on Replicache for robust offline support and optimistic updates

How It Works

Zero follows a sync-first architecture with three key components:
  1. PostgreSQL - Your source of truth for data
  2. zero-cache - Server-side sync engine that maintains a SQLite replica
  3. zero-client - Client-side library that syncs to IndexedDB (powered by Replicache)
Queries are defined using ZQL (Zero Query Language), which transforms type-safe queries into SQL and maintains results incrementally as data changes.

Architecture

Zero consists of several packages that work together:
  • @rocicorp/zero - Main package with client and server exports
  • zero-client - Client-side library for queries and mutations
  • zero-cache - Server-side sync engine
  • zero-schema - Schema definition builder
  • zql - Incremental View Maintenance (IVM) query engine
  • zero-react - React hooks (useQuery, useZero)
  • zero-solid - Solid.js integration
  • zero-react-native - React Native support

Quick Example

Here’s a complete example from our reference app, zbugs:
import { table, string, number, boolean, enumeration, createSchema } from '@rocicorp/zero';

const user = table('user')
  .columns({
    id: string(),
    login: string(),
    name: string().optional(),
    avatar: string(),
    role: enumeration<Role>(),
  })
  .primaryKey('id');

const issue = table('issue')
  .columns({
    id: string(),
    title: string(),
    open: boolean(),
    modified: number(),
    created: number(),
    projectID: string(),
    creatorID: string(),
  })
  .primaryKey('id');

export const schema = createSchema({
  tables: [user, issue],
  relationships: [],
});

Get Started

Installation

Install Zero and set up your first project

Quick Start

Build your first Zero application in minutes

Schema Definition

Learn how to define tables and relationships

Querying Data

Master the type-safe query builder API

Why Zero?

Zero is built by Rocicorp, the team behind Replicache. It’s production-ready and powers zbugs, our public bug tracker with millions of rows of data.
Traditional web applications require complex infrastructure for real-time updates: WebSocket servers, Redis pub/sub, cache invalidation logic, and careful coordination between backend and frontend state. Zero eliminates this complexity:
  • No cache invalidation - Views update automatically through IVM
  • No manual WebSocket handling - Sync happens transparently
  • No loading states - Queries return instantly from local cache
  • No optimistic update logic - Built into the framework

Performance at Scale

Zero is designed to handle millions of rows efficiently. Our Gigabugs demo syncs 2.5 million rows to the client, with queries still returning in zero milliseconds thanks to IVM.

Learn More

Join the Rocicorp Discord to connect with other Zero developers and get help from the team.

Build docs developers (and LLMs) love