Introduction
Oat++ is a modern C++ web framework designed for high-performance HTTP services with zero external dependencies. It provides object mapping, Swagger integration, and connection handling out of the box, making it practical for production C++ APIs and microservices.
What Oat++ Does
- Serves HTTP/1.1 requests with async and blocking execution models
- Maps C++ objects to JSON and back using code-generated DTOs
- Provides built-in Swagger/OpenAPI documentation generation
- Supports WebSocket connections for real-time communication
- Handles database interaction through typed ORM-style query builders
Architecture Overview
Oat++ uses a layered design: an HTTP connection handler dispatches to a router, which maps requests to controller endpoints. Data Transfer Objects (DTOs) define typed request and response bodies. The framework compiles without any third-party library, relying only on the C++ standard library and OS sockets.
Self-Hosting & Configuration
- Build from source with CMake; no package manager dependencies needed
- Define API endpoints in controller classes using macro-based routing
- Configure server port, connection limits, and threading in the AppComponent
- Enable Swagger UI by adding the oatpp-swagger module
- Choose between simple (blocking) and async (coroutine-based) server modes
Key Features
- Truly zero external dependencies; compiles on any platform with a C++11 compiler
- Built-in Swagger UI generation from annotated endpoints
- Async server mode using coroutines for high-concurrency scenarios
- Typed DTO system catches serialization mismatches at compile time
- Modular ecosystem with extensions for PostgreSQL, SQLite, WebSocket, and more
Comparison with Similar Tools
- Drogon — Drogon offers similar performance with a broader async ecosystem; Oat++ emphasizes zero dependencies and simpler bootstrapping
- Crow — Crow is a microframework with Flask-like simplicity; Oat++ provides more structure with DTOs and Swagger support
- cpp-httplib — cpp-httplib is header-only for simple cases; Oat++ adds routing, serialization, and API documentation
- Pistache — Pistache focuses on REST; Oat++ extends to WebSocket and database layers
FAQ
Q: Does Oat++ require Boost or any other library? A: No. Oat++ has zero external dependencies. Optional modules like oatpp-postgresql add specific integrations.
Q: How does Oat++ handle JSON serialization? A: You define DTO classes with macros like DTO_FIELD. The framework generates serializers that map between C++ objects and JSON automatically.
Q: Is Oat++ suitable for production use? A: Yes. Oat++ is used in production services and benchmarks competitively with other C++ frameworks.
Q: What platforms does Oat++ support? A: Linux, macOS, Windows, and FreeBSD. Any platform with a C++11 compiler and POSIX or WinSock sockets.