Toss requires a backend server. The backend is a Cloudflare Worker — it runs on Cloudflare's free tier, which is enough for small teams.
Free tier limits (Cloudflare):
- Workers: 100,000 requests/day
- R2: 10 GB storage
- D1: 5 GB database
Prerequisites: Node.js 18+ and a Cloudflare account (free).
git clone https://github.com/Clay-HHK/toss.git
cd toss/worker
bash deploy.shThe script handles everything automatically:
- Install npm dependencies
- Login to Cloudflare (opens browser)
- Create D1 database, R2 bucket, KV namespace
- Write resource IDs into
wrangler.toml - Apply database schema
- Generate and set JWT secret
- Deploy the Worker
When finished, the script prints your server URL and next steps.
If you prefer to do each step yourself:
cd worker
# Install dependencies
npm install
# Login to Cloudflare
npx wrangler loginCreate the required resources:
npx wrangler d1 create toss-db
npx wrangler r2 bucket create toss-storage
npx wrangler kv namespace create TOSS_KVEach command prints an ID. Open worker/wrangler.toml and fill them in:
[[d1_databases]]
binding = "DB"
database_name = "toss-db"
database_id = "<paste D1 ID here>"
[[r2_buckets]]
binding = "STORAGE"
bucket_name = "toss-storage"
[[kv_namespaces]]
binding = "KV"
id = "<paste KV ID here>"Apply the database schema and set the JWT secret:
npx wrangler d1 execute toss-db --remote --file=schema.sql
openssl rand -hex 32 | npx wrangler secret put JWT_SECRETDeploy:
npx wrangler deployOutput:
Deployed toss-worker to https://toss-api.<your-subdomain>.workers.dev
toss initEdit ~/.toss/config.yaml and set base_url:
current_profile: default
profiles:
default:
server:
base_url: https://toss-api.<your-subdomain>.workers.devThen login:
toss login --pat
toss whoamiCreate a group and share the invite code:
toss group create my-team
toss group invite my-teamOutput:
Invite code: toss-api.<your-subdomain>.workers.dev/ABCD-1234
Share this with your team. They can join with:
toss join toss-api.<your-subdomain>.workers.dev/ABCD-1234
Recipients run that one command and they're in — no manual config needed.
| Setting | Default | Where |
|---|---|---|
| Rate limit | 60 req/min per user | worker/src/middleware/rate-limit.ts |
| Max file size | 100 MB | worker/src/handlers/documents.ts |
| Document expiry | 30 days | worker/src/handlers/cleanup.ts |
Auto-cleanup runs daily via a Cloudflare cron trigger defined in wrangler.toml.