any

module
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: MIT

README

Any

Any is an open-source, reactive, local-first database for people and LLMs building custom software. Create collaborative apps with control over your data and without the usual burden of backend development and maintenance.

Store documents, run Mongo-style queries, and subscribe to live updates through a local HTTP API. Reads and writes work offline. Changes sync with end-to-end encryption and merge automatically across devices.

Any includes hybrid search, version history, and built-in support for chat and collaborative editing. Its companion runtime, anyrt (anyproto/anybao), runs sandboxed Python programs, scheduled jobs, and an agent harness alongside your data. You choose the models and control your data and agent memory. Read the docs to learn more.

Under the hood, Any brings together:

  • Encrypted multiplayer sync powered by any-sync, battle-tested across millions of spaces over years in production and audited by Cure53.
  • Mongo-style queries and aggregations powered by any-store.
  • Full-text, semantic, and hybrid search, with HNSW and IVF-SQ vector indexes and local embeddings via llama.cpp.
  • Sandboxed execution through anyrt: isolated CPython programs running on Wasmtime, with deterministic traces, fuel control, cron-like schedules, and event subscriptions.

What you can build

  • Collaborative applications: shared documents, chats, and workspaces that people can edit across devices, including offline.
  • Custom knowledge tools: notebooks, project trackers, and searchable collections combining structured data and rich text.
  • Agents and automations: programs that query shared data, preserve memory across sessions, and run on schedules or in response to changes.
  • Multi-agent systems and context engines: agents that share data and memory, with concurrent writes merged instead of overwritten.

How it works

Any runs a local server on each user's device. Applications connect through a localhost HTTP API to store data, run queries, and subscribe to changes. Several applications can share that server: they act as the same account, read and write the same data, and a change made by one reaches the others through their subscriptions.

flowchart TB
    subgraph device["Your device"]
        ui["any-ui<br/>knowledge base"]
        app["your app<br/>vibe-coded<br/>or by hand"]
        rt["anyrt<br/>programs,<br/>schedules"]
        agents["your agents<br/>and scripts"]
        server["any server<br/>local HTTP API<br/>database · sync"]
        ui <--> server
        app <--> server
        rt <--> server
        agents <--> server
    end
    subgraph network[" "]
        peers["other devices<br/>each runs its<br/>own any server"]
        nodes["sync nodes<br/>cannot read<br/>what they relay"]
    end
    server <-- "end-to-end encrypted" --> peers
    server <-- "end-to-end encrypted" --> nodes
    style server stroke-width:2px
    style device fill:transparent,stroke:#8b949e,stroke-dasharray:5 5
    style network fill:transparent,stroke:transparent

Every client goes through the same HTTP API, including the any CLI. Only the server opens the database and syncs with other devices. This repository packages the server and CLI as one any binary, built on any-sync-sdk.

Data is organized into spaces: collections of objects shared with the same members. Objects support structured properties and collaborative content. Queries support Mongo-style filters and aggregation, while search supports full-text, vector, and hybrid retrieval. Embeddings can run locally on your device.

Devices exchange changes directly over peer-to-peer connections or through sync nodes, which store and relay encrypted content without being able to read it. When devices reconnect after working offline, CRDTs merge concurrent edits, and version history lets applications inspect previous changes. The underlying any-sync protocol also powers Anytype.

The companion runtime, anyrt, runs alongside the server as a separate client. It executes Python programs in a WebAssembly sandbox with execution limits and recorded traces. Programs, schedules, and agent memory live in the database next to the data they work with, and the agent harness keeps long-lived sessions that retain context across runs.

Quickstart

[!WARNING] Developer preview. APIs and data formats can change without migration. Use a separate account for experiments; do not use an account containing data you cannot afford to lose.

This example builds Any from source, creates a notebook, and subscribes to changes. It uses a dedicated data directory and local embeddings.

You need Git, Go 1.26.2 or newer, make, curl, and jq. For release packages and platform-specific prerequisites, see Installation.

1. Build
git clone https://github.com/anyproto/any.git
cd any
make build

The binary is written to bin/any. This build includes the local embedder and downloads the llama.cpp libraries it needs. See Installation for alternative builds and troubleshooting.

2. Create an account and start the server

