Languages
Background
Workers is a polyglot platform. You can write Workers with a language you likely already know. Cloudflare built Workers to execute JavaScript and WebAssembly and has continuously added support for new languages.
JavaScript / TypeScript
The Workers platform fully supports JavaScript. Cloudflare recommends using JavaScript and TypeScript. Find up-to-date type definitions on GitHub and npm.
Language | Template |
---|---|
JavaScript | cloudflare/worker-template |
TypeScript | cloudflare/worker-typescript-template |
Resources on JavaScript / Typescript
- Quickstarts – More example repos to use as a basis for your projects
- TypeScript type definitions
- JavaScript and web standard APIs
- Tutorials
Wasm-supported
WebAssembly — abbreviated Wasm — is a binary format that many languages target during their compilation. This allows developers to write Workers using languages like C, C++, Rust, and more.
Language | Template |
---|---|
Rust | cloudflare/rustwasm-worker-template |
C | cloudflare/worker-emscripten-template |
Cobol | cloudflare/cobol-worker-template |
Resources on WebAssembly
Compiled to JavaScript
You can write Workers with any language that can compile to JavaScript, including the languages below.
Language | Example project |
---|---|
Kotlin | cloudflare/kotlin-worker-hello-world |
Dart | cloudflare/dart-worker-hello-world |
Python | cloudflare/python-worker-hello-world |
Scala | cloudflare/scala-worker-hello-world |
Reason/OCaml | cloudflare/reason-worker-hello-world |
Perl | cloudflare/perl-worker-hello-world |
PHP | cloudflare/php-worker-hello-world |
FSharp | fable-compiler/cfworker-hello-world |
Refer to the Cloudflare Workers announces broad language support blog post for more information.