import { Fireproof } from '@fireproof/core'
const database = Fireproof.storage("my-todos");
const ok = await database.put({
type: 'todo',
title: 'try the useFireproof() hook',
completed: false
});
const doc = await database.get(ok.id);
console.log(doc.type, doc.completed); // 'todo', false
Quickly add dynamic data to any app or page.
npm install @fireproof/core
Quick Start
// npm install @fireproof/core
import { Fireproof } from '@fireproof/core'
const fireproof = Fireproof.storage()
const ok = await fireproof.put({ hello: 'world' })
const doc = await fireproof.get(ok.id)
// 🤫 window.fireproof = fireproof // for dev
Drop this in app.js or app.tsx and go!
Adopting tools that prioritize developer exprience has componding effects — increasing your team's expectations of what they can accomplish, while inculcating a habit of continuous improvement.
Database Features
Fireproof is local-first software, operating directly in the browser and automatically synchronizing with the distributed IPFS storage network. It uses verifiable operations and encrypted, immutable data — making it more reliable than the cloud.
new Index(database, function (doc, map) {
if (doc.type === 'person') {
map(doc.age, doc)
}
})
await index.query({ range: [41, 44] })
Query JSON data with any structure.
Flexible Data
Access your JSON data from any app or website with a simple put, get, and delete interface. Embed, index, and organize files of any size using IPFS links. Handle data variety and schema drift by writing JavaScript functions to define indexes, making it easy to normalize data and simplify indexing and searching. Queries run locally, making Fireproof faster than any cloud database.
Immutable History
MVCC versioning and Merkle causal history tracking ensure that you can always recover the desired version of your data, and query a stable snapshot of the database. Immutable data structures simplify replication and improve performance, while enabling roll back to old data whenever needed, giving you peace of mind knowing your data is secure. Merkle clocks and hash trees are used to provide lossless merging and immutable and self-validating data structures, making replicating changes safe and efficient, and making Fireproof ideal for smart contract and other trustless applications.
const clock = JSON.stringify(fireproof.clock)
// '["bafy...inmu"]'
const database = Fireproof.snapshot(clock)
Add undo to your app! Jump to any point in history.
new Listener(fireproof, (doc, emit) => {
if (doc.name) { emit('person') }
})
listener.on('person', (key) => {
console.log('Person event:', key)
})
Repaint your UI when data changes.
Real-time Updates
Get instant notifications of changes to your data, with real-time updates synced across all devices and apps. Fireproof uses a combination of WebRTC and IPFS to provide fast and efficient real-time updates, giving you real-time access to your data without the need for constant polling or manual refresh. Whether you're building an online collaboration tool, a real-time dashboard, or just want to keep your UI up-to-date in real-time, Fireproof has you covered.
Self-sovereign Identity
With self-sovereign identity users have full control over their personal data and identity, without relying on a central authority. This enables new business models and the creation of apps that serve users first. Fireproof's self-sovereign identity solution is built on industry standards such as Decentralized Identifiers (DIDs) and UCAN. Users can choose to use Fireproof storage services or store data with other backends such as web3.storage, further ensuring the security and sovereignty of their data.
const proof = await Client.delegate({
issuer: alice,
audience: bob.principal,
capabilities: [{
can: 'clock/advance',
with: `${alice.did()}/${bob.did()}/`,
}]
})
UCAN delegation so you are only limited by your imagination.
____
__...---~' `~~~----...__
_===============================
,----------------._/' `---..._______...---'
(_______________||_) . . ,--'
/ /.---' `/
'--------_- - - - - _/
`--------'
Your data is out of this world!
Automatic Replication
Syncing state is as easy as sending a link to the latest database head and Fireproof will handle the rest, ensuring your data is always up-to-date and accessible from any device or browser. Whether you're working from your desktop, laptop, or mobile device, Fireproof ensures that your data is always up-to-date and accessible. Documents changes are persisted to Filecoin via web3.storage and made available over IPFS and a global content delivery network. With automatic replication, you never have to worry about losing important information or manually transferring data between devices.
Cryptographic Proofs
UCAN cryptographic proof chains link updates to authorized agents, ensuring data security and integrity. Portable, signed proofs eliminate the need for secret bearer tokens. Transactions are functional transforms of hash-linked graphs, ensuring data consistency across nodes. Each transaction is a unique immutable hash, enabling efficient data sharing. Cryptographic proofs available for all operations make Fireproof ideal for smart contracts and trustless environments. Proof chains also improve performance by allowing for cryptographic verification of changes.
{
"aud": "did:key:z6MkfQhLHBSi...xpfZeaymgy1zkP2jM",
"att": [{
"with": "wnfs://demouser.fission.name/public/photos/",
"can": "wnfs/OVERWRITE"
}],
"exp": 9256939505,
"iss": "did:key:z6Mkr5aefini...xb2C4YAJwbxt1jFS",
"prf": [
"JQSIseyJhbGcIiOi...xZ7OqOSw0Vg8VCAWEmcO",
"eyJhbGciOiJTQSsI...xZ7WeYV9OqOSw0Vg8VCA"
]
}
Reduce costs and increase trust with cryptographic verifiability.
Experience the Developer Console
Fireproof is free to use and scale. Access advanced features with credit card verification.
Friends of Fireproof
Learn how people are saving costs and innovating with new business models. Fireproof's advanced database capabilities and easy front-end installation make it a tool of choice for early adopters. You know you want to be on the cube! Email the project lead or direct message Fireproof Storage on Twitter to get featured.
J. Chris Anderson
Fireproof creator, previously co-founded Couchbase. Building distributed databases since 2009.
Jonathan Victor
Advisor
Web3 Maven - Protocol Labs
Mikeal Rogers
Advisor
Creator of NodeConf, request, and PouchDB