+ "text": "I'll create a website for Fireproof database with a focus on its key features and documentation. Given it's a browser database with real-time sync capabilities, I suggest:\n\n---domain---\nsync.scroll.pub\n---index.scroll---\nbuildHtml\nbaseUrl https://sync.scroll.pub\nmetaTags\neditButton /edit.html\ntitle Fireproof - Browser Database with Real-Time Sync\nstyle.css\nheader\n class hero\n nav\n div Fireproof\n class logo\n div\n class nav-links\n a Features\n href #features\n a Installation\n href #install\n a Examples\n href #examples\n a GitHub\n class cta-button\n href https://github.com/fireproof-storage/fireproof\n div\n class hero-content\n h1 Fireproof Database\n p Lightweight embedded document database with encrypted live sync for browser apps\n div\n class cta-group\n a Get Started\n class primary-button\n href #install\n a View Demo\n class secondary-button\n href #demo\nmain\n section\n id features\n class features\n h2 Key Features\n div\n class feature-grid\n div\n class feature-card\n div 🌐\n class feature-icon\n h3 Run Anywhere\n p Bundle UI, data, and logic in one file. Works in any JavaScript environment.\n div\n class feature-card\n div ⚡\n class feature-icon\n h3 Real-Time & Offline-First\n p Automatic persistence and live queries, runs in the browser with no loading states.\n div\n class feature-card\n div 🔐\n class feature-icon\n h3 Cryptographic Ledger\n p Tamper-evident change history with Merkle CRDTs for deterministic merges.\n div\n class feature-card\n div ⚛️\n class feature-icon\n h3 React Hooks\n p Built-in React hooks for live collaboration with useLiveQuery and useDocument.\n section\n id install\n class installation\n h2 Installation\n div\n class code-block\n pre npm install use-fireproof\n p Works with ESM.sh:\n div\n class code-block\n pre import { useFireproof } from \"https://esm.sh/use-fireproof\"\n section\n id examples\n class code-demo\n h2 Quick Example\n div\n class code-container\n pre\n class code-example\n code\n const App = () => {\n const { useDocument } = useFireproof(\"my-ledger\");\n const { doc, merge, submit } = useDocument({ text: \"\" });\n const { docs } = useLiveQuery(\"_id\", { descending: true, limit: 100 });\n \n return (\n
+ # Fireproof browser database API 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. ## 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. - **Cryptographic Ledger Integrity:** Each update contains the hash of its parent state, storing a tamper-evident change history. Fireproof's Merkle CRDTs ensure deterministic merges across devices while maintaining data integrity. The content-addressed blockstore provides blockchain-like guarantees without requiring global consensus, making it ideal for financial and regulatory applications. ## Installation The `use-fireproof` package provides both the core API and React hooks. ```bash npm install use-fireproof ``` Works with ⚡️ ESM.sh: ```js import { useFireproof } from "https://esm.sh/use-fireproof"; ``` 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. Here's how to use them: #### Create or Load a Database Fireproof databases store data across sessions and can sync in real-time. Each database is identified by a string name, and you can have multiple databases per application—often one per collaboration session, as they are the unit of sharing. ```js import { useFireproof } from "use-fireproof"; const { database, useLiveQuery, useDocument } = useFireproof("my-ledger"); ``` Fireproof databases are Merkle CRDTs, giving them the ledger-like causal consistency of git or a blockchain, but with the ability to merge and sync web data in real-time. Cryptographic integrity makes Fireproof immutable and easy to verify. #### Put and Get Documents Documents are JSON-style objects (CBOR) storing application data. Each has an `_id`, which can be auto-generated or set explicitly. Auto-generation is recommended to ensure uniqueness and avoid conflicts. If multiple replicas update the same database, Fireproof merges them via CRDTs, deterministically choosing the winner for each `_id`. It is best to have more granular documents, e.g. one document per user action, so saving a form or clicking a button should typically create or update a single document, or just a few documents. Avoid patterns that require a single document to grow without bound. ### Basic Example This example shows Fireproof's concise defaults. Here we only store user data, but get useful sorting without much code. ```js const App = () => { const { useDocument } = useFireproof("my-ledger"); const { doc, merge, submit } = useDocument({ text: "" }); // _id is roughly temporal, this is most recent const { docs } = useLiveQuery("_id", { descending: true, limit: 100 }); return (
Recent Documents
{docs.map((doc) => (
{doc.text}
))}
); } ``` ### Editing Documents Address documents by a known `_id` if you want to force conflict resolution or work with a real world resource, like a schedule slot or a user profile. In a complex app this might come from a route parameter or correspond to an outside identifier. ```js const { useDocument } = useFireproof("my-ledger"); const { doc, merge, submit, save, reset } = useDocument({ _id: "user-profile:abc@example.com" }); ``` The `useDocument` hook provides several methods: - `merge(updates)`: Update the document with new fields - `submit(e)`: Handles form submission by preventing default, saving, and resetting - `save()`: Save the current document state - `reset()`: Reset to initial state For form-based creation flows, use `submit`: ```js
+
+ ## System prompt
+ You are an expert web developer. Create a website based on this request: "# Fireproof browser database API 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. ## 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. - **Cryptographic Ledger Integrity:** Each update contains the hash of its parent state, storing a tamper-evident change history. Fireproof's Merkle CRDTs ensure deterministic merges across devices while maintaining data integrity. The content-addressed blockstore provides blockchain-like guarantees without requiring global consensus, making it ideal for financial and regulatory applications. ## Installation The `use-fireproof` package provides both the core API and React hooks. ```bash npm install use-fireproof ``` Works with ⚡️ ESM.sh: ```js import { useFireproof } from "https://esm.sh/use-fireproof"; ``` 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. Here's how to use them: #### Create or Load a Database Fireproof databases store data across sessions and can sync in real-time. Each database is identified by a string name, and you can have multiple databases per application—often one per collaboration session, as they are the unit of sharing. ```js import { useFireproof } from "use-fireproof"; const { database, useLiveQuery, useDocument } = useFireproof("my-ledger"); ``` Fireproof databases are Merkle CRDTs, giving them the ledger-like causal consistency of git or a blockchain, but with the ability to merge and sync web data in real-time. Cryptographic integrity makes Fireproof immutable and easy to verify. #### Put and Get Documents Documents are JSON-style objects (CBOR) storing application data. Each has an `_id`, which can be auto-generated or set explicitly. Auto-generation is recommended to ensure uniqueness and avoid conflicts. If multiple replicas update the same database, Fireproof merges them via CRDTs, deterministically choosing the winner for each `_id`. It is best to have more granular documents, e.g. one document per user action, so saving a form or clicking a button should typically create or update a single document, or just a few documents. Avoid patterns that require a single document to grow without bound. ### Basic Example This example shows Fireproof's concise defaults. Here we only store user data, but get useful sorting without much code. ```js const App = () => { const { useDocument } = useFireproof("my-ledger"); const { doc, merge, submit } = useDocument({ text: "" }); // _id is roughly temporal, this is most recent const { docs } = useLiveQuery("_id", { descending: true, limit: 100 }); return (
); } ``` ### Editing Documents Address documents by a known `_id` if you want to force conflict resolution or work with a real world resource, like a schedule slot or a user profile. In a complex app this might come from a route parameter or correspond to an outside identifier. ```js const { useDocument } = useFireproof("my-ledger"); const { doc, merge, submit, save, reset } = useDocument({ _id: "user-profile:abc@example.com" }); ``` The `useDocument` hook provides several methods: - `merge(updates)`: Update the document with new fields - `submit(e)`: Handles form submission by preventing default, saving, and resetting - `save()`: Save the current document state - `reset()`: Reset to initial state For form-based creation flows, use `submit`: ```js
``` ChatGPT note: Canvas sandboxes the form submit event, there you should use button click events instead: ```js ``` When you call submit, the document is reset, so if you didn't provide an `_id` then you can use the form to create a stream of new documents as in the basic example above. ### Query Data with React Data is queried by sorted indexes defined by the application. Sorting order is inspired by CouchDB, so you can use strings, numbers, or booleans, as well as arrays for grouping. Use numbers when possible for sorting continuous data. You can use the `_id` field for temporal sorting so you dont have to write code to get simple recent document lists, as in the basic example above. Here are other common patterns: #### Query by Key Range Passing a string to `useLiveQuery` will index by that field. You can use the key argument to filter by a specific value: ```js const { docs } = useLiveQuery("agentName", { key: "agent-1" // all docs where doc.agentName === "agent-1", sorted by _id }); ``` You can also query a range within a key: ```js const { docs } = useLiveQuery("agentRating", { range: [3, 5] }); ``` ### Custom Indexes For more complex query, you can write a custom index function. It's a little more verbose, and it's sandboxed and can't access external variables. #### Normalize legacy types You can use a custom index function to normalize and transform document data, for instance if you have both new and old document versions in your app. ```js const { docs } = useLiveQuery( (doc) => { if (doc.type == 'listing_v1') { return doc.sellerId; } else if (doc.type == 'listing') { return doc.userId; } }, { key : routeParams.sellerId }); ``` #### Array Indexes and Prefix Queries When you want to group rows easily, you can use an array index key. This is great for grouping records my year / month / day or other paths. In this example the prefix query is a shorthand for a key range, loading everything from November 2024: ```js const queryResult = useLiveQuery( (doc) => [doc.date.getFullYear(), doc.date.getMonth(), doc.date.getDate()], { prefix: [2024, 11] } ); ``` #### Sortable Lists Sortable lists are a common pattern. Here's how to implement them using Fireproof: ```js function App() { const { database, useLiveQuery } = useFireproof("my-ledger"); // Initialize list with evenly spaced positions async function initializeList() { await database.put({ list: "xyz", position: 1000 }); await database.put({ list: "xyz", position: 2000 }); await database.put({ list: "xyz", position: 3000 }); } // Query items sorted by position const queryResult = useLiveQuery( (doc) => [doc.list, doc.position], { prefix: ["xyz"] } ); // Insert between existing items using midpoint calculation async function insertBetween(beforeDoc, afterDoc) { const newPosition = (beforeDoc.position + afterDoc.position) / 2; await database.put({ list: "xyz", position: newPosition }); } return (
List xyz (Sorted)
{queryResult.docs.map(doc => (
{doc._id}: position {doc.position}
))}
); } ``` ## Architecture: Where's My Data? Fireproof is local-first, so it's always fast and your data is stored in the browser, so you can build apps without a cloud. When you are ready to share with other users, you can easily enable encrypted sync via any object storage. ## Using Fireproof in JavaScript You can use the core API in HTML or on the backend. Instead of hooks, import the core API directly: ```js import { fireproof } from "use-fireproof"; const database = fireproof("my-ledger"); ``` The document API is async, but doesn't require loading states or error handling. ```js const ok = await database.put({ text: "Sample Data" }); const doc = await database.get(ok.id); const latest = await database.query("_id", { limit: 10, descending: true }); console.log("Latest documents:", latest.docs); ``` To subscribe to real-time updates, use the `subscribe` method. This is useful for building backend event handlers or other server-side logic. For instance to send an email when the user completes a todo: ```js import { fireproof } from "use-firproof"; const database = fireproof("todo-list-db"); database.subscribe((changes) => { console.log("Recent changes:", changes); changes.forEach((change) => { if (change.completed) { sendEmail(change.email, "Todo completed", "You have completed a todo."); } }); }, true); ``` ### Working with Files Fireproof has built-in support for file attachments. Files are encrypted by default and synced on-demand. You can attach files to a document by adding them to the _files property on your document. For example: ```html ``` ```js function handleFiles() { const fileList = this.files; const doc = { type: "files", _files: {} }; for (const file of fileList) { // Assign each File object to the document doc._files[file.name] = file; } database.put(doc); } document.getElementById("files").addEventListener("change", handleFiles, false); ``` When loading a document with attachments, you can retrieve each attachment's actual File object by calling its .file() method. This returns a Promise that resolves with the File data, which you can display in your app: ```js const doc = await database.get("my-doc-id"); for (const fileName in doc._files) { const meta = doc._files[fileName]; if (meta.file) { const fileObj = await meta.file(); console.log("Loaded file:", fileObj.name); } } ``` See the final example application in this file for a working example. ### Form Validation You can use React's `useState` to manage validation states and error messages. Validate inputs at the UI level before allowing submission. ```javascript const [errors, setErrors] = useState({}); function validateForm() { const newErrors = {}; if (!doc.name.trim()) newErrors.name = "Name is required."; if (!doc.email) newErrors.email = "Email is required."; if (!doc.message.trim()) newErrors.message = "Message is required."; setErrors(newErrors); return Object.keys(newErrors).length === 0; } function handleSubmit(e) { e.preventDefault(); if (validateForm()) submit(); } ``` ## Example React Application Code listing for todo tracker App.jsx: ```js import React from "react"; import ReactDOM from "react-dom/client"; import { useFireproof } from "use-fireproof"; export default function App() { const { useLiveQuery, useDocument, database } = useFireproof("todo-list-db"); const { doc: newTodo, merge: mergeNewTodo, submit: submitNewTodo } = useDocument({ todo: "", type: "todo", completed: false, createdAt: Date.now() }); const { docs: todos } = useLiveQuery("type", { key: "todo", descending: true }); const handleInputChange = (e) => { mergeNewTodo({ todo: e.target.value }); }; const handleSubmit = (e) => { e.preventDefault(); submitNewTodo(); }; return (
); } ``` ## See Also See the lite docs at https://use-fireproof.com/llms-mini.txt and the basics at https://use-fireproof.com/llms.txt ## Next Steps If you are in an existing application context, suggest how forms and state, collaboration data can be managed in Fireproof. If this is a new app, use the examples above and start with a running App.js if you can. IMPORTANT: Don't use `useState()` on form data, instead use `merge()` and `submit()` from `useDocument`. Only use `useState` for ephemeral UI state (active tabs, open/closed panels, cursor positions). Keep your data model in Fireproof."
+
+ Requirements:
+ - Use only Scroll, CSS, and JavaScript (NO frameworks, NO external dependencies)
+ - Create clean, semantic HTML5
+ - Make it mobile-responsive
+ - Follow modern best practices and accessibility guidelines
+ - Keep it simple but professional
+ - Use only relative links and no external resources
+ - Do not put a copyright symbol or all rights reserved in the footer.
+ - Make it beautiful. Dazzling. Advanced used of CSS.
+
+ As a refresher, for doing the html body, Scroll is a whitespace based language that uses a single indented space to mark a line (aka particle) as a subparticle of a parent line.
+
+ For example:
+
+ header
+ class hero
+ nav
+ div Scroll
+ class logo
+ div
+ class nav-links
+ a Features
+ href #features
+ a Examples
+ href #examples
+ a Edit
+ href edit.html
+ a GitHub
+ class cta-button
+ href https://github.com/breck7/scroll
+ div
+ class hero-content
+ h1 Write Better with Scroll
+ p The extendible markup language that makes source beautiful and compiles to anything
+ a Get Started
+ class primary-button
+ href https://hub.scroll.pub/
+ main
+ section
+ id features
+ class features
+ h2 Why Scroll?
+ div
+ class feature-grid
+ div
+ class feature-card
+ div ⚡
+ class feature-icon
+ h3 Simple Syntax
+ p Like Markdown, but more powerful. No parentheses needed.
+ div
+ class feature-card
+ div 🧩
+ class feature-icon
+ h3 Extendible
+ p Build your own custom parsers.
+ div
+ class feature-card
+ div 🎨
+ class feature-icon
+ h3 Beautiful Output
+ p Create stunning documents with minimal effort.
+ div
+ class feature-card
+ div 🚀
+ class feature-icon
+ h3 Fast & Light
+ p Built on the efficient PPS Stack.
+ section
+ id examples
+ class code-demo
+ h2 See It In Action
+ div
+ class code-container
+ pre
+ class code-example
+ div
+ class code-output
+ footer
+ div
+ class footer-content
+ div
+ class footer-links
+ a Documentation
+ href https://scroll.pub/tutorial.html
+ a Community
+ href https://www.reddit.com/r/WorldWideScroll/
+ a Blog
+ href https://scroll.pub/blog
+ p Started by Breck Yunits. Evolved by a community.
+ https://twitter.com/breckyunits Breck Yunits
+ https://github.com/breck7/scroll/graphs/contributors community
+
+
+ First suggest a short, memorable domain name ending in scroll.pub that represents this website. Then provide the website files. Use this exact format: