Modern C++26 Chat Server Template: CMake, Ninja, GCC and vcpkg
A C++26 distributed system template that builds with the same commands on Windows and Linux. It ships with a CORS-enabled REST API, a full-duplex WebSocket chat server, end-to-end encrypted rooms with AES-256-GCM, persistent messages in SQLite, Tor SOCKS5 support and Catch2 unit tests.
Performance & metrics
- LTO and strip in release builds for a smaller, faster binary
- Asynchronous full-duplex connections on Boost.Asio
- SQLite WAL mode keeps reads and writes from blocking each other
Why I built it
I kept losing the same week on every new C++ project: the compiler, the package manager, presets, the test setup and MinGW on Windows. I wanted to do it once, properly, and turn it into a template. Instead of an empty "Hello World", I put a real system inside, so you can see from day one how the networking, encryption, database and test layers fit together.
Architecture & decisions
CMake 3.30+ presets (CMakePresets.json) pick the x64-mingw-static vcpkg triplet on Windows and x64-linux on Linux; dependencies install automatically from the vcpkg.json manifest and build in parallel with Ninja. The code is layered: backend/ (HTTP and WebSocket handlers, server state), client/ (WebSocket client), services/ (crypto, database, JSON) and config/. Messages are encrypted with AES-256-GCM using a PBKDF2-derived key and stored in SQLite in WAL mode. The client switches to a Tor SOCKS5 proxy (RFC 1928) automatically for .onion targets. Release builds are shrunk with LTO and symbol stripping. build.ps1 handles building, testing and running, while the separate controller.ps1 manages a running server's rooms and configuration over REST.
Key features
- Configure, build, test and run with one command (
build.ps1:-Server,-Client,-Rebuild,-SkipBuild) - Room-based WebSocket chat with end-to-end encryption in password-protected rooms
- Create, close, delete and configure rooms over REST with
controller.ps1, no Postman needed - SQLite (WAL) message persistence and logging with spdlog
- Catch2 v3 unit tests for crypto, database, HTTP and JSON
- A development environment setup script for Windows (
setup-cpp-env.ps1)
Technical review
The template's real value is removing the boring part: clone the repo, run .\build.ps1 -Server and you have a running server that has already passed its tests. The scripts follow single responsibility; the build script doesn't manage the server and the management script never touches the build.
Related projects
Friendly Computer Cat: OS-Level Pomodoro Enforcer & Session Tracker
A native, hardware-level focus enforcer and Pomodoro tracker. Utilizes low-level Win32 hooks to physically lock peripheral input during mandatory rest cycles, breaking hyper-focus loops while persisting historical work session data via an SQLite backend.
- C
- C++
- Raylib
- +5
C++ SQLite RESTful Library API
A high-performance, statically compiled REST API built in C++ to manage library transactions, leveraging the SQLite3 C API for direct memory-to-disk persistence.
- C++
- cpp-httplib
- SQLite3 C API
- +1
Networking & Protocols
Major project
Cyberia & Wired Protocol
A secure, decentralized operating system and network layer built on Wired — a custom, high-performance communication protocol. Instead of HTTP, it uses a mutually encrypted TCP handshake and AES-encrypted WebSocket payloads for strong data confidentiality.
- Rust
- C++
- Tauri
- +6
Need something similar?
I can build a system like this for you, too.
Describe your project in a few sentences, and we'll work out the right approach and an estimated scope together.