By default, the server joins the production any-sync network. To use another network, configure it before starting the account and use a separate data directory. See Networks.

From the repository directory:

export ANY_DATA_DIR="$HOME/.any-demo"
export ANY_INDEX_EMBEDDER=local

./bin/any init
./bin/any run

init creates an account and prints its recovery phrase. Save it: you need it to restore the account on another device. Running init again in the same directory keeps the existing account.

Wait for LISTENING 127.0.0.1:2046, then leave the server running.

127.0.0.1:2046 is the default address for a server started this way. The Any desktop app starts its own server, with its own data directory and address, so an application that should share the app's data connects to that server instead. A running server records its address in server.addr in its account directory; see Server lifecycle.

The local embedding model (about 600 MB) downloads in the background the first time the server starts. You can create and query data while it downloads.

3. Create a document

In a second terminal, create a space and a page inside it:

API=http://127.0.0.1:2046/v1

SPACE=$(curl -fsS "$API/spaces" \
  -H 'Content-Type: application/json' \
  -d '{"name":"Notebook"}' | jq -er '.id')

OBJECT=$(curl -fsS "$API/spaces/$SPACE/objects" \
  -H 'Content-Type: application/json' \
  -d '{"type":"page","initialProperties":{"any":{"name":"Reading list"}}}' \
  | jq -er '.objectId')

printf 'Created page: %s\n' "$OBJECT"

The page type gives the object an editor document. any.name is its title.

4. Query and subscribe

In the same terminal, query the pages in your space:

curl -fsS "$API/spaces/$SPACE/objects/query" \
  -H 'Content-Type: application/json' \
  -d '{"filter":{"any.type":"page"},"sort":["-modifiedAt","-id"],"limit":20}' | jq

The response's records array includes your Reading list page. To receive updates as the results change, subscribe to the same query:

curl -fsSN "$API/spaces/$SPACE/objects/query/subscribe" \
  -H 'Content-Type: application/json' \
  -d '{"filter":{"any.type":"page"},"sort":["-modifiedAt","-id"],"limit":20}'

The stream sends ready, then a snapshot of the current records, followed by changes as the results change.

Press Ctrl-C to close the subscription. To stop the server, press Ctrl-C in the first terminal.

Continue with the objects tutorial to add your own properties, or follow the anyrt guide to run programs and agents.

Data and access

End-to-end encryption protects data exchanged between devices and sync nodes. Local access and model providers are configured separately:

  • Local API: the server binds to loopback and does not authenticate callers. Local processes can access the API as the active account.
  • Account storage: standalone mode stores the recovery phrase and device key in wallet.key. To encrypt the wallet, set ANY_WALLET_PASSKEY before initializing the account and supply the same passkey when starting the server.
  • Second devices: restore from the recovery phrase with ./bin/any init --mnemonic-stdin. Do not copy wallet.key: that also copies the device identity and interferes with sync.
  • Data location: this example uses ~/.any-demo/; the normal default is ~/.any/. Treat the directory as private account data.
  • Embeddings and models: this example explicitly selects local embeddings. Configured remote embedding providers receive embedding inputs. The agent's model provider is configured separately; local embeddings do not make agent model calls local.

See Server lifecycle, Configuration, and Embedders for details.

Documentation

Visit docs.any.org for the full documentation.

We welcome bug reports and feedback.

License

Any is open source under the MIT license. You can use, modify, and distribute it in personal and commercial applications, provided you retain the copyright and license notice. Third-party dependencies and models retain their respective licenses.

Directories

