Research CommonsResearch Commons
cppnet/Overview

cppnet

A modular C++ networking library for building HTTP servers that speak JSON and Protobuf, with a layered parser, router, and handler design.

cppnet is a C++ networking library for building servers that handle both JSON and Protobuf payloads. It follows a layered architecture — parsing, routing, and business-logic handling — so you wire up endpoints by mapping HTTP methods and paths to typed handlers.

Architecture at a glance

The library is organized into clear layers:

  • Parsing layer — parses incoming HTTP requests (built on llhttp).
  • Routing layer — directs requests to the right handler.
  • Business-logic handling layer — your handlers for each endpoint.
  • Socket layer — manages network I/O. This layer is intentionally left for you to implement (e.g. with Asio) and is not yet provided.

What it gives you

  • JSON & Protobuf support for request/response payloads.
  • An llhttp-based parser that populates a typed Request object (method, path, headers, query params, body).
  • A Router with efficient RouteKey lookups over an unordered_map.
  • A BaseHandler interface so each endpoint is a small, testable class.
  • A documented request lifecycle and a test suite covering the parser and handlers.
Status — bring your own socket layer

cppnet is alpha. The parser, router, and handler layers work and are tested, but the socket layer is not yet implemented — you must provide it (for example with Asio) to run a live server. See the roadmap.

Where to next