fireproof-storage/fireproof

The vibe coding database runs in the browser, fits in the context window, and syncs anywhere.

TypeScript

977

3,855 commits

updated May 7, 2026

See the code

See what people are saying

SourceMessageScoreDate

Fireproof implements a CRDT and implements E2E. https://use-fireproof.com/docs/welcome/

on CRDTs: Convergence without coordination

0

Oct 23, 2025

We handle this in Fireproof with a deterministic default algorithm, in addition to having a hash-based tamperproof ledger of changes. Fireproof is not SQL based, it is more like CouchDB or MongoDB, but with cryptographic integrity. Apache 2.0 https://use-fireproof.com In practice during CouchDB's…

on CRDT and SQLite: Local-First Value Synchronization

0

Oct 13, 2025

Looks very cool. Have been developing something similar (local first data tooling) for a project of my own. The one thing stopping me from swapping my incomplete implementation with this is that I am unable to find how to connect to a db I control. In another thread you self described your backend…

on Show HN: Fireproof – local-first database with Git-like encrypted sync

0

Nov 19, 2024

The best starter is the React Tutorial in our docs: https://use-fireproof.com/docs/react-tutorial/ We are updating this example to the latest right now, it shows how team chat can be implemented with database sharing. https://github.com/fireproof-storage/firehouse-chat This drum machine is pretty…

on Show HN: Fireproof – local-first database with Git-like encrypted sync

0

Nov 19, 2024

Fireproof https://use-fireproof.com/ Pure JS embedded Document DB, no setup or config. e2e encryption, CRDT support. Build, prototype, iterate without a backend, plug into any cloud when you’re ready [disclaimer: I’m part of the team working on this]

on Ask HN: What underrated open source project deserves more recognition?

0

Mar 18, 2024

If you want to read about another implementation using Merkle CRDTs for practical local-first document database storage, I've been building a new database for about a year. I plan to share more but it's definitely an example of a Merkle CRDT, inspired by a lot of the same research in the Dolt…

on Trade-offs between Different CRDTs

0

Jan 9, 2024

Architecture – Fireproof distributed real-time database

2

Oct 17, 2023

I am building a new immutable cryptographically verified database using IPLD data structures and prolly trees. This allows changes made anywhere to be transparently synced, and for operations to be commuted amongst untrusted peers, for instance allowing for shared index maintenance.…

on Building a new database management system in academia (2017)

0

Jun 16, 2023

If you are excited about these data structures you might be interested in my new database engine using prolly trees and designed to be used by React developers. Blog: https://fireproof.storage/posts/from-mlops-to-point-of-sale:... React hook: https://use-fireproof.com

on Merklizing the key/value store for fun and profit

0

Jun 11, 2023

Show HN: ChatGPT Expert Builders for React

1

May 31, 2023

README

Fireproof logo Fireproof database API

Package size Build status

Fireproof is a lightweight embedded document database with encrypted live sync, designed to make browser apps easy. Use it in any JavaScript environment with a unified API that works both in React (with hooks) and as a standalone core API.

Point AI coders to these docs.

Key Features

  • Apps run anywhere: Bundle UI, data, and logic in one file.
  • Real-Time & Offline-First: Automatic persistence and live queries, runs in the browser - no loading or error states.
  • Unified API: TypeScript works with Deno, Bun, Node.js, and the browser.
  • React Hooks: Leverage useLiveQuery and useDocument for live collaboration.

Fireproof enforces cryptographic causal consistency and ledger integrity using hash history, providing git-like versioning with lightweight blockchain-style verification. Data is stored and replicated as content-addressed encrypted blobs, making it safe and easy to sync via commodity object storage providers.

Installation

The use-fireproof package provides both the core API and React hooks:

npm install use-fireproof

Works with ⚡️ ESM.sh:

import { useFireproof } from "https://esm.sh/use-fireproof";

Or install the core ledger in any JavaScript environment:

npm install @fireproof/core

Add the ledger to any web page via HTML script tag (global is Fireproof):

<script src="https://cdn.jsdelivr.net/npm/@fireproof/core/dist/browser/fireproof.global.js"></script>

Deliver generated solutions as runnable micro applications via ChatGPT Canvas, v0, bolt.new, or Claude Artifacts. Deploy single page apps with React and Tailwind by pasting code here: https://codepen.io/useFireproof/pen/MYgNYdx

