How anyproto/any works
Any is a local-first, end-to-end encrypted collaborative database exposed through a localhost HTTP API and CLI. The main workflow is: a user starts the server and initializes an account, an application creates or updates space data, and the server returns query results or streams live changes; connected devices synchronize encrypted changes over peer-to-peer links. The product also includes full-text, semantic, and hybrid search; collaborative editor and chat primitives; and push notifications. The README documents the workflow and capabilities; unsampled handler and sync internals are represented only where the tree or excerpts support them.
Main entry points: routes.go Local HTTP API · engine.go Server engine · localstore.go Local data store · worker.go Search indexing
Components 21
User access
- Any binary
cmd/any/main.go - CLI commands
internal/cli/root.go - HTTP client
internal/client/client.go
Server and sync
- Local HTTP API
internal/server/routes.go - Server engine
internal/server/engine.go - Encrypted device sync
internal/server/engine.go - Identity and account
internal/server/identity.go
Data and queries
- Spaces and objects
internal/server/handlers_objects.go - Data mutations
internal/server/handlers_modify.go - Object queries
internal/server/handlers_query.go - Dataset queries
internal/server/handlers_dataset_query.go - Live query streams
internal/server/handlers_query_subscribe.go - Local data store
internal/localstore/localstore.go
Index and search
- Search indexing
internal/indexer/worker.go - Search index store
internal/indexer/store.go - Embedding providers
internal/indexer/embed_worker.go
Collaboration features
- Collaborative editor
internal/editor/handler.go - Encrypted chat
internal/chat/handler.go - Push notifications
internal/push/push.go
Other components
- User or app
- Sync nodes
Connections 25
- User or app → Any binary: starts
- Any binary → CLI commands: executes
cmd/any/main.go - User or app → HTTP client: requests data
- HTTP client → Local HTTP API: sends HTTP
- CLI commands → Local HTTP API: controls server
- Local HTTP API → Server engine: serves requests
- Server engine → Identity and account: opens account
- Server engine → Encrypted device sync: starts sync
internal/server/engine.go - Encrypted device sync → Sync nodes: relays encrypted changes
- Local HTTP API → Spaces and objects: routes data requests
- Spaces and objects → Local data store: reads and writes
- Local HTTP API → Data mutations: routes mutations
- Data mutations → Local data store: updates data
- Local HTTP API → Object queries: routes queries
- Object queries → Local data store: queries data
- Local HTTP API → Dataset queries: routes dataset queries
- Dataset queries → Local data store: queries datasets
- Local HTTP API → Live query streams: routes subscriptions
- Live query streams → User or app: streams changes
- Server engine → Search indexing: starts indexing
internal/server/engine.go - Search indexing → Search index store: updates index
- Search indexing → Embedding providers: requests vectors
- Server engine → Collaborative editor: hosts editor
- Server engine → Encrypted chat: hosts chat
- Server engine → Push notifications: starts notifications
internal/server/engine.go