Repository navigation
midad v0.1.3-alpha.1 - early alpha
Pre-releaseEarly alpha. midad is a Markdown-executable language: a .md file holds routes, commands, templates and the code that runs them, and one static binary serves it. This is a pre-release for people who want to try it and report what breaks. Expect breaking changes; the language is pre-1.0 and the changes are written down in CHANGELOG.md rather than smoothed over.
What works in this build
- Routes and a server:
route:METHOD /path handlerblocks, params, query, headers, body,respond/respond_htmlwith status and headers, astatic:directory for unmatched paths, 413 on an oversized body, 500 on a handler error, 503 when every worker is busy. - Compiled handlers: a named route handler compiles to C and is called through a request arena. Not every program compiles; what cannot be done exactly is refused by name at build time instead of miscompiled.
- Templates:
html:NAMEblocks, Pug-style indentation, escaping on by default,if/forinside a template, and the same bytes on every backend. - Multi-file projects:
imports:andmodule:names,midad.toml, per-file permissions that never flow into an import. - A capability model:
fs_read,fs_write,env,net,ffi,listen,ai,db, checked statically and again at run time. - Checked arithmetic:
+ - * / %refuse to overflow in every backend. - Builtins added in this release:
crypto.sha256,crypto.hmac_sha256,hex.encode,hex.decode,random.hex, pinned to the published test vectors (FIPS 180-4, RFC 4231) on both the interpreter and the C backend. - Time and JSON:
time.now/time.iso/time.date/time.parse/time.add_days,json.parse/json.stringify/json.at/json_get. - One-document persistence:
persist:writes a JSON file after every request, write-then-rename.
Numbers, with the caveat that decides them
All of these are medians from interleaved runs on one vCPU, in the same session as the comparison, with the server restarted between runs. The box's speed varies up to about 1.5x between sessions, so compare within a row, not across releases.
- 4-key JSON route: midad 117.1 us/req, Go 129.1 (midad 1.10x faster).
- Full route (5 keys, a concat, a two-item list): midad 175.2 us/req, Go 259.6, Node 325.4 (1.48x and 1.83x).
- 300 KB JSON POST, server reading
body.items[0].name: midad compiled 2.41 ms/req, Go 3.84, Node 1.59, midad interpreted 4.68. Node is faster than us on this route. - Peak RSS flat at 7.4-7.7 MB over eight rounds of 3,000 requests.
BENCHMARKS.mdhas the method and every table, including the ones where midad loses.
What is not there yet
- No database and no user accounts.
persist:is one JSON document rewritten whole after each request. A real site with a database and auth needs a driver layer and a hash/token story;docs/READINESS.mdsays what is missing and what each piece would cost. - No TLS in the server (put a proxy in front), no rate limiting, no per-request logging or request ids.
- No package manager, no structs, no generics, no closures, no test framework in the language.
- No fuzzing harness, and no dependency audit has been run.
docs/SECURITY.mdlists what is checked with the check named, and what is not checked at all. This project makes no claim of being free of vulnerabilities. - Multi-core throughput is unmeasured. This box has one vCPU.
Building it
cargo build --release -p midad
./target/release/midad --version
./target/release/midad run examples/site-demo
install.sh builds and installs it. No prebuilt binary is attached to this release: a binary is only worth attaching if it was built from this exact commit on a clean checkout and tested, and I could not establish that here, so the honest answer is to build it yourself rather than ship something I cannot vouch for.
Where to read more
README.md for the tour, SPEC.md for the language, docs/getting-started.md and docs/cookbook.md to write something, docs/LIMITS.md for the wall you will hit, docs/READINESS.md for what a real project still needs, BENCHMARKS.md for the numbers and their method.