Modern C++ Web Framework β Fast, Lightweight & Developer-Friendly
Xpress++ is a high-performance C++ web framework inspired by the simplicity of Express.js and the efficiency of modern C++ networking. Built for speed, safety, and ease of use β without compromising advanced features.
π Rewritten core with faster routing engine π New Request & Response API π Advanced Caching (ETag, Cache-Control, No-Cache) π Cookie Manager (set, read, clear, options) π Bearer Authentication Helpers π Mobile Detection + Content Negotiation π CSV, XML, JSONP, SSE support π File responses (inline + download) π Metrics + Server-Timing π Pagination helper π Pattern-matching routes π Unified error / success responses π Static security headers + CSP π Rate-limit headers π Full request introspection π Better redirect & status helpers π Trusted proxies support π New ServerConfig System
git clone https://github.com/QuickDigi/Xpress.git
cd Xpress
mkdir build && cd build
cmake ..
make -j8Or include it as a header-only dependency in your project.
#include <xpresspp/app.hpp>
#include <xpresspp/server.hpp>
using namespace xpresspp;
int main() {
App app;
app.get("/", [](Request& req, Response& res){
res.json({{"message", "Hello from Xpress++!"}});
});
ServerConfig config;
config.port = 5000;
Server server(app, config);
server.run();
}- Super-fast routing
- Params, query, full URL parsing
- Pattern-based routes (
/user/:id) - JSON / HTML / Text responses
app.all("*")for wildcard routes- Request body parser (JSON)
req.getBearerToken()req.isAuthenticated()- Token & cookie-based checks
- Auto security headers
- CSP support (
res.csp()) - Proxy trust support
- CORS (
res.cors(),res.corsPreFlight())
- ETag support
- Cache-Control helpers
- Freshness validation
- Response compression-friendly
req.accepts("application/json")- Mobile detection
- XHR detection
- CSV, XML, JSONP support
- Set/read/clear cookies
- Options: maxAge, secure, httpOnly, sameSite
- Inline file serving
- File download
- Attachments
- Server metrics
- Server-Timing header
- Request duration
- Health endpoint
- Pagination (
res.paginate()) - Error/Success formatters
- Rate-limit headers
app.get("/auth/bearer", [](Request& req, Response& res){
if (req.getBearerToken() != "secret-token-123")
return res.error(403, "Invalid token");
res.success({{"user","admin"}}, "Authenticated");
});res.cookie("session", "abc123", {
.maxAge = 3600,
.httpOnly = true,
.secure = false,
.sameSite = "Lax"
});res.download("file.txt", "download.txt");res.sse("Hello!", "update", "1");/src
/routes
/controllers
/middleware
main.cpp
/include/xpresspp
app.hpp
server.hpp
request.hpp
response.hpp
/examples
/docs
ServerConfig cfg;
cfg.host = "localhost";
cfg.port = 5000;
cfg.threadPoolSize = 8;
cfg.enableCORS = true;
cfg.enableMetrics = true;
cfg.maxRequestSize = 5 * 1024 * 1024; // 5MB| Test | Result |
|---|---|
| JSON response | ~52k req/s |
| HTML response | ~48k req/s |
| File serving | ~41k req/s |
| Routing (params) | ~62k req/s |
Benchmarks run on AMD A8 R7 (same as dev-machine).
MIT β completely free for personal & commercial use.
QuickDigi β Egyptian tech innovator πͺπ¬ Developer: Mohammed Mostafa Brawh
If you like Xpress++ β Star the repo β It keeps the project alive!