Kasta #
Kasta (Swedish: "to throw") — quickly throw TypeScript programs onto the web.
Kasta is a runtime for hosting small TypeScript programs called kasts. Write a kast, publish it to your AT Protocol PDS, sync it to Kasta, and it becomes a live HTTP endpoint.
How it works #
A kast is a TypeScript file that exports a default HTTP handler:
export default function handler(req: Request): Response {
return new Response("hello!");
}
Kasta executes each kast in an isolated Deno Worker per request. Any HTTP verb
is supported — the full Request is passed to your handler and your Response
is returned to the caller.
Each kast gets a URL at:
kasta.app/{your-handle}/{kast-name}
AT Protocol integration #
Kasta uses your AT Protocol PDS as the source of truth for your kasts. No Kasta account needed — your ATP identity is your Kasta identity.
Two record types live in your PDS:
me.wilb.kasta.code — an immutable snapshot of a kast's source code:
{
"$type": "me.wilb.kasta.code",
"name": "hello",
"files": [{ "path": "main.ts", "content": "..." }],
"entrypoint": "main.ts",
"lang": "typescript",
"createdAt": "2026-04-13T00:00:00Z"
}
me.wilb.kasta.pointer — points to the currently active version (rkey =
kast name):
{
"$type": "me.wilb.kasta.pointer",
"name": "hello",
"active": {
"uri": "at://did:plc:.../me.wilb.kasta.code/rkey",
"cid": "bafy..."
},
"updatedAt": "2026-04-13T00:00:00Z"
}
To deploy a new version: write a new me.wilb.kasta.code record, update the
me.wilb.kasta.pointer to reference its CID, then call POST /sync.
Deploying a kast #
- Write an
me.wilb.kasta.coderecord to your PDS - Create or update an
me.wilb.kasta.pointerrecord (rkey = kast name) pointing to the code CID - Notify Kasta to sync:
curl -X POST https://kasta.app/sync \
-H "content-type: application/json" \
-d '{"handle": "you.bsky.social"}'
Kasta will respond with the URLs of all your active kasts.
Running the server #
deno task start
Requires Deno 2.2+. The server starts on port 8000 by default. Set BASE_URL to
control the URL prefix returned in sync responses:
BASE_URL=https://kasta.app deno task start
Running tests #
deno task test
API #
| Method | Path | Description |
|---|---|---|
GET |
/health |
Health check |
POST |
/sync |
Sync kasts from a user's PDS. Body: {"handle": "..."} |
* |
/:handle/:name |
Execute a kast — all HTTP verbs forwarded |
File structure #
src/
server.ts # Hono app and route wiring
db.ts # SQLite schema and queries
atproto.ts # AT Protocol handle resolution and PDS record fetching
sync.ts # Sync orchestration
runner.ts # Deno Worker execution
worker_harness.ts # Worker script that runs kast code
tests/
*.test.ts
main.ts # Entry point