Path Synopsis
Package anyuri builds and parses any:// URIs — the canonical string convention for referencing anything inside any: an object, a dataset record, an identity (a member, a mention), a space, a property value, a file.
Package anyuri builds and parses any:// URIs — the canonical string convention for referencing anything inside any: an object, a dataset record, an identity (a member, a mention), a space, a property value, a file.
cmd
any command
anydocs command
Command anydocs renders the website/ markdown tree into a static HTML site.
Command anydocs renders the website/ markdown tree into a static HTML site.
internal
api
bin
Package bin registers the built-in `bin` collection: the marker of an object moved to the bin.
Package bin registers the built-in `bin` collection: the marker of an object moved to the bin.
bundles
Package bundles wires the HTTP bundles surface onto the SDK's per-space bundles registry (any-sync-sdk docs/bundles.md).
Package bundles wires the HTTP bundles surface onto the SDK's per-space bundles registry (any-sync-sdk docs/bundles.md).
catalog
Package catalog loads and validates the usecase catalog embedded in the binary (catalog.yml): the server's well-known bundles, grouped into usecases a client sets up with one call, dependencies included.
Package catalog loads and validates the usecase catalog embedded in the binary (catalog.yml): the server's well-known bundles, grouped into usecases a client sets up with one call, dependencies included.
catalog/cmd/catalog-validate command
catalog-validate checks the usecase catalog embedded in the binary and any candidate files given as arguments, printing one line per problem (`<source>: <path>: <code>: <message>`) and exiting 1 on any.
catalog-validate checks the usecase catalog embedded in the binary and any candidate files given as arguments, printing one line per problem (`<source>: <path>: <code>: <message>`) and exiting 1 on any.
chat
Package chat defines the built-in `chat` type — a CRDT-backed stream of messages stored as one record per message on a per-object `chat_messages` dataset.
Package chat defines the built-in `chat` type — a CRDT-backed stream of messages stored as one record per message on a per-object `chat_messages` dataset.
cli
dataview
Package dataview registers the built-in `dataview` type — saved views over a set of objects, in two levels: a dataview object hosts many DATAVIEWS, each with its own VIEWS.
Package dataview registers the built-in `dataview` type — saved views over a set of objects, in two levels: a dataview object hosts many DATAVIEWS, each with its own VIEWS.
editor
Package blocks defines the built-in `editor_blocks` dataset and its per-record CRDT handler.
Package blocks defines the built-in `editor_blocks` dataset and its per-record CRDT handler.
embedded
Package embedded is the shared, build-tag-free lifecycle core for embedding the `any` HTTP server inside a host process.
Package embedded is the shared, build-tag-free lifecycle core for embedding the `any` HTTP server inside a host process.
index
Package index defines the consumer-side chunker contract: the bridge between the SDK's per-space change feed and the search indexer (internal/indexer).
Package index defines the consumer-side chunker contract: the bridge between the SDK's per-space change feed and the search indexer (internal/indexer).
indexer
Package indexer is the phase-2 consumer of the chunker contract in internal/index (docs/13-index.md): a background service that keeps a local any-store database with a BM25 full-text index and an IVF-SQ vector index per space, fed from the SDK's per-space change feed (Space.Changes()), and a hybrid (RRF) search over both.
Package indexer is the phase-2 consumer of the chunker contract in internal/index (docs/13-index.md): a background service that keeps a local any-store database with a BM25 full-text index and an IVF-SQ vector index per space, fed from the SDK's per-space change feed (Space.Changes()), and a hybrid (RRF) search over both.
localstore
Package localstore is the naming, existence and tag fence for the server's device-local any-store collections (task-local-store.md).
Package localstore is the naming, existence and tag fence for the server's device-local any-store collections (task-local-store.md).
markdown
Package markdown is the lossless markdown import/export surface over the editor_blocks dataset (internal/editor).
Package markdown is the lossless markdown import/export surface over the editor_blocks dataset (internal/editor).
miniapp
Package miniapp registers the built-in `miniapp` collection: the marker an object carries to run an installed bundle.
Package miniapp registers the built-in `miniapp` collection: the marker an object carries to run an installed bundle.
page
Package page registers the built-in `page` type: the plain document.
Package page registers the built-in `page` type: the plain document.
push
Package push runs the account's client side of push notifications: device-token persistence + registration with the push node, the subscription sync loop (desired-topic reconcile → SubscribeAll full replace), and a buffered notify queue so HTTP handlers never block on the push server.
Package push runs the account's client side of push notifications: device-token persistence + registration with the push node, the subscription sync loop (desired-topic reconcile → SubscribeAll full replace), and a buffered notify queue so HTTP handlers never block on the push server.
server
Package server implements the HTTP/JSON API for any-sync-sdk.
Package server implements the HTTP/JSON API for any-sync-sdk.
mobile
ios command
Package main is the C-archive surface that embeds the `any` engine in an iOS app.
Package main is the C-archive surface that embeds the `any` engine in an iOS app.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL