# Why Hyperclay Local

> Keep your malleable documents as plain HTML files on your computer, served locally so they can save themselves and synced with hyperclay.com when you want.

Source: https://hyperclaylocal.com/docs/why/

Hyperclay Local exists so your [malleable documents](https://hyperclaylocal.com/docs/making-malleable-documents/) can live as plain `.html` and `.htmlclay` files on your computer, save their own changes to disk, and sync with [hyperclay.com](https://hyperclay.com/docs/) when you want them to.

## A file that remembers

An HTML file can lay out an interface, run JavaScript, and respond to every click and keystroke. Opened directly from disk, however, the browser sandbox blocks the page from writing its changes back to the file. Close the tab and every edit is gone.

Hyperclay Local runs a small local server on your computer with a save endpoint (`POST /_/save`; see [How it works](https://hyperclaylocal.com/docs/how-it-works/) and [Saving and stale-write protection](https://hyperclaylocal.com/docs/saving/)). When you edit a document in the [workspace window](https://hyperclaylocal.com/docs/guide/workspace/) or in your browser, the page serializes its updated DOM and posts it to the local server, which writes the file to disk and keeps the previous version in `.hyperclay/versions/` as a backup.

Because the interface, logic, and data all live inside that single HTML file, the file itself is the complete document. You can inspect it with View Source, open it in any text editor, commit it to Git, back it up with your regular backup tools, or export it as a zip with its attachments (see [Export as zip](https://hyperclaylocal.com/docs/export/)).

## Compared to static files, localStorage, and a backend

- **A static file cannot save itself**: opening an `.html` file over `file://` loses every edit on refresh. Hyperclay Local serves the folder on `localhost` so the document can save its changes back to disk.
- **`localStorage` traps data inside one browser**: data stored in `localStorage` or `IndexedDB` stays locked inside a single browser profile, separate from the HTML file, and disappears if browser storage is cleared. In a malleable document, the data is stored in the HTML file on disk.
- **No backend or build step to maintain**: you do not need to run a database, configure a bundler, or manage a remote server to use your own documents. Even [Tailwind CSS](https://hyperclaylocal.com/docs/tailwind/) compiles automatically on save when a document links `/tailwindcss/<name>.css`.

## Local first, synced when you want

Everything in Hyperclay Local works offline with no account required (see [Offline behavior and privacy](https://hyperclaylocal.com/docs/offline/)):

- Your personal folder and [team folders](https://hyperclaylocal.com/docs/guide/team-folders/) are regular folders inside your home directory.
- Every save keeps a local version backup on disk (see [Recover from backups](https://hyperclaylocal.com/docs/guide/backups/)).
- Scripts and command-line tools on your machine can read and update documents through the [JSON data API](https://hyperclaylocal.com/docs/data-api/) or edit sections in place with [AI editing](https://hyperclaylocal.com/docs/guide/ai-editing/).
- Local editing sends no analytics or telemetry; the only background network request when sync is off is the periodic update check (see [Updates](https://hyperclaylocal.com/docs/updates/)).

When you want to publish a document on the web, share it, or work with a team on hyperclay.com, you can connect a sync key and turn on [Sync with hyperclay.com](https://hyperclaylocal.com/docs/guide/sync/). Sync is off by default, your sync key is encrypted with your operating system's credential store, and your local folders keep serving and saving even when sync is paused, disconnected, or offline.

## Core principles

- **Own your stack**: No vendor lock-in. Keep your documents as plain files on your computer and run them anywhere.
- **Malleable**: Your HTML documents modify themselves in the browser and save changes straight to disk.
- **Shareable**: When synced with hyperclay.com, send a link so others can view, edit, or clone your document.
- **Standard web platform**: Built on standard HTML, CSS, and JavaScript with [ClayJS](https://clayjs.com/docs/), with no proprietary framework required.
