
Drogon
A C++ web framework for building fast, asynchronous HTTP servers and REST APIs
- Stars
- 14.4k
- Forks
- 1.4k
- Licence
- MIT
- Language
- C++
- Last update
- 4 days ago
- Type
- Framework
What it is
Drogon is a framework for writing web server programs in C++. It handles HTTP requests, routing to controller classes, JSON responses, WebSockets, and database access without blocking while waiting on I/O. People use it when they want a C++ backend or REST API and need the speed and control that C++ offers.
- Build a JSON REST API with HttpController and path parameters
- Serve HTML pages rendered from CSP view templates
- Add WebSocket endpoints for live server-client messaging
- Read and write PostgreSQL or MySQL asynchronously from request handlers
Great for
- C++ developers building HTTP or REST API backends
- Teams that need non-blocking, high-concurrency network I/O in C++
- Projects that want built-in support for PostgreSQL, MySQL, SQLite, or Redis
- Developers who want controllers kept separate from the main program
Not ideal for
- Developers without C++ experience, since the code and build process are C++ only
- Projects that need a ready-made binary or installer, since the latest release lists no binaries
- Simple static sites or scripts where a higher-level language framework would be quicker to set up
How to get it
- 1
Clone and build from source
Clone the repository
git clone https://github.com/drogonframework/drogon - 2
Run it
- Clone the repository and follow the build instructions in the full README
- Write a main() that calls app().loadConfigFile("./config.json").run() or uses app().addListener(...).run()
- Generate a controller with drogon_ctl create controller TestCtrl
- Add your logic to the generated asyncHandleHttpRequest method
- Run the program and request the path you defined, such as http://ip/test
- 3
Get the most out of it
- Use a config.json file with loadConfigFile to change settings without recompiling
- Use HttpController with METHOD_ADD to map paths and parameters for RESTful routes
- Use filter chains to run shared logic such as login checks before handlers
- Use the drogon_ctl tool to generate controllers and CSP view code
- Use the built-in ORM for mapping objects to database tables
Downloads
Strengths
- Asynchronous, non-blocking I/O designed for high concurrency
- Controllers are decoupled from the main program, keeping main() short
- Broad built-in feature set: HTTPS, WebSocket, sessions, compression, ORM, and database clients
Trade-offs
- Requires C++ knowledge and a C++ build environment, which is a steep learning curve for beginners
- The README's install instructions were not visible in the provided excerpt, so setup details must come from the full project docs
- Version support is stated inconsistently: the description says C++14/17/20, while the overview says C++17/20
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| drogon (this) | 14.4k | Framework | advanced | 4 days ago | C++ developers building HTTP or REST API backends |
| cpp-httplib | 17k | Library | beginner | 6 days ago | C++ developers who need a simple embedded HTTP server or client without a large framework |
| http-server | 14.2k | CLI | beginner | 7 months ago | Front-end developers who want to preview a static site or single-page app locally |
| elysia | 19.3k | Framework | intermediate | 8 days ago | TypeScript developers building HTTP APIs or web servers |
| vapor | 26.2k | Library | intermediate | 4 days ago | Swift developers who want to build backend services in the same language as their iOS or macOS apps |
| kivy | 19k | Framework | intermediate | 4 days ago | Python developers who want one codebase for desktop and mobile apps |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.