⚛️ React Usage

React hooks are the recommended way to use Fireproof in LLM code generation contexts:

import { useFireproof } from "use-fireproof";

function App() {
  const { database, useLiveQuery, useDocument } = useFireproof("my-ledger");

  // Create a new document with useDocument
  const { doc, merge, submit } = useDocument({ text: "" });

  // Query documents by _id, most recent first
  const { docs } = useLiveQuery("_id", { descending: true, limit: 100 });

  return (
    <div>
      <form onSubmit={submit}>
        <input value={doc.text} onChange={(e) => merge({ text: e.target.value })} placeholder="New document" />
        <button type="submit">Submit</button>
      </form>

      <h3>Recent Documents</h3>
      <ul>
        {docs.map((doc) => (
          <li key={doc._id}>{doc.text}</li>
        ))}
      </ul>
    </div>
  );
}

Read the step-by-step React tutorial to get started or check the full LLM documentation for more examples.

Working with Images

Fireproof makes it easy to store and display images in your applications. The _files property and ImgFile component handle all the complexities of file storage and retrieval:

// Store an image from a file input
function handleFileUpload(e) {
  if (e.target.files[0]) {
    merge({
      _files: { profilePic: e.target.files[0] },
      uploadedAt: new Date().toISOString(),
    });
  }
}

// Display an image from a document
function ImageDisplay({ doc }) {
  return (
    <div>
      {doc._files?.profilePic && (
        <ImgFile file={doc._files.profilePic} alt="Profile picture" onLoad={() => console.log("Image loaded")} />
      )}
      <p>Uploaded: {doc.uploadedAt}</p>
    </div>
  );
}

The ImgFile component automatically handles loading and displaying images from Fireproof's storage, with all the expected props of a standard image element. For more in-depth examples see our llms-full.txt documentation.

JavaScript Core API

The document database API will feel familiar to those who have used other document databases:

import { fireproof } from "@fireproof/core";

const db = fireproof("music-app");

await db.put({ _id: "beyonce", name: "Beyoncé", hitSingles: 29 });

db.subscribe(async () => {
  const topArtists = await db.query("hitSingles", { range: [30, Infinity] });
  // redraw the UI with the new topArtists
});

const beyonceDoc = await db.get("beyonce");
beyonceDoc.hitSingles += 1;
await db.put(beyonceDoc);

Why choose Fireproof

Compared to other embedded databases, Fireproof:

  • Is network aware, encrypted, and multi-writer safe
  • Is designed for real-time collaboration with CRDTs
  • Offers cryptographic causal integrity for all operations
  • Is built for the web, with a small package size and no wasm

Deliver interactive experiences without waiting on the backend. Fireproof runs in any cloud, browser, or edge environment, so your application can access data anywhere.

Use cases

Fireproof is especially useful for:

  • AI-generated apps and rapid prototypes
  • Collaborative editing
  • Offline and local-first apps
  • Personalization and configuration
  • AI copilot safety

With Fireproof, you build first and sync via your cloud of choice when you are ready, making it perfect for LLM code generation contexts and rapid development.

Get the latest roadmap updates on our blog or join our Discord to collaborate. Read the docs to learn more about the architecture.

Debug

to control the log output you an either use the FP_DEBUG environment variable or set the debug level in your code:

FP_DEBUG='*' node myapp.js
logger.setDebug(...moduleNameList or '*')

if you are in the browser you can use the following code to set the debug level:

this[Symbol.for("FP_ENV")].set("FP_DEBUG", "*");
// vitest pass env
globalThis[Symbol.for("FP_PRESET_ENV")] = {
  FP_DEBUG: "*",
};

Testing

To run the full test suite across all projects (tested storage gateways configs), run:

pnpm run test

To run tests for specific components or modules, use the following command pattern:

pnpm run test -t 'test name pattern' path/to/test/file

For example, to run a specific test for the CRDT module, in just one project:

FP_DEBUG='Loader,CRDTClock' pnpm run test --project file -t 'codec implict iv' crdt

For testing React components, you can use:

pnpm run test tests/react/[ComponentName].test.tsx

Example for testing the ImgFile component:

