Skip to content

What is Bynk?

Bynk is a statically typed programming language for building services. It is architecture-first: the shape of a program — its contexts, services, agents, and the types that flow between them — is part of the language, not a convention layered on top. Bynk compiles to typed TypeScript and targets Cloudflare Workers.

A minimal Bynk program declares a context and a type:

commons demo {
type Id = Int
}

A small HTTP service is not much larger:

context greet
service api from http {
on GET("/ping") by Visitor () -> Effect[HttpResult[String]] {
Ok("pong")
}
}

Compiling either with bynkc produces TypeScript you can read, run, and deploy. To see all of this wired together in one complete program — types, a context, a capability, a stateful agent, and an HTTP service — read Anatomy of a Bynk service.

  • Make illegal states unrepresentable. Bynk leans on refined types (types carrying a predicate), opaque types, and errors-as-values (Result, Ok/Some/None) so that whole classes of bug cannot be expressed. See The type-system philosophy.
  • Architecture in the language. Contexts, services, and stateful agents are first-class. See How a Bynk program is shaped.
  • Compiles to TypeScript. You get JavaScript-ecosystem interop and a natural fit for Cloudflare Workers, with a static type system in front of it. See Why compile to TypeScript.
  • Testing is built in. test blocks, assert, dependency mocks, and Mock[T] value fabrication ship with the language.

Bynk is pre-1.0. Some designed features — events, sagas, and storage kinds — are deferred, not missing, and land in later increments on the road to v1. This book documents only what compiles today and marks planned features as planned. See Versioning & roadmap.

Bynk is Cornish for a workbench or platform — a solid, raised surface you build on. It fits a language whose premise is that the structure you build on should be part of the tool: contexts, services, and agents are the bench, and your program is the work laid out on it. The double meaning is deliberate, too — Bynk compiles to a real deployment platform.