M Mozhi v3.7.0 code
verifiedVersion 3.7.0 — safe calls, rest params, native TLS, 64-bit ints & a ~10x faster evaluator

One language.
Full-stack development.

Mozhi is a fast, safe, C-family scripting language with a native HTTP server, HTML templates, JSON, a filesystem sandbox and SQLite — all inside the interpreter runtime. No PHP, no Python bridge, no child processes.

memoryC interpreter core boltRust bytecode VM inventory_2npm: one-command install verified_userASan + UBSan tested licenseMIT licensed
mozhi a complete web app — native server, no dependencies
import web
import json

let app = web.create({ log: true })

app.get("/", fn(req, res) {
    return res.html("<h1>Hello from Mozhi</h1>")
})

app.post("/api/calculate", fn(req, res) {
    let data = req.json()
    if data.a == null or data.b == null {
        res.status(422)
        return res.json({ error: "a and b are required" })
    }
    return res.json({ result: data.a + data.b })
})

app.listen("127.0.0.1", 8080)

v3.7 — the runtime stability release

shield

Crash-proof calls

Wrong argument counts are a structured RUNTIME010 diagnostic — previously an out-of-bounds read. Plus default values (greeting = "Hello") and variadic ...rest parameters.

Function parameters
link

Null-safe navigation

config?.provider?.model ?? "default-model" — lazy right-hand side, false/0/"" are never treated as null.

Semantics & tests
language

Recoverable HTTP + native TLS

http.request returns { ok, status, error, body, headers } — refused connections and timeouts are values, not crashes. Native OpenSSL TLS with certificate verification on TLS-enabled builds.

Result schema
speed

~8.6x faster hot loops

The 1M-iteration float loop went from 1056 ms to ~122 ms; exact 64-bit integers (1+...+1000000 = 500000500000). Faster than Python 3.12 on 7 of 10 benchmarks.

Benchmark table

Errors that teach you the language

v3.3 adds a package manager: mz install pulls verified libraries from tagged Git releases, and unresolved imports tell you exactly how to install what is missing. On top of that, v3.2's central diagnostics engine gives every failure a stable error code, the exact source span, a suggested fix and a link to its documentation page — and, when you want it, a free AI explanation. Install once with npm install -g @crossberryweb/mozhi and get two commands: mozhi and mz.

packages

Packages — mz install

Install libraries from the version-controlled registry, from any Git repo's tagged releases, or from a local zip: mz install strings. Packages are structure-verified before they land and import like native modules. Scaffold your own with mz pkg new — pushing a v* tag auto-releases <name>.mz.pkg.zip. Package guide.

error

Precise error diagnostics

Stable codes (LEX001, PARSE002, NAME001…), a caret span under the exact token, matched-delimiter hints and suggested fixes. The full reference lives in the error documentation — one page per code.

psychology

Free AI Diagnosis

An anonymous, keyless service explains what went wrong — no API key, no account, no payment. Automatic in interactive terminals, opt-in for scripts with --ai, disable with --no-ai or MOZHI_NO_AI=1. If the service is unreachable, the local diagnosis and exit code are unaffected.

data_object

Machine-readable output

mozhi --json run app.mz emits the mozhi.diagnostics.v1 schema to stderr — codes, spans, reasons, fixes and documentation URLs — ready for editors, CI pipelines and tooling.

terminal

One install, two commands

npm install -g @crossberryweb/mozhi requires Node.js ≥ 22 and bundles fully static Linux binaries — glibc distros, Alpine and Termux/Noxs. mozhi and mz always behave identically: same version, same flags, same exit codes.

Native modules, zero bridges

Every capability below ships inside the interpreter itself — the same process, the same runtime, no glue code and no external interpreters.

language

HTTP server

Routing with path parameters, middleware chains, static files, cookies, custom 404/500 handlers, request limits and graceful shutdown.

web_hello.mzarrow_forward
data_object

Strict JSON

RFC 8259 parser with position-tagged errors, depth limits and surrogate-pair support. Stringify anything, validate before parsing.

json_showcase.mzarrow_forward
database

SQLite

Prepared statements only, tracked migrations, explicit transactions. User input can never become SQL.

db_notes.mzarrow_forward
folder_open

Sandboxed filesystem

Every path resolves against the sandbox root. .. rejected, symlink escapes verified with realpath(), recursion is opt-in.

fs_notebook.mzarrow_forward
auto_awesome

HTML templates

{{ expr }} interpolation with automatic escaping, {% if %} and {% for %}, includes, inheritance and filters.

templates_hello.mzarrow_forward
functions

Math module

Constants, trigonometry, logs, reductions and seeded randomness. Domain errors raise real errors — never silent NaN.

math_showcase.mzarrow_forward

Why Mozhi

speed

Two runtimes, one language

A tree-walking interpreter in C for immediate feedback, and mozhi-fast, a bytecode VM in Rust, for throughput — the same syntax, the same standard library.

shield

Security by default

The v3.1 hardening pass bounds and time-limits HTTP headers, validates every filesystem path through its nearest real ancestor, and ships with an adversarial regression suite plus sanitizer CI.

terminal

Real toolchain

mozhi run, dev with auto-reload, serve, test, fmt, lint and build — plus mozhi.toml project configuration. Every command works identically with the short alias mz.

inventory_2

Standard library in itself

String, collection, crypto, regex and HTTP utility modules are written in Mozhi and installed with mozhi pkg — read them to learn the language.

verified

Every example on this site is executed against the v3.2 interpreter before it ships. The snippets you see run exactly as printed — start with the examples gallery.