Teak - A Kotlin-inspired language that runs on Node.js
Introduction
I really enjoy programming in Kotlin but it can be a bit of a chore to get started with the initial project setup boilerplate like Intellij and Maven + pom.xml file. In fact, it has been such a persistent issue that I have a whole boilerplate repo setup to insta-clone and get started. You can read more about it here
I wanted Kotlin but with no build step, no dependencies to manage, no project structure required, don’t even need a main(). When insiration strikes, I wanted something that allows you to try out an idea quickly without all the ceremony. Initially I was trying to mimic bhai lang as a DSL in Kotlin but then I started thinking why a DSL and why in Kotlin? Why can’t I just write my own lexer, parser, and interpreter combo and have the exact syntax I want. With AI assisted development becoming common, I decided to vibe code a language with the exact semantics and syntax that I wanted.
Teak lets you focus on what you’re building, the core idea, not the tooling around it.
The language
Teak is to Kotlin what Crystal is to Ruby. It takes in some parts of Golang as well and mixes them in certain areas. If you have used Kotlin before the syntax will feel familiar.
1 | // hello.tk |
Key features:
- Data classes for simple data holders
- Default parameters on functions
- Functional operations on lists and maps (map, filter, fold, etc.)
- Functions are a first class citizen with convenient lambdas
- Built in http server and client
- Can import and use any npm package
How to run it
After installing via npm (npm i @teaklang/teak), you get two commands:
teak file.tk- runs a Teak script directlyteakc file.tk- compiles Teak to JavaScript (outputs to stdout)
The dev loop then becomes:
- Get an idea
- Write your
.tkfile - Run
teak your-file.tk - See the output
Standard library
Teak comes with a standard library for scripting:
- File system operations (read/write files, walk directories)
- HTTP client (get, post, download)
- JSON parsing and serialization
- Collections with functional operations (list, map, set)
- Concurrency primitives (go {} for goroutine-like concurrency, channels)
- Math and string utilities
An HTTP server library is built directly in to the language
1 | val server = HttpServer(3000) |
Try it
Install: npm i @teaklang/teak
Docs: https://teak-lang.aawadia.dev/
Examples: https://github.com/asad-awadia/teak-lang/tree/main/examples