Korr

Korr

Simple to write. Safe to run. Ready to ship.

Korr is a calm, modern language for full-stack websites and command-line tools. It takes the friendliness of Python, the web-first spirit of PHP and the everyday ergonomics of JavaScript, then adds Rust’s discipline: typos in variable names are caught before your program starts, integers never overflow silently, and HTML templates escape user input by default. Batteries are included (web server, SQLite/PostgreSQL/MySQL, HTTP client, regex, logging) and your app ships as a single executable.

struct Todo
    id: int
    title: str
    done: bool = false

let todos = [Todo(1, "Learn Korr"), Todo(2, "Ship it", done: true)]

let app = http.app()
app.get("/", fn(req) => html"<h1>{len(todos)} todos</h1>")
app.get("/api/todos", fn(req) => todos)            // arrays and maps become JSON
app.get("/api/todos/:id", fn(req) => todos.find(fn(t) => t.id == int(req.params.id, 0)) ?? http.json({ error: "not found" }, 404))
app.listen(8080)

Why Korr?

   
Easy to learn Indentation-based blocks, one obvious way to do things, and error messages that point at the line, explain the problem and suggest a fix (did you mean 'total'?).
Safe by default No silent type coercion ("1" + 1 is an error, not "11"), checked integer overflow, bounds-checked indexing, XSS-safe html"..." templates, safe static file serving, secure HTTP headers, constant-time comparisons, PBKDF2 password hashing. The interpreter itself is written in safe Rust.
Fast Compiled to bytecode for a register VM written in safe Rust. Starts in a few milliseconds (about 10x faster than PHP, Python or Node.js), faster than CPython overall (1.5x over 23 benchmarks), on par with PHP 8.4 on loops and arrays, and the fastest of the four at sorting. Function calls and objects are still 2 to 3x behind PHP: see the benchmarks.
Databases built in SQLite, PostgreSQL and MySQL/MariaDB through one API, with bound parameters by default (no SQL injection through values) and transactions.
Full-stack out of the box HTTP server with workers (many requests at once) and router, WebSockets and Server-Sent Events with publish/subscribe, HTTP client, JSON, cookies, sessions with CSRF protection, form/JSON bodies, file uploads, static files, templates, logging, regex, CSV, .env files, a request simulator for tests, no framework or package needed.
Great for the command line cli.parse (options, arguments, generated --help), colours with term, fs.walk / fs.glob, os.exec (no shell injection), exit codes, and korr build turns any script into a standalone executable.
Rust-powered struct + impl, enum with data and exhaustive match (a missing case is an error before the program runs), ranges/guards/array patterns, .. / ..= ranges, -> return types, and native modules are plain Rust closures.
Tooling included korr fmt, korr check, korr test, a package manager, and a VS Code extension with typed autocomplete, go to definition, references, rename, formatting and errors as you type.

Install

System Command
Linux, macOS curl -fsSL https://raw.githubusercontent.com/refkinscallv/korr/main/install.sh \| bash
Windows (PowerShell) irm https://raw.githubusercontent.com/refkinscallv/korr/main/install.ps1 \| iex

Or download an installer (korr-setup-*) from the latest release. Prebuilt releases need nothing else installed. The installer puts korr on your PATH and sets up VS Code, Cursor, VSCodium, Windsurf, Sublime Text, Vim and Neovim (highlighting, file icon, autocomplete with docs). All options, requirements and building from source: Installation.

korr -e 'print("Hello, Korr!")'

korr new myapp && cd myapp
korr main.krr            # http://localhost:8080
korr test                # run its tests
korr build main.krr      # ./main is a single executable you can deploy

A taste of the language

// variables
let name = "Ana"
const LIMIT = 3

// functions with defaults, named arguments and type hints
fn greet(who: str, greeting = "Hello") -> str
    return "{greeting}, {who}!"

print(greet("Budi"), greet(greeting: "Halo", who: "Sari"))

// collections, comprehensions and pipelines
let scores = [72, 95, 88, 64]
let passed = [s for s in scores if s >= 70]
let report = scores
    .sort()
    .map(fn(s) => s.fixed(1))
    .join(", ")

// pattern matching
fn grade(score) => match score
    90..=100 => "A"
    75..90 => "B"
    s if s >= 60 => "C"
    _ => "D"

// errors are values you can catch
try
    let data = json.decode(fs.read("config.json"))
catch err
    print("Could not load config: {err.message}")

Documentation

Start here Guides Reference & operations
Introduction: what Korr is, strengths, limits Language guide Standard library (API)
Installation: every OS, every option Full-stack web Deployment
Getting started: first program and web app Databases Security model
  CLI apps & the korr command Building from source
  Packages Extending Korr with Rust
    Node.js vs PHP vs Python vs Korr

Docker: docker run --rm ghcr.io/refkinscallv/korr version. GitHub Actions: uses: refkinscallv/korr@v0.13.1 installs Korr in CI (details). The documentation is also a website: https://refkinscallv.github.io/korr/.

How Korr works inside, for contributors and anyone learning how languages are built: Korr internals.

Status

Korr 0.13 is young: the language, standard library, web server and tooling in the docs are implemented and tested on Linux, macOS and Windows. It is a good fit for APIs, websites and internal tools with modest traffic, and for CLI tools. Know the limits before you choose it: programs have no threads of their own (the server handles requests concurrently with workers), types are checked at run time, and HTTPS needs a reverse proxy: see Introduction: Limitations and the roadmap.

Contributing

Contributions are welcome: bug reports, docs, examples, packages and code. See what is planned in the roadmap, then read CONTRIBUTING.md to get started, and follow the Code of Conduct. Report security problems privately as described in SECURITY.md. Changes are listed in CHANGELOG.md.

Korr is created and maintained by refkinscallv.

License

MIT