Fireproof Tutorial: Local-First Document Database for AI-Native Apps

June 15, 2026 ยท View on GitHub

Learn how to use fireproof-storage/fireproof to build local-first, encrypted, sync-capable applications with a unified browser/Node/Deno API and React hooks.

GitHub Repo License Docs

Why This Track Matters

For AI-generated and collaborative apps, teams need data systems that run locally, sync later, and still preserve integrity. Fireproof is designed for that model with document APIs, live queries, and cryptographic causal consistency.

This track focuses on:

  • document lifecycle and query model
  • React hook workflows for live local-first UX
  • gateway and sync architecture across runtimes
  • production governance for encryption, debugging, and operations

Current Snapshot (auto-updated)

Mental Model

flowchart LR
    A[App Writes Document] --> B[Fireproof Database API]
    B --> C[CRDT and Ledger Clock]
    C --> D[Content-Addressed Storage]
    D --> E[Gateway Sync]
    E --> F[Live Query Updates]

Chapter Guide

ChapterKey QuestionOutcome
01 - Getting StartedHow do I run Fireproof quickly in app code?Working local baseline
02 - Core Document API and Query LifecycleHow do put/get/query/changes behave?Strong data model mental model
03 - React Hooks and Live Local-First UXHow do useFireproof, useLiveQuery, and useDocument fit together?Real-time UX baseline
04 - Ledger, CRDT, and Causal ConsistencyHow does Fireproof maintain integrity in multi-writer scenarios?Better correctness model
05 - Storage Gateways and Sync TopologyHow is data persisted and synchronized across environments?Deployment architecture clarity
06 - Files, Attachments, and Rich Data FlowsHow do image/file flows work with Fireproof docs?Rich content implementation pattern
07 - Runtime Coverage: Browser, Node, Deno, and EdgeWhere and how can Fireproof run?Cross-runtime strategy
08 - Production Operations, Security, and DebuggingHow do teams operate Fireproof safely at scale?Ops and security baseline

What You Will Learn

  • how to structure local-first document workflows for AI-native apps
  • how live query/reactive patterns map to Fireproof APIs
  • how sync and storage gateways support multi-environment deployments
  • how to debug and secure Fireproof usage in production workflows

Source References


Start with Chapter 1: Getting Started.

Full Chapter Map

  1. Chapter 1: Getting Started
  2. Chapter 2: Core Document API and Query Lifecycle
  3. Chapter 3: React Hooks and Live Local-First UX
  4. Chapter 4: Ledger, CRDT, and Causal Consistency
  5. Chapter 5: Storage Gateways and Sync Topology
  6. Chapter 6: Files, Attachments, and Rich Data Flows
  7. Chapter 7: Runtime Coverage: Browser, Node, Deno, and Edge
  8. Chapter 8: Production Operations, Security, and Debugging

Generated by AI Codebase Knowledge Builder