Skip to content

Zuno Architecture

Zuno is designed as a modern, modular, high-performance HTTP framework for C++20. Its architecture is built around a middleware pipeline, an efficient routing engine, and direct integration with Asio for asynchronous operations.


[HTTP Client]
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Server β”‚ ←— TCP socket (Asio)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Middleware Pipeline β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Routing Engine β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Route Handler β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ HTTP Response β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Zuno uses Asio as its networking backend to handle TCP connections efficiently and asynchronously. Each incoming connection is processed through an event loop without blocking threads.


Every request flows through a chain of middleware before reaching the final handler. This enables:

  • Authentication
  • Logging
  • CORS
  • Compression
  • Rate limiting

Example:

app.use(logging());
app.use(cors());
app.use(rateLimit({ .max = 10 }));

Each middleware receives (Request&, Response&, Next) and can choose to continue or short-circuit the flow.


Zuno implements a hierarchical router that supports:

  • Static routes (/about)
  • Dynamic routes (/users/:id)
  • Query parameters (?q=value)
  • Modular route grouping

The router maps the URL to an efficient match tree and dispatches to the appropriate handler.


Handlers are lambdas that implement your business logic:

app.get("/hello/:name", [](Request& req, Response& res) {
res.send("Hello, " + req.params["name"]);
});

They can return plain text, JSON, files, or any custom response.


Zuno provides a fluent API for building responses:

res.status(200).json({
{ "message", "Success" }
});

You can also send files, redirects, or custom headers.


Zuno is organized into reusable modules:

ModulePurpose
core/Server, routing, base types
extensions/Optional middleware (CORS, TLS, etc.)
examples/Ready-to-run use cases
zuno/zuno.hppUnified entry point for users

Zuno promotes secure defaults:

  • Native TLS support
  • Authentication middleware
  • Configurable rate limiting
  • Safe headers by default


Zuno combines simplicity and power in a modern architectureβ€”built for developers who want full control without sacrificing productivity.