High-performance C++17 API Gateway with HTTPS, reverse proxy, load balancing, health checks, authentication, rate limiting, observability and SIMD/assembly acceleration.
Leia em Portugues: README_PT.md
Read the detailed English README: README_EN.md
Architecture: docs/ARQUITETURA.md
API: docs/API.md
API Gateway is the natural evolution of the original HTTPS server project. The first version focused on TLS, static files, JSON validation, benchmarks and low-level performance experiments. The current version keeps that systems-engineering base and adds gateway behavior on top of it: dynamic routing, reverse proxying, upstream pools, load balancing, active/passive health checks, Token Bucket rate limiting, API key/JWT authentication and operational endpoints.
The result is a compact C++ gateway that can terminate HTTPS, inspect and route requests, protect upstream services and expose runtime visibility while still preserving the original SIMD/assembly performance identity.
- HTTPS server built with OpenSSL.
- Dynamic HTTP router with exact routes, wildcard routes and path params such as
/users/:id. - Dedicated HTTP parser with request limits, case-insensitive headers, body handling through
Content-Length, path/query split and query params. - Middleware pipeline for cross-cutting concerns.
- Static file serving from
client-web/withETag,Last-Modified,Cache-Controland304 Not Modified. - HTTP reverse proxy for internal upstreams.
X-Forwarded-For,X-Forwarded-Proto,X-Real-IPandViaproxy headers.- Hop-by-hop header filtering before forwarding requests.
- Upstream pools with
round_robinandleast_connectionsselection. - Active HTTP health checks and passive failure tracking.
- Token Bucket rate limiting with
429 Too Many RequestsandRateLimit-*headers. - API key authentication, HMAC-SHA256 JWT validation, asymmetric JWT validation through public keys and route-level scope enforcement.
- Optional JSON logs for ingestion by log pipelines.
- Gateway endpoints:
/gateway/health,/gateway/readyand/gateway/metrics. - WebSocket RFC 6455 echo support over TLS, including handshake, text/binary frames, ping/pong and close.
- SIMD/assembly modules for crypto, HTTP scanning, validation, memory, compression and network operations.
- Benchmark endpoints and command-line benchmark targets for crypto/performance checks.
client-web/ static technical frontend
docs/ official documentation
ARQUITETURA.md architecture and implementation notes
API.md endpoints, config and HTTP contracts
scripts/ build and benchmark entrypoints
service-api/service-cpp/ C++ gateway runtime, tests and CMake project
service-api/service-assembly/ assembly acceleration routines
Prerequisites:
- C++17 compiler.
- CMake 3.16+.
- OpenSSL.
- NASM.
- Ninja is optional, but used automatically when available.
Build:
./scripts/build.sh ReleaseWindows with Git Bash:
"C:/Program Files/Git/bin/bash.exe" ./scripts/build.sh ReleaseRun:
./build/api_gateway
# Windows/Git Bash: ./build/api_gateway.exeDefault configuration:
service-api/service-cpp/config/config.json
curl -k https://localhost:8443/gateway/health
curl -k https://localhost:8443/gateway/ready
curl -k https://localhost:8443/gateway/metrics
curl -k https://localhost:8443/api/benchmarkPOST JSON with SIMD validation and network encoding helpers:
curl -k -X POST "https://localhost:8443/api/echo" \
-H "Content-Type: application/json" \
-d '{"message":"hello","encode_data":"gateway"}'The main executable is api_gateway. Test and benchmark binaries are generated in build/ as separate targets, including parser/router/auth tests and crypto benchmarks.
Distributed under the MIT License. See LICENSE.
Thiago Di Faria
Email: thiagodifaria@gmail.com
GitHub: @thiagodifaria
Built as a systems-engineering showcase in C++17, preserving the performance-focused roots of the original HTTPS server while evolving it into an API Gateway.