pnpm run test tests/react/ImgFile.test.tsx

Log Formatting

It's possible to change the logformat by setting FP_FORMAT to:

  • jsonice makes the log output in multiline json
  • yaml makes the log output in yaml
  • json makes the log output in singleline json (default)

KeyBag

If you add extractKey with the value _deprecated_internal_api to the FP_STORAGE_URL url you can bypass the security check to extract the key material. This is the default configuration, but there is a warning emitted if you use this feature, and roadmap plans for more secure key management.

Deno

Fireproof is compatible with Deno. To runit in Deno you need to add the following flags:

Currently the tests are not run with deno -- TODO

It might be that using our provided deno.json is somekind of odd --- TODO is to add fireproof to jsr and deno.land

deno run --config node_modules/@fireproof/core/deno.json --allow-read --allow-write --allow-env --unstable-sloppy-imports ./node-test.ts

Create Docs

Caution it will be pushed directly

pnpm run build:docs

Thanks 🙏

Fireproof is a synthesis of work done by people in the web community over the years. I couldn't even begin to name all the folks who made pivotal contributions. Without npm, React, and VS Code all this would have taken so much longer. Thanks to everyone who supported me getting into ledger development via Apache CouchDB, one of the original document ledgers. The distinguishing work on immutable data-structures comes from the years of consideration IPFS, IPLD, and the Filecoin APIs have enjoyed.

Thanks to Meno Abels who has taken on the role of project lead engineer. Fireproof is rapidly becoming a mature solution.

Thanks to Alan Shaw and Mikeal Rogers without whom this project would have never got started. The core Merkle hash-tree clock is based on Alan's Pail, and you can see the repository history goes all the way back to work begun as a branch of that repo. Mikeal wrote the prolly trees implementation.

Contributing

We love contributions. Feel free to join in the conversation on Discord. All welcome.

License

Dual-licensed under MIT or Apache 2.0

crdt
database
edge
immutable
ipfs
javascript
json
local-first
merkle
npm
p2p
react
state-management

fireproof-storage/fireproof

The vibe coding database runs in the browser, fits in the context window, and syncs anywhere.

TypeScript

977

3,855 commits

updated May 7, 2026

See the code

See what people are saying

SourceMessageScoreDate

Fireproof implements a CRDT and implements E2E. https://use-fireproof.com/docs/welcome/

on CRDTs: Convergence without coordination

0

Oct 23, 2025

We handle this in Fireproof with a deterministic default algorithm, in addition to having a hash-based tamperproof ledger of changes. Fireproof is not SQL based, it is more like CouchDB or MongoDB, but with cryptographic integrity. Apache 2.0 https://use-fireproof.com In practice during CouchDB's…

on CRDT and SQLite: Local-First Value Synchronization

0

Oct 13, 2025

Looks very cool. Have been developing something similar (local first data tooling) for a project of my own. The one thing stopping me from swapping my incomplete implementation with this is that I am unable to find how to connect to a db I control. In another thread you self described your backend…

on Show HN: Fireproof – local-first database with Git-like encrypted sync

0

Nov 19, 2024

The best starter is the React Tutorial in our docs: https://use-fireproof.com/docs/react-tutorial/ We are updating this example to the latest right now, it shows how team chat can be implemented with database sharing. https://github.com/fireproof-storage/firehouse-chat This drum machine is pretty…

on Show HN: Fireproof – local-first database with Git-like encrypted sync

0

Nov 19, 2024

Fireproof https://use-fireproof.com/ Pure JS embedded Document DB, no setup or config. e2e encryption, CRDT support. Build, prototype, iterate without a backend, plug into any cloud when you’re ready [disclaimer: I’m part of the team working on this]

on Ask HN: What underrated open source project deserves more recognition?

0

Mar 18, 2024

If you want to read about another implementation using Merkle CRDTs for practical local-first document database storage, I've been building a new database for about a year. I plan to share more but it's definitely an example of a Merkle CRDT, inspired by a lot of the same research in the Dolt…

on Trade-offs between Different CRDTs

0

Jan 9, 2024

Architecture – Fireproof distributed real-time database

2

Oct 17, 2023

I am building a new immutable cryptographically verified database using IPLD data structures and prolly trees. This allows changes made anywhere to be transparently synced, and for operations to be commuted amongst untrusted peers, for instance allowing for shared index maintenance.…

