Open-source projects categorized as header-only
Language: + C++ + CMake

Top 23 header-only Open-Source Projects

  • json

    JSON for Modern C++

    Project mention: Learn Modern C++ | news.ycombinator.com | 2023-12-26

    I have not done a "desktop" program in 25+ years and never using C++ (or C), since then I'm mostly a web developer (PHP,Elixir, JS, Kotlin etc).

    I'm currently doing a C++ audio plugin with the Juce framework.

    This website has been a good resource, alongside https://www.learncpp.com

    But I was actually close to give up before using those two things:

    - https://github.com/nlohmann/json : my plugin use a json api backend and the Juce json implementation is atrocious (apparently because of being born in previous c++ version), but this library is GREAT.

    - ChatGPT 4. I'm not sure I would have "succeeded" without it, at least not in a reasonable time frame. ChatGPT 3.5 is slow and does not give good results for my use case but 4 is impressive. And I use in a very dumb way, just posing question in the web UI. I probably could have it directly in MSVC?

    Also I must say, for all its flaws, I have a renewed appreciation for doing UI on the web ;)

  • spdlog

    Fast C++ logging library.

    Project mention: Easy logging A logging system for c++20 | /r/cpp | 2023-12-09

    SpdLog https://github.com/gabime/spdlog

  • JetBrains Dev Survey

    What’s up with the C++ ecosystem in 2023? JetBrains Developer Ecosystem Survey 2023 has given us many interesting insights. The Embedded (37%) and Games (39%) industries are already working with C++20, developers are incorporating static analysis in their CI, and ChatGPT usage among coders is flourishing. Read on for more!

  • cpp-httplib

    A C++ header-only HTTP/HTTPS server and client library

    Project mention: Experience using crow as web server | /r/cpp | 2023-11-06

    Alternatives at the low to medium level of abstraction include civetweb and mongoose, which have a common ancestor. Both of these appear to be C rather than C++, but seem to be production quality and well-documented. Another C library is cpp-httplib, which is probably too low-level for me.

  • entt

    Gaming meets modern C++ - a fast and reliable entity component system (ECS) and much more

    Project mention: Focus: A simple and fast text editor written in Jai | news.ycombinator.com | 2023-09-02

    https://pastebin.com/VPypiitk This is a very small experiment i did to learn the metaprogramming features. its an ECS library using the same model as entt (https://github.com/skypjack/entt). In 200 lines or so it does the equivalent of a few thousand lines of template heavy Cpp while compiling instantly and generating good debug code.

    Some walkthrough:

    Line 8 declares a SparseSet type as a fairly typical template. its just a struct with arrays of type T inside. Next lines implement getters/setters for this data structure

    Line 46 Base_Registry things get interesting. This is a struct that holds a bunch of SparseSet of different types, and providers getters/setters for them by type. It uses code generation to do this. The initial #insert at the start of the class injects codegen that creates structure members from the type list the struct gets on its declaration. Note also how type-lists are a native structure in the lang, no need for variadics.

    Line 99 i decide to do variadic style tail templates anyway for fun. I implement a function that takes a typelist and returns the tail, and the struct is created through recursion as one would do in cpp. Getters and setters for the View struct are also implemented through recursion

    Line 143 has the for expansion. This is how you overload the for loop functionality to create custom iterators.

    The rest of the code is just some basic test code that runs the thing.

  • GLM

    OpenGL Mathematics (GLM)

    Project mention: Release of GLM 1.0.0 | news.ycombinator.com | 2024-01-24
  • Crow

    Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)

    Project mention: VueJS goes to microcontroller firmware. This website runs in ESP32 board, with frontend is made with VueJS, TailwindCSS and backend is written in C++. | /r/vuejs | 2023-04-14

    I did something similar in the past and used https://github.com/ipkn/crow as web server, in case you want to not implement the web part yourself. Otherwise amazing job!

  • GuiLite

    ✔️The smallest header-only GUI library(4 KLOC) for all platforms

    Project mention: Bombed an interview and trying to figure out how to pivot. Any advice on on increasing code literacy and filling in knowledge gaps from EE? | /r/embedded | 2023-12-06
  • LearnThisRepo.com

    Learn 300+ open source libraries for free using AI. LearnThisRepo lets you learn 300+ open source repos including Postgres, Langchain, VS Code, and more by chatting with them using AI!


    Features: - Functional style. Inspired by [1] and React - Simple and elegant syntax (in my opinion). - Support for UTF8 and fullwidth chars (→ 测试). - No dependencies. - Cross platform. Linux/mac (main target), Windows (experimental thanks to contributors), - WebAssembly. - Keyboard & mouse navigation. Operating systems: - linux emscripten - linux gcc - linux clang - windows msvc - mac clang

    Project mention: Library for NES style terminal game. | /r/cpp_questions | 2023-09-30

    Background: I want to make a NES Tetris) clone for the terminal, with full resolution, this is achievable through using this ▀ character, and defining back and foreground color. This would result in a 1x2 pixel and by making the game width 256x120 characters this would provide full resolution. I made some tests, creating my own encoding for the different sprites and optimizing everything, which resulted in very quick printing times, even with a normal terminal. Nearly fast enough for the full 60Hz that the NES has, when printing the whole screen. The fact that i don't need to reprint the background (except maybe a tetris), makes 60Hz a kinda realistic goal. My main concern is, that there could occur kind of a screen tearing effect, which i really want to avoid. AFAIK, ncurses has a way to print the whole "window" with a function call to avoid this issue, however I had a lot of issues when trying to use ncurses to print the entire background and figured, that there are better alternatives. I also tried FTXUI and whilst the experience of giving each "pixel" a fore- and background color was much better, i didn't quite find a way to refresh the screen like ncurses. (i think there is some kind of way with the ScreenInteractive class, but i didn't get that to work, and it seemed like there was not a way to color each pixel. with InteractiveScreen you can make your own components with the whole "text()" thing, but this isn't really what i need)

  • doctest

    The fastest feature-rich C++11/14/17/20/23 single-header testing framework

    Project mention: Unit testing tool suggestions | /r/learnprogramming | 2023-05-07

    I have never used "tools" for unit-tests, only web sites that show the results of the tests or code coverage. For C++ I prefer https://github.com/doctest/doctest but most companies I worked for use Catch2.

  • Magic Enum C++

    Static reflection for enums (to string, from string, iteration) for modern C++, work with any enum type without any macro or boilerplate code

    Project mention: What C++ library do you wish existed but hasn’t been created yet? | /r/cpp | 2023-07-08

    I'm not sure this is quite what you're asking for, but this library has been super helpful to me in the past : https://github.com/Neargye/magic_enum

  • compile-time-regular-expressions

    Compile Time Regular Expression in C++

    Project mention: Why are strings and IO so complicated? | /r/cpp | 2023-12-07

    CTRE (https://github.com/hanickadot/compile-time-regular-expressions) ranges::views (filter, transform, etc.) (C++20) str.find() + str.substr() freopen to stdin + cin >> extraction Parser libraries

  • awesome-hpp

    A curated list of awesome header-only C++ libraries

  • indicators

    Activity Indicators for Modern C++

  • Crow

    A Fast and Easy to use microframework for the web. (by CrowCpp)

    Project mention: Experience using crow as web server | /r/cpp | 2023-11-06

    I'm investigating using C++ to build a REST server, and would love to know of people's experiences with Crow-- or whether they would recommend something else as a "medium-level" abstraction C++ web server. As background, I started off experimenting with Python/FastAPI, which is great, but there is too much friction to translate from pybind11-exported C++ objects to the format that FastAPI expects, and, of course, there are inherent performance limitations using Python, which could impact scaling up if the project were to be successful.

  • argparse

    Argument Parser for Modern C++

    Project mention: Command line interface library | /r/Cplusplus | 2023-03-24

    The most feature-rich C++ CLI library is CLI11. Other popular choices include Boost.ProgramOptions, argparse, cxxopts and others.

  • plog

    Portable, simple and extensible C++ logging library

    Project mention: Fully Permissive License C++ Logger For Embedded System | /r/embedded | 2023-06-28
  • palanteer

    Visual Python and C++ nanosecond profiler, logger, tests enabler

  • FunctionalPlus

    Functional Programming Library for C++. Write concise and readable C++ code.

    Project mention: Leaving Haskell Behind | news.ycombinator.com | 2023-08-24

    Hoogle is really amazing!

    Inspired by it, I implemented something similar for FunctionalPlus (a functional-programming library for C++): https://www.editgym.com/fplus-api-search/

    I'd love to see more projects taking this path too. :)

  • Nameof C++

    Nameof operator for modern C++, simply obtain the name of a variable, type, function, macro, and enum


    Parsing Expression Grammar Template Library

    Project mention: Show HN: Matcheroni, a tiny C++20 header library for building lexers/parsers | news.ycombinator.com | 2023-07-06

    Very cool, and I like the name!

    I'd be interested in reading about how Matcheroni compares with PEGTL and Lexy.


  • cppzmq

    Header-only C++ binding for libzmq

  • uvw

    Header-only, event based, tiny and easy to use libuv wrapper in modern C++ - now available as also shared/static library!

  • cmake-init

    The missing CMake project initializer

    Project mention: CMake install schema for single- and multi-config generators | /r/cpp | 2023-12-06

    https://github.com/friendlyanon/cmake-init This is how you do CMake properly. If you deviate from its install rules you are highly likely to do something wrong.

  • WorkOS

    The modern API for authentication & user identity. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020). The latest post mention was on 2024-01-24.

header-only related posts


What are some of the best open-source header-only projects? This list will help you:

Project Stars
1 json 39,123
2 spdlog 21,484
3 cpp-httplib 11,417
4 entt 9,221
5 GLM 8,464
6 Crow 7,372
7 GuiLite 7,100
8 FTXUI 5,812
9 doctest 5,443
10 Magic Enum C++ 4,244
11 compile-time-regular-expressions 3,097
12 awesome-hpp 3,077
13 indicators 2,747
14 Crow 2,558
15 argparse 2,230
16 plog 2,033
17 palanteer 2,027
18 FunctionalPlus 1,952
19 Nameof C++ 1,899
20 PEGTL 1,828
21 cppzmq 1,779
22 uvw 1,729
23 cmake-init 1,654
Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.