Skip to content

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
Step-by-step guide: how to use DrogonInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    Clone the repository

    git clone https://github.com/drogonframework/drogon
  2. 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. 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

ProjectStarsTypeLevelUpdatedBest for
drogon (this)14.4kFrameworkadvanced4 days agoC++ developers building HTTP or REST API backends
cpp-httplib17kLibrarybeginner6 days agoC++ developers who need a simple embedded HTTP server or client without a large framework
http-server14.2kCLIbeginner7 months agoFront-end developers who want to preview a static site or single-page app locally
elysia19.3kFrameworkintermediate8 days agoTypeScript developers building HTTP APIs or web servers
vapor26.2kLibraryintermediate4 days agoSwift developers who want to build backend services in the same language as their iOS or macOS apps
kivy19kFrameworkintermediate4 days agoPython 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.