SaaSHub helps you find the best software and product alternatives Learn more →
Top 16 C++ single-file Projects
-
-
InfluxDB
InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
-
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
https://github.com/Neargye/magic_enum I chose this project because, while experimenting with enums in my course management project, I realized that I was writing a lot of boilerplate code. I even tried applying generic programming by using the library to avoid meaningless pointers and experimented with templates, but in the end, this approach made the code more complicated than I had thought. In C++, enums are not very flexible by default, it’s not possible to easily iterate through them or convert them to and from strings. This often results in repetitive code and makes programs more prone to errors. With the help of modern C++17 features, however, libraries like magic_enum can make our lives much easier by providing static reflection and avoiding the need for manual stuff. Enums are also a great tool for APIs instead of introducing unnecessary layers of inheritance and polymorphism which could lead to confusion, we can use enums to keep the design simple and clear.
-
Nameof C++
Nameof operator for modern C++, simply obtain the name of a variable, type, function, macro, and enum
-
I found that this repository had no pull request yet so I contacted the owner to get permission to work on it after filing an issue, then I got to work researching how to approach this using C++. My C++ is rusty, so it took me some time to work my way through the code. Finally, with a little research, I worked out that I could use the existing CMake file in this project to set up the tomlplusplus implementation which would allow me to parse a config.toml file and load default options into the tool. I added a new function, loadFromConfig, that reads the TOML file and populates the CLI options struct with values like output, include, exclude, and recent. This way, users can define their preferences once and avoid repeating long command-line arguments.
-
-
-
expected-lite
expected lite - C++23 expected objects for C++11 and later in a single-file header-only library
-
Stream
Stream - Scalable APIs for Chat, Feeds, Moderation, & Video. Stream helps developers build engaging apps that scale to millions with performant and flexible Chat, Feeds, Moderation, and Video APIs and SDKs powered by a global edge network and enterprise-grade infrastructure.
-
span-lite
span lite - A C++20-like span for C++98, C++11 and later in a single-file header-only library
-
string-view-lite
string_view lite - A C++17-like string_view for C++98, C++11 and later in a single-file header-only library
-
-
-
-
-
ring-span-lite
ring-span lite - A C++yy-like ring_span type for C++98, C++11 and later in a single-file header-only library
-
-
std_net
std_net.h` is a zero-dependency, header-only C/C++ networking library for TCP sockets. It abstracts cross-platform complexities (Windows/Linux/macOS/Android/FreeBSD) into a unified API for building clients/servers. Features include IPv4/IPv6 support (Happy Eyeballs), blocking/non-blocking I/O, timeouts, and RAII wrappers. MIT licensed.
Project mention: Show HN: Std_net.h – Single-file cross-platform TCP networking (C/C++) | news.ycombinator.com | 2025-09-09 -
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
C++ single-file discussion
C++ single-file related posts
-
Refactoring with C++17 std::optional
-
Is there a std::string::split or something similar?
-
The 23 year-old C++ developers with three job offers over $500k
-
Nanobench: Fast, Accurate, Single-Header Microbenchmarking Functionality For C++
-
C++ Return: std::any, std::optional, or std::variant?
- A note from our sponsor - SaaSHub www.saashub.com | 23 Dec 2025
Index
What are some of the best open-source single-file projects in C++? This list will help you:
| # | Project | Stars |
|---|---|---|
| 1 | doctest | 6,529 |
| 2 | Magic Enum C++ | 5,861 |
| 3 | Nameof C++ | 2,238 |
| 4 | tomlplusplus | 1,939 |
| 5 | nanobench | 1,604 |
| 6 | Argh! | 1,406 |
| 7 | expected-lite | 524 |
| 8 | span-lite | 510 |
| 9 | string-view-lite | 462 |
| 10 | semver | 345 |
| 11 | imgui_entt_entity_editor | 261 |
| 12 | serializer | 198 |
| 13 | scope_guard | 200 |
| 14 | ring-span-lite | 165 |
| 15 | reflect | 16 |
| 16 | std_net | 11 |