Configs2026年7月24日·1 分钟阅读

Oat++ — Zero-Dependency C++ Web Framework

Oat++ (oatpp) is a light, zero-dependency C++ web framework for building high-performance REST APIs, WebSocket services, and microservices with a clean object-mapping API.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Oat++
直接安装命令
npx -y tokrepo@latest install f554ac6c-87a1-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

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.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产