r/C_Programming • u/Whole-Low-2995 • May 28 '26
Project [Educational Project] CWIST – A minimalist C web framework with HTTP/3 (QUIC) and io_uring support
Hi all,
I am currently developing CWIST (C Web development Is Still Trustworthy), an ongoing project written in pure C. It started from a very simple, personal question: "Why do modern web frameworks have to be so bloated?" Every year, our web stacks get wrapped in more abstraction layers, massive dependency trees, and heavy runtimes. I wanted to look inside that black box. By writing everything from scratch in pure C—all the way down to UDP socket loops, QUIC streams, frame parsing, and memory lifecycles—I wanted to understand the absolute bare minimum required to handle modern network protocols deterministically.
Currently, the project has evolved to support HTTP/1.1, HTTP/2, and HTTP/3 (QUIC via lsquic + BoringSSL).
Here is a quick look at the high-level API ergonomics for route definition and path parameter extraction:
/**
* @file main.c
* @brief 03-path-params — read :id from the URL.
*/
#include <cwist/app.h>
#include <cwist/net/http/query.h>
#include <stdio.h>
static void show(cwist_http_request *req, cwist_http_response *res) {
const char *id = cwist_query_map_get(req->path_params, "id");
char buf[64];
snprintf(buf, sizeof(buf), "Post ID: %s", id ? id : "unknown");
cwist_sstring_assign(res->body, buf);
}
int main(void) {
cwist_app *app = cwist_app_create();
cwist_app_get(app, "/posts/:id", show);
cwist_app_listen(app, 8080);
cwist_app_destroy(app);
return 0;
}What I am learning & implementing
Instead of relying on third-party runtimes, the core focuses on tight resource control and low-level Linux APIs:
- HTTP/3 over UDP: Implementing asynchronous stream callbacks and managing QUIC connection states natively. It includes ECN (Explicit Congestion Notification) support and connection migration handling.
- Kernel-space Optimization: I am currently working on an
io_uringbackend to optimize packet submission/completion loops, aiming to maximize throughput under heavy HTTP/3 UDP workloads. - Deterministic Memory Lifecycle: One of my biggest learning curves was avoiding heap fragmentation during high-concurrency streaming. Token matching and path parameter parsing (
req->path_params) utilize a strictly managed lifetime model instead of aggressivemalloc/freethrashing. - Multiport Facade: Currently refactoring the architecture to support a multiport facade (
cwist_multiport_t), allowing users to detach additional ports into isolated, independently tunable sub-applications.
Current Project Status
This is an educational showcase and an active implementation, not a production-ready tool. The repository currently includes in-tree implementations for basic routing, middleware pipelines, Prometheus metrics, and a unified graceful shutdown mechanism across HTTP/1/2/3 event loops.
Right now, I am focusing on hardening the io_uring packet loop and debugging edge-case HTTP/3 frame type interactions.
Since this is a massive learning journey for me regarding low-level network engineering, I would highly appreciate any code-level or architectural feedback—especially concerning safe C memory patterns for asynchronous UDP/QUIC event handling, or efficient token parsing.
•
u/AutoModerator May 28 '26
Hi /u/Whole-Low-2995,
Your submission in r/C_Programming was filtered because it links to a git project.
You must edit the submission or respond to this comment with an explanation about how AI was involved in the creation of your project.
While AI-generated code is not disallowed, low-effort "slop" projects may be removed and it's likely that other users push back strongly on substantially AI-generated projects.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/skeeto May 29 '26
Ran into a UBSan crash trying it out:
Quick fix:
1
u/TheChief275 May 29 '26
"What I'm learning" ?? You're not learning anything with this AI slop
2
u/[deleted] May 30 '26
[removed] — view removed comment