Workers aren't JavaScript-only. The runtime is polyglot — you can write Workers in several languages, each with different trade-offs. Here's what's available and when you'd pick each one.
These have official Cloudflare support with dedicated tooling and documentation:
| Language | Maturity | Tooling | Best For |
|---|---|---|---|
| JavaScript | Stable ✅ | Wrangler CLI | Most use cases. Largest ecosystem, most examples, fastest iteration. |
| TypeScript | Stable ✅ | Wrangler CLI | Same as JS but with type safety. Recommended for anything non-trivial. |
| Python | Beta 🧪 | pywrangler CLI |
Data processing, AI/ML pipelines, teams that know Python better than JS. |
| Rust | Beta 🧪 | Wrangler + workers-rs crate |
Performance-critical code, existing Rust codebases, CPU-bound work within the 10ms limit. |
The default and most mature option. All Cloudflare examples and tutorials use JS/TS. The runtime supports modern ES modules, Web APIs (fetch, crypto, streams), and partial Node.js compatibility.
// JavaScript — the simplest possible Worker
export default {
async fetch(request, env, ctx) {
return new Response("Hello from JavaScript!");
},
};
// TypeScript — same thing, with types
export interface Env {
MY_KV: KVNamespace;
}
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
const value = await env.MY_KV.get("key");
return new Response(value ?? "not found");
},
};
When you scaffold a project with npm create cloudflare and choose TypeScript, Wrangler handles transpilation automatically. No tsconfig.json tweaking required — it just works.
Python Workers let you write 100% Python — no JavaScript glue code. They support popular packages like FastAPI, Langchain, and Pydantic, and can access all Workers bindings (KV, D1, R2, etc.) via a foreign function interface.
# Python — a simple Worker
from workers import WorkerEntrypoint, Response
class Default(WorkerEntrypoint):
async def fetch(self, request):
return Response("Hello from Python!")
# Python with FastAPI
from workers import WorkerEntrypoint
from workers.fastapi import create_app
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello from FastAPI on Workers!"}
class Default(WorkerEntrypoint):
fetch = create_app(app)
# Install uv (Python package manager) if you don't have it
curl -LsSf https://astral.sh/uv/install.sh | sh
# Scaffold a Python Worker project
uvx --from workers-py pywrangler init
# Run locally
uv run pywrangler dev
# Deploy
uv run pywrangler deploy
Python support works and is actively developed, but you may hit edge cases. The standard library is partially available — check the supported modules list. For production stability, JavaScript/TypeScript is still the safer choice.
Rust compiles to WebAssembly (Wasm) and runs in the Workers runtime. It gives you maximum performance per CPU millisecond — useful when you're bumping against the 10ms limit and need to squeeze more work in.
// Rust — a simple Worker
use worker::*;
#[event(fetch)]
async fn main(req: Request, env: Env, ctx: Context) -> Result<Response> {
Response::ok("Hello from Rust!")
}
// Rust with routing
use worker::*;
#[event(fetch)]
async fn main(req: Request, env: Env, ctx: Context) -> Result<Response> {
let router = Router::new();
router
.get("/", |_, _| Response::ok("Home"))
.get_async("/api/data", |_, ctx| async move {
let kv = ctx.kv("MY_KV")?;
let value = kv.get("key").text().await?;
Response::ok(value.unwrap_or_default())
})
.run(req, env)
.await
}
# Prerequisites
rustup target add wasm32-unknown-unknown
cargo install cargo-generate
# Scaffold a Rust Worker project
cargo generate cloudflare/workers-rs
# Run locally
npx wrangler dev
# Deploy
npx wrangler deploy
Rust Workers are faster per CPU cycle than JavaScript, but slower to develop. Use Rust when: you need maximum computation in 10ms, you're processing binary data (images, protobuf), or you already have Rust logic to reuse. For APIs and CRUD, JavaScript/TypeScript is more productive.
Because Workers run Wasm, any language that compiles to WebAssembly can theoretically work. The experience varies:
| Language | Compiles to Wasm? | Practical? | Notes |
|---|---|---|---|
| Go | Yes (TinyGo) | ⚠️ Experimental | Use TinyGo (not standard Go). Large binary sizes, limited stdlib. |
| C / C++ | Yes (Emscripten) | ⚠️ Experimental | Works for compute-heavy tasks. No official Cloudflare SDK. |
| Kotlin | Yes (Kotlin/Wasm) | ⚠️ Experimental | Kotlin/Wasm is still maturing. Large output size. |
| C# / .NET | Yes (Blazor WASI) | ⚠️ Experimental | Possible but heavy. Not recommended for Workers. |
| Zig | Yes | ⚠️ Experimental | Small binaries. No official SDK but people have made it work. |
For most people: use TypeScript. It has the best tooling, the most examples, full access to all bindings, and is the default path Cloudflare optimizes for. Switch to Python if your team is Python-native, or Rust if you need raw performance.
| If you want... | Use |
|---|---|
| Fastest development, most examples | TypeScript |
| Quick prototypes, minimal ceremony | JavaScript |
| Data science / ML / FastAPI patterns | Python |
| Maximum CPU performance per ms | Rust |
| Existing codebase in another language | Wasm (via that language's compiler) |
The free tier limits are identical regardless of language:
The only practical difference: Rust/Wasm Workers tend to use less CPU time per request (faster execution), which means you get more done within the 10ms budget.
Workers Languages — Cloudflare Docs — official documentation for all supported languages, including setup guides and API references for each.