# 🧪 Kaanal: a one-file mock back end that imitates latency, failures and load limits

All Today · published 2026-12-01T06:30:00Z · https://all-today.com/product/98daa4f4-a2da-4810-9704-31e443f7d964?lang=en

![Terminal showing a 200 then a 503 from the db node with hop timings](https://img.all-today.com/d/44c5afb574014c3d8377012e0f7a5593/AdNPz7mM7JuX0tSkWLlZ8EnH3eCvP8MJR5ZXTS44pzU.jpg)

- 🧪 Kaanal is a single Rust binary (version 0.1.1, Apache-2.0) that imitates a back end with latency and outages.
- It generates responses from OpenAPI specs, can be disturbed with chaos switches and simulates load.
- Everything lives in one kaanal.yaml, driven through Studio, CLI or an HTTP API.

🧪 Typical mock servers answer instantly, which hides spinners, timeouts and retry storms. Kaanal by [Naveen R.](https://kaanal.naveenr.in) delays answers according to the chain of gateway, service, cache and database behind a route. It is a single Rust binary under Apache-2.0 (version 0.1.1). According to the project page it generates schema-valid test data, can inject latency, 5xx errors, TCP resets or hangs at any node, and uses the same model for load runs and sizing estimates.

**Structure.** One file, kaanal.yaml, describes the topology: nodes such as a gateway (nginx, Envoy), a service backed by an OpenAPI 3.0 spec, a database, a cache (Redis or Memcached), an external dependency, a local identity provider issuing JWTs, a load balancer and an object store; nine node types in all, acyclic by construction. For each node you give response times as p50 and p99, plus connection pools, queues, retries and circuit breakers. The same running instance can be driven from the Studio interface, the command line, an HTTP control API, Playwright tests or CI scripts.

**Mocking.** `kaanal init openapi.yaml` generates the configuration from an OpenAPI file, `kaanal up -d` starts the stack, and a `curl` to a route returns test data that, per the project page, matches names, emails, cities and locales (en-IN, en-US, de-DE and four more). An `x-kaanal-trace` header shows the time of every hop. With the same seed, responses and failure patterns are the same locally and in CI.

**Breaking.** Latency, 5xx errors, TCP resets, malformed bodies, hangs or rate limits can be set at any node or route, also as named scenarios with a time to live; `kaanal cycle` steps through UI states. `kaanal demo` starts an example shop with 24 products and a live chaos bar.

**Simulating.** `kaanal sim sweep` raises traffic until p99 or the error rate crosses a target and shows queues and bandwidth per node; `kaanal sim plan` compares cloud sizing estimates. The preview on the page is only illustrative; the engine runs on your own configuration.

**Security and availability.** According to the project page, Kaanal binds to 127.0.0.1 by default, guards control routes with a 256-bit bearer token and host checks, and makes no outbound calls; generated emails use @example.com. It installs from release archives, crates.io, npm or source. The page compares it with WireMock, Mockoon, Prism, MockServer, Toxiproxy and MSW. It is an early version; if you only need fixed answers, a simple mock does the job.

## Sources

- [Show HN thread](https://news.ycombinator.com/item?id=50714456)
- [Kaanal project page](https://kaanal.naveenr.in/)

---
This post was selected, researched, written and rated by AI. The AI can be wrong: check the sources.
