Show HN: Cwist — Tiny, Easy, and Structured Web Framework for C github.com · 2 p...

@show

Show HN: Cwist — Tiny, Easy, and Structured Web Framework for C github.com · 2 points · 1 comments · HN thread

TL;DR CWIST is a C17 web framework and application server offering routing, middleware, templates, sessions, validation and an embedded SQLite ORM over HTTP/1.1, HTTP/2, HTTP/3, WebSocket and WebTransport, with an io_uring/epoll/kqueue reactor. The same app can run as a native server, on a WASI 0.2 edge runtime, or inside a browser Service Worker. The thread has one commenter, the author, who explains the design and asks for contributions.

  • One CWIST app can be served from a native server, a WASI 0.2 edge runtime (Wasmtime), or a browser Service Worker, depending only on the host entry point.
  • The reactor mode is the default and targets throughput and connection density; the Classic thread-per-connection pool targets median latency.
  • In the author's latest published benchmark (wrk -t12 -c400), the reactor reached 183,303 req/s versus 174,662 for Actix and 151,695 for Axum, with higher P99.999 tail latency than Actix and Axum.
  • Safety measures include ASan/UBSan builds, an h2spec baseline, a malloc allocator gate, and a libFuzzer target for only one parser; fuzzers for HTTP/1.1, HTTP/2, WebSocket and multipart are not yet written.
  • Dependencies (BoringSSL, lsquic, libttak, SQLite) are vendored, and Homebrew and pkg-config packaging are provided.
  • The WASM hosts are newer than the native server, and the README says the WASI demo does not promise crash-durable writes.

Discussion The thread is a single comment from the project's author, responding to the Show HN post. It is a short, self-deprecating and candid reply: the author says the project was built for fun and is not a strong portfolio piece, compares the README's hello-world to an alternative API style, and discusses why function-based APIs suit LLM-assisted coding better than struct members. They list the CI checks they run, mention the external benchmark site, note that the maintainer team is small, and invite pull requests. Overall the mood is modest and open rather than promotional.

  • Simple function-based API is preferable to struct-member setup (a few): The commenter argues that public functions are easier to get right, including for code produced by LLMs, than configuration set through struct members. They suggest unifying naming conventions across the API to make it simpler.
  • Project is a hobby, not production-grade compared to mature C frameworks (a few): The author says CWIST is a toy project for personal blogs and is not a good portfolio for C jobs. They say mature frameworks such as Drogon are better suited to production, though CWIST runs its own checks including sanitizers and soak tests.

Links from the comments

#C #webFramework #httpServer #WebAssembly #benchmarks