Quickstart Guide
⚠️ Important: Tonk is under heavy development and APIs are changing rapidly. Getting started requires manual setup and isn't for the faint of heart. We're working on making this easier!
Prerequisites
Option 1: With Nix (Recommended)
The easiest way to get started is with Nix, which automatically sets up all dependencies:
# Install Nix with flakes support
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
# Enter development environment
cd tonk
nix develop
# Install dependencies
bun install
Option 2: Manual Setup
If you prefer not to use Nix:
-
Install dependencies:
- Node.js 20+
- bun
- Rust toolchain (for building core)
-
Set up relay binary:
You'll need access to the relay binary. Contact the Tonk team for details.
export TONK_RELAY_BINARY=/path/to/tonk-relay -
Build core-js:
cd packages/core-js bun install bun run build
Try the Example
The most complete example is latergram. Here's how to run it:
Note: With Nix, the relay server is automatically available via
$TONK_RELAY_BINARY. Without Nix, ensure you've set theTONK_RELAY_BINARYenvironment variable.
- Bundle the latergram example:
cd examples/latergram
bun install
bun run bundle create # Creates a .tonk file
touch .env # Create .env file, see .env.example for required API_KEY (latergram uses Anthropic Claude)
- Load it in host-web:
cd packages/host-web
bun run dev
# Then upload the .tonk file created in step 1
Note on Templates
The create package has templates, but they're still in flux and may not work reliably. For now, we
recommend starting from the latergram example and modifying it to suit your needs.
Examples in the Repository
Explore these working examples:
- latergram - Advanced application with dynamic components
Next Steps
- Development Guide - Complete setup guide including cross-repo development
- Architecture - Deep dive into Tonk's design
- Virtual File System - Learn about the VFS layer
- Bundle Format - Understand bundle packaging