Bundle Format

Bundles are self-contained packages that encapsulate Tonk applications, their data, and metadata into a single distributable file with the .tonk extension.

Overview

A bundle is essentially a ZIP archive containing:

  • Application code and assets as serialized automerge documents
  • Manifest with metadata and configuration

Bundle Structure

my-app.tonk (ZIP archive)
├── manifest.json           # Bundle metadata and configuration
├── storage/               # Serialized Automerge documents
    ├── root.automerge    # Root document (always present)
    ├── [doc-id-1].automerge
    ├── [doc-id-2].automerge
    └── ...

## Manifest Format

The `manifest.json` file contains essential metadata about the bundle:

```json
{
  "manifest_version": 1,
  "version": {
    "major": 1,
    "minor": 0
  },
  "root_id": "automerge:3qF8x9...",
  "entrypoints": ["index.html"],
  "network_uris": ["wss://sync.example.com"],
  "x_notes": "Optional human-readable notes",
  "x_vendor": {
    "app_name": "My Tonk App",
    "author": "John Doe",
    "custom_field": "any value"
  }
}

Manifest Fields

FieldTypeRequiredDescription
manifest_versionnumberYesBundle format version (currently 1)
versionobjectYesBundle version with major/minor
root_idstringYesAutomerge document ID of root directory
entrypointsstring[]NoEntry files for the application
network_urisstring[]NoWebSocket URIs for sync
x_notesstringNoHuman-readable notes
x_vendorobjectNoCustom vendor-specific metadata