on Building a new database management system in academia (2017)

0

Jun 16, 2023

If you are excited about these data structures you might be interested in my new database engine using prolly trees and designed to be used by React developers. Blog: https://fireproof.storage/posts/from-mlops-to-point-of-sale:... React hook: https://use-fireproof.com

on Merklizing the key/value store for fun and profit

0

Jun 11, 2023

Show HN: ChatGPT Expert Builders for React

1

May 31, 2023

README

Fireproof logo Fireproof database API

Package size Build status

Fireproof is a lightweight embedded document database with encrypted live sync, designed to make browser apps easy. Use it in any JavaScript environment with a unified API that works both in React (with hooks) and as a standalone core API.

Point AI coders to these docs.

Key Features

  • Apps run anywhere: Bundle UI, data, and logic in one file.
  • Real-Time & Offline-First: Automatic persistence and live queries, runs in the browser - no loading or error states.
  • Unified API: TypeScript works with Deno, Bun, Node.js, and the browser.
  • React Hooks: Leverage useLiveQuery and useDocument for live collaboration.

Fireproof enforces cryptographic causal consistency and ledger integrity using hash history, providing git-like versioning with lightweight blockchain-style verification. Data is stored and replicated as content-addressed encrypted blobs, making it safe and easy to sync via commodity object storage providers.

Installation

The use-fireproof package provides both the core API and React hooks:

npm install use-fireproof

Works with ⚡️ ESM.sh:

import { useFireproof } from "https://esm.sh/use-fireproof";

Or install the core ledger in any JavaScript environment:

npm install @fireproof/core

Add the ledger to any web page via HTML script tag (global is Fireproof):

<script src="https://cdn.jsdelivr.net/npm/@fireproof/core/dist/browser/fireproof.global.js"></script>

Deliver generated solutions as runnable micro applications via ChatGPT Canvas, v0, bolt.new, or Claude Artifacts. Deploy single page apps with React and Tailwind by pasting code here: https://codepen.io/useFireproof/pen/MYgNYdx

⚛️ React Usage

React hooks are the recommended way to use Fireproof in LLM code generation contexts:

import { useFireproof } from "use-fireproof";

function App() {
  const { database, useLiveQuery, useDocument } = useFireproof("my-ledger");

  // Create a new document with useDocument
  const { doc, merge, submit } = useDocument({ text: "" });

  // Query documents by _id, most recent first
  const { docs } = useLiveQuery("_id", { descending: true, limit: 100 });

  return (
    <div>
      <form onSubmit={submit}>
        <input value={doc.text} onChange={(e) => merge({ text: e.target.value })} placeholder="New document" />
        <button type="submit">Submit</button>
      </form>

      <h3>Recent Documents</h3>
      <ul>
        {docs.map((doc) => (
          <li key={doc._id}>{doc.text}</li>
        ))}
      </ul>
    </div>
  );
}

Read the step-by-step React tutorial to get started or check the full LLM documentation for more examples.

Working with Images

Fireproof makes it easy to store and display images in your applications. The _files property and ImgFile component handle all the complexities of file storage and retrieval:

// Store an image from a file input
function handleFileUpload(e) {
  if (e.target.files[0]) {
    merge({
      _files: { profilePic: e.target.files[0] },
      uploadedAt: new Date().toISOString(),
    });
  }
}

// Display an image from a document
function ImageDisplay({ doc }) {
  return (
    <div>
      {doc._files?.profilePic && (
        <ImgFile file={doc._files.profilePic} alt="Profile picture" onLoad={() => console.log("Image loaded")} />
      )}
      <p>Uploaded: {doc.uploadedAt}</p>
    </div>
  );
}

The ImgFile component automatically handles loading and displaying images from Fireproof's storage, with all the expected props of a standard image element. For more in-depth examples see our llms-full.txt documentation.

JavaScript Core API

The document database API will feel familiar to those who have used other document databases:

import { fireproof } from "@fireproof/core";

const db = fireproof("music-app");

await db.put({ _id: "beyonce", name: "Beyoncé", hitSingles: 29 });

db.subscribe(async () => {
  const topArtists = await db.query("hitSingles", { range: [30, Infinity] });
  // redraw the UI with the new topArtists
});

const beyonceDoc = await db.get("beyonce");
beyonceDoc.hitSingles += 1;
await db.put(beyonceDoc);

Why choose Fireproof

Compared to other embedded databases, Fireproof:

  • Is network aware, encrypted, and multi-writer safe
  • Is designed for real-time collaboration with CRDTs
  • Offers cryptographic causal integrity for all operations
  • Is built for the web, with a small package size and no wasm

Deliver interactive experiences without waiting on the backend. Fireproof runs in any cloud, browser, or edge environment, so your application can access data anywhere.

Use cases

Fireproof is especially useful for:

  • AI-generated apps and rapid prototypes
  • Collaborative editing
  • Offline and local-first apps
  • Personalization and configuration
  • AI copilot safety

With Fireproof, you build first and sync via your cloud of choice when you are ready, making it perfect for LLM code generation contexts and rapid development.

Get the latest roadmap updates on our blog or join our Discord to collaborate. Read the docs to learn more about the architecture.

Debug

to control the log output you an either use the FP_DEBUG environment variable or set the debug level in your code:

FP_DEBUG='*' node myapp.js
logger.setDebug(...moduleNameList or '*')

if you are in the browser you can use the following code to set the debug level:

this[Symbol.for("FP_ENV")].set("FP_DEBUG", "*");
// vitest pass env
globalThis[Symbol.for("FP_PRESET_ENV")] = {
  FP_DEBUG: "*",
};

Testing

To run the full test suite across all projects (tested storage gateways configs), run:

pnpm run test

To run tests for specific components or modules, use the following command pattern:

pnpm run test -t 'test name pattern' path/to/test/file

For example, to run a specific test for the CRDT module, in just one project:

FP_DEBUG='Loader,CRDTClock' pnpm run test --project file -t 'codec implict iv' crdt

For testing React components, you can use:

pnpm run test tests/react/[ComponentName].test.tsx

Example for testing the ImgFile component:

pnpm run test tests/react/ImgFile.test.tsx

Log Formatting

It's possible to change the logformat by setting FP_FORMAT to:

  • jsonice makes the log output in multiline json
  • yaml makes the log output in yaml
  • json makes the log output in singleline json (default)

KeyBag

If you add extractKey with the value _deprecated_internal_api to the FP_STORAGE_URL url you can bypass the security check to extract the key material. This is the default configuration, but there is a warning emitted if you use this feature, and roadmap plans for more secure key management.

Deno

Fireproof is compatible with Deno. To runit in Deno you need to add the following flags:

Currently the tests are not run with deno -- TODO

It might be that using our provided deno.json is somekind of odd --- TODO is to add fireproof to jsr and deno.land

deno run --config node_modules/@fireproof/core/deno.json --allow-read --allow-write --allow-env --unstable-sloppy-imports ./node-test.ts

Create Docs

Caution it will be pushed directly

pnpm run build:docs

Thanks 🙏

Fireproof is a synthesis of work done by people in the web community over the years. I couldn't even begin to name all the folks who made pivotal contributions. Without npm, React, and VS Code all this would have taken so much longer. Thanks to everyone who supported me getting into ledger development via Apache CouchDB, one of the original document ledgers. The distinguishing work on immutable data-structures comes from the years of consideration IPFS, IPLD, and the Filecoin APIs have enjoyed.

Thanks to Meno Abels who has taken on the role of project lead engineer. Fireproof is rapidly becoming a mature solution.

Thanks to Alan Shaw and Mikeal Rogers without whom this project would have never got started. The core Merkle hash-tree clock is based on Alan's Pail, and you can see the repository history goes all the way back to work begun as a branch of that repo. Mikeal wrote the prolly trees implementation.

Contributing

We love contributions. Feel free to join in the conversation on Discord. All welcome.

License

Dual-licensed under MIT or Apache 2.0

crdt
database
edge
immutable
ipfs
javascript
json
local-first
merkle
npm
p2p
react
state-management

Significant stargazers

CL Kao

807 followers · starred Sep 2025

Brian Douglas

2,525 followers · starred May 2025

Jani Eväkallio

1,243 followers · starred Oct 2023

Mathias Biilmann

663 followers · starred Apr 2024