Write your contracts once. Call weft.http, weft.gql, weft.grpc, weft.kafka, weft.ws and the rest,
in any language. Weft runs the real library underneath: Express, Apollo, KafkaJS, Spring Kafka, FastAPI, franz-go.
Repository · Quick start · Contracts · Docs · Roadmap · Discussions
A modern system talks in many ways at once: REST, GraphQL, gRPC, Kafka, RabbitMQ, WebSockets. Each has its own library, its own types, its own errors, retries and tracing, and the types drift between the service that sends and the one that receives.
Weft is one interface over all of it. You describe what your services say in small, language-neutral contract files. A compiler turns them into typed code for your language. You call weft.*, and the library you already use runs underneath.
|
One API |
Typed end to end |
Your stack stays |
|
Behaviour that matches |
Observable by default |
Breaking changes caught |
flowchart LR
A["<b>.weft</b><br>contracts"] --> B["<b>weft</b> compiler<br>Rust"]
B --> C["checked<br>contracts"]
C --> D["<b>generated code</b><br>one file per language"]
D --> E["<b>weft.*</b><br>runtime"]
E --> F["the real library<br>Express · KafkaJS · net/http · franz-go · …"]
package orders @version("1.0.0")
type Order { id: uuid items: OrderItem[] total: Money }
event order.placed: Order { key: id }
http /v1 {
POST "/orders" createOrder(body: CreateOrder) -> Order | OutOfStock
GET "/orders/{id}" getOrder(id: uuid) -> Order?
}
import { weft } from "./weft.gen"
weft.http.post("/orders", ({ body }) => placeOrder(body)) // body is a typed CreateOrder
weft.kafka.on("order.placed", (order) => notifyCustomer(order)) // order is a typed Order
await weft.kafka.publish("order.placed", order) // a wrong payload does not compile
await weft.start()cargo install --git https://github.com/weft-sdk/weft weft-cli --locked # the weft CLI
weft init # in your projectweft init detects TypeScript or Go, asks which transports you use, installs the packages, writes weft.yaml and a first contract, and generates the code.
| Transport | TypeScript | Go | |
|---|---|---|---|
| ● | weft.http |
Express | net/http |
| ● | weft.kafka |
KafkaJS | franz-go |
| ○ | weft.gql · weft.grpc · weft.rpc · weft.ws · weft.sse |
Apollo · grpc-js · tRPC · Socket.io | gqlgen · grpc-go |
| ○ | weft.mq · weft.nats · weft.redis · weft.cloud · weft.mqtt · weft.pulsar |
amqplib · nats · ioredis · cloud SDKs | amqp091-go · nats.go · go-redis |
● available now ○ on the roadmap
The same contracts also target Python, JVM, .NET, Rust, Ruby, PHP, Elixir, Swift and Dart. Each language is a package that passes the same conformance suite, and the full matrix of libraries is in the language docs.
| Where | Package |
|---|---|
| npm | @weft-sdk/core · @weft-sdk/http-express · @weft-sdk/kafka-kafkajs |
| Go | go get github.com/weft-sdk/weft/go |
| CLI | cargo install --git https://github.com/weft-sdk/weft weft-cli |
| Repository | What is in it |
|---|---|
| weft | The compiler and CLI, the TypeScript and Go packages, the conformance suite, the website and the docs |
| examples | Runnable projects: a TypeScript service and a Go service that share one contract over HTTP and Kafka |
| action | A GitHub Action that catches breaking contract changes, stale generated code and unformatted contracts |
| vscode-weft | VS Code support for .weft files: highlighting, snippets and formatting |
| tree-sitter-weft | A tree-sitter grammar for the contract language, for Neovim, Helix and Zed |
| homebrew-tap | brew install weft-sdk/tap/weft |
| brand | The logo, the colours and the social preview image |
Ask a question in Discussions, report a bug in Issues, or read CONTRIBUTING to send a change. Security problems go through private reporting.