src/router.c // pattern_match live source
// Thread-safe URL pattern matching using strtok_r
static int match_pattern(const char* pattern, const char* path, Request* req)
{
    if (!strchr(pattern, '{'))
        return strcmp(pattern, path) == 0;

    char pat_copy[256], path_copy[256];
    strncat(pat_copy, pattern, sizeof(pat_copy) - 1);
    strncat(path_copy, path, sizeof(path_copy) - 1);

    char *save1, *save2;
    char* p_seg    = strtok_r(pat_copy,  "/", &save1);
    char* path_seg = strtok_r(path_copy, "/", &save2);

    while (p_seg && path_seg) {
        if (p_seg[0] == '{') {
            // extract {id} → bind to request param
            request_set_param(req, param, path_seg);
        } else if (strcmp(p_seg, path_seg) != 0) {
            return 0;
        }
        p_seg    = strtok_r(NULL, "/", &save1);
        path_seg = strtok_r(NULL, "/", &save2);
    }
    return (p_seg == NULL && path_seg == NULL);
}
Request Pipeline
  • src/server.c socket loop / pthread dispatch
  • src/router.c pattern match + param bind
  • src/middleware.c linked-list chain
  • src/static.c /static/* → public/*
  • src/view.c handlebars-style engine
  • src/response.c html / json / bytes
Source Topology
1,559
Lines, src + ctrl
7
HTTP routes registered
3
Template directives
0
Runtime dependencies
Template directives
{{ key }} interpolate
{{#if x}} ... {{/if}} conditional
{{#each rows}} ... {{/each}} iterate
Adjacent Systems frameworks // languages // gateways
.cob → .so
in_development
[0x02]_COBRE

Razor-pages-inspired web framework in C

.cob source files transpile to .gen.c, then compile to .so and hot-load. Arena allocator with a Str type, goto cleanup error handling, TOML config. The opinionated successor to c-copper.

C transpiler arena allocator .so hot-load
[0x03]_LUNAR

Statically-typed superset of Lua

Compiler, LSP, bundler, test framework — all in Go. TypeScript-for-Lua, end to end. Strong types on top of Lua semantics so projects that grew past the comfortable Lua size still have a teaching tool for the next person to read them.

Go compiler LSP bundler source →
ts → lua
active
gateway
archived
[0x04]_AXON

Self-hosted LLM gateway — archived

First pass at an on-premise LLM gateway in C#. Routing, request shaping, prompt template layering. Useful exercise in API surface design and provider abstraction; stays in the archive.

C# gateway predecessor