
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@fireproof/core
Advanced tools
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.
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.
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 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.
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);
Compared to other embedded databases, Fireproof:
Deliver interactive experiences without waiting on the backend. Fireproof runs in any cloud, browser, or edge environment, so your application can access data anywhere.
Fireproof is especially useful for:
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.
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: "*",
};
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 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
It's possible to change the logformat by setting FP_FORMAT to:
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.
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
Caution it will be pushed directly
pnpm run build:doc
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 database development via Apache CouchDB, one of the original document databases. The distinguishing work on immutable data-structures comes from the years of consideration IPFS, IPLD, and the Filecoin APIs have enjoyed.
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.
We love contributions. Feel free to join in the conversation on Discord. All welcome.
Dual-licensed under MIT or Apache 2.0
FAQs
Live database for the web.
The npm package @fireproof/core receives a total of 354 weekly downloads. As such, @fireproof/core popularity was classified as not popular.
We found that @fireproof/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.