zigttp

v0.16.0-RC8: a compiler-agent that writes inside a provable TypeScript subset

zigts subset - deployable contracts - 1.2MB deploys

3ms cold start
1.2MB binary size
4MB memory baseline
The Product

RC8 makes the subset feel like leverage

Install once. Edit inside the compiler. Ship only what zigts keeps provable.

📦 Single-binary install

Linux and macOS builds keep the first run short and start from a binary, not a toolchain.

🔗 GitHub-first install path

README and Releases are the source of truth for install steps, RC notes, and source-build guidance.

⚙️ Compiler-native coding loop

zigttp expert writes only inside zigts, reruns proofs, and stops at code the compiler can sign.

The Insight

zigts makes the compiler-agent possible

The subset is the leverage.

No back-edges, no exceptions, no hidden I/O. The compiler can follow every path, rewrite within bounds, and prove what a handler reads, writes, and returns.

Handler Code
Compiler Analysis
Proven Contract
Auto Sandbox
Language Design

TypeScript, narrowed until it can be proved

REMOVED (zigts)
✕ classes / this / new
✕ var / null / == / !=
✕ while / do...while
✕ async / await / Promises
✕ try / catch / throw
✕ regex / delete / any / as
KEPT + ADDED (zigts)
✓ arrow functions + destructuring
✓ const / let / for...of
✓ match expressions (exhaustive)
✓ pipe operator (|>)
✓ guard() composition
✓ comptime() evaluation
✓ JSX / TSX (first-class SSR)

Unsupported features fail at parse time with a suggested alternative, not after deploy.

Verification

The agent can only ship what the compiler proves

Every code path returns a Response No forgotten early returns. No implicit undefined.
Result values checked before access jwtVerify(...).ok must be tested - the BoolChecker enforces it.
No unreachable code Dead branches are a build error, not a linter warning.
Boolean enforcement Truthy/falsy coercion rejected everywhere. Progressive type inference for env(), cacheGet(), and match arms.
Full type checking Variable types, function signatures, property access, nominal interfaces - all validated.
$ zigttp check handler.ts --verify → all code paths verified ✓
Security

Automatic least-privilege sandboxing

The compiler extracts a contract of what the handler does - then restricts runtime access to exactly those proven values.

contract.json
{
  "env": ["API_KEY", "DB_URL"],
  "egress": ["api.stripe.com"],
  "cache": ["sessions"],
  "sql": ["getUserById"],
  "properties": {
    "read_only": true,
    "retry_safe": true
  },
  "proof": "complete"
}
🛡 Zero configuration required
🛡 Env vars scoped to declared set
🛡 Egress locked to proven hosts
🛡 Effect classification per handler
🛡 OpenAPI spec from -Dopenapi
Concurrency & Durability

Linear code. Parallel I/O. Crash recovery.

Structured Concurrent I/O

parallel() and race() from zigttp:io

Handler code stays synchronous and linear. Concurrency happens in the I/O layer using OS threads.

3 API calls × 50ms each = ~50ms total

🔄 Durable Execution

--durable <dir> enables crash recovery

Write-ahead oplog. Each I/O call persisted before returning. On crash, replay without touching the network.

sleep() - sleepUntil() - waitSignal()
Evolution

Ship with confidence - prove before deploy

Deterministic Replay

Record every I/O boundary with --trace. Replay against new versions. Handlers = pure functions of (Request, VirtualModuleResponses).

--trace / --replay
Proven Evolution

Diff contracts + replay traces between handler versions. Result: equivalent, additive, or breaking - with a proof certificate.

zigttp prove old.json new.json
Proven Deploys

Generate platform-specific deployment configs from proven contracts. Env vars → params, routes → API events, egress → tags.

zigttp compile --deploy=aws
Developer Experience

One CLI. The compiler-agent lives inside it.

zigttp CLI v0.16.0-RC8
install → init → dev → compile → prove → deploy
$
zigttp init my-handler Bootstrap a project with a handler, tests, and zigts-ready defaults
$
zigttp dev Watch mode with live verification and compiler feedback
$
zigttp compile --deploy=aws Prove, compile, and generate deployment manifest
$
zigttp prove old.json new.json Diff contracts for safe handler upgrades
$
zigttp mock tests.jsonl --port 3001 Generate mock server from test fixtures
github.com/srdjan/zigttp#install GitHub install instructions + release downloads for v0.16.0-RC8
Composition

Zero-overhead composition. Native speed.

📦 Guard Composition
guard(auth) |> guard(log) |> handler |> guard(cors)

Desugared to a single flat function with sequential if-checks at compile time. Zero runtime overhead.

⚙️ Native Virtual Modules
zigttp:auth JWT + webhooks
zigttp:crypto SHA/HMAC/B64
zigttp:validate JSON Schema
zigttp:decode Parse + validate
zigttp:cache KV store + TTL
zigttp:sql SQLite
zigttp:io Parallel I/O
zigttp:durable Crash recovery
zigttp:compose Guards + pipe
zigttp:router Route matching
zigttp:env Environment
zigttp:http Cookies + CORS
zigttp:url URL parsing
zigttp:id UUID/ULID/nano
zigttp:log Structured logs
zigttp:text Escape + slug
zigttp:time ISO/HTTP dates
zigttp:ratelimit Token bucket
zigttp:service Service calls
zigttp:scope Resource scopes

20 modules implemented in Zig - zero interpretation overhead.

Comparison

zigttp vs the general-purpose runtimes

zigttp
Node.js
Deno
Bun
Performance
Cold start
~3ms
~200-300ms
~150-200ms
~100-130ms
Binary
1.2MB
~80MB
~130MB
~90MB
Memory
4MB
~30MB
~25MB
~20MB
Verification
Compile-time proofs
-
-
-
Auto sandboxing
-
Perms
-
Injection prevention
Proof
Manual
Manual
Manual
OWASP compliance
Auto
Audit
Audit
Audit
DX & Trade-offs
Deploy manifest
Compiler
Template
Template
Template
AI agents
Built-in
Generic
Generic
Generic
Language
zigts subset
Yes
Yes
Yes
npm ecosystem
Virtual
Full
Full
Full

zigttp trades generality for verification, security, and deployment automation.

zigttp

Write handlers. Prove them. Ship them.

Opinionated subset Parse-time rejection of footguns
Compile-time verification Every path, every type, every boolean
Automatic sandboxing Least-privilege derived from analysis
Structured I/O Linear code, parallel execution
Durable execution Crash recovery via write-ahead oplog
Deterministic replay Record I/O boundaries, replay anywhere
Proven evolution Diff contracts, classify changes
Effect classification Handler properties proven at build time
OpenAPI generation Response schemas from type inference
Native performance 3ms init - 1.2MB - 4MB baseline