HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
nothings
stb
C2014–2026
nothings / stb

stb

stb single-file public domain libraries for C/C++

78Distinct people
111Mentions
0Explicit recommenders
35KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

stb single-file public domain libraries for C/C++

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 8–Nov 15 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/15/2026, 11:34:28 AM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year111 dated mentions

Observed mentions: 2014-09-21 13:39:14 UTC to 2026-08-10 10:10:33 UTC.

0510152014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments20142015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 5 mentions; 2 submissions, 3 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 15 mentions; 3 submissions, 12 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 8 mentions; 4 submissions, 4 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 8 mentions; 3 submissions, 5 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 12 mentions; 2 submissions, 10 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 14 mentions; 2 submissions, 12 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 9 mentions; 1 submissions, 8 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 9 mentions; 1 submissions, 8 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 7 mentions; 0 submissions, 7 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 8 mentions; 3 submissions, 5 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 7 mentions; 1 submissions, 6 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC404
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC523
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC15312
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC844
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC835
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC12210
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC14212
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC918
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC918
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC707
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC835
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC716
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC505

What Hacker News says

8 sources
So the blog post ends with a promise of sections about: * inline layout * text rendering. * networking. * scripting. LAYOUT I think here could be useful to take a look at something like Facebook's Yoga [1] although maybe not great to start. There's this little layout demo that could be interesting to investigate [2]. TEXT Regarding text probably the keyword to learn about is "rasterization". I found a few tutorials back in the day [3], [4]. In general rendering text is a PITA and you don't want to do it no matter what :-) The only lightweight solution I found was stb's truetype [3]. So if you want to render text yourself you'll need: - a parser for a font format format (e.g. TTF, PITA) to have a way to get the curve definitions for each font. - a rasterizer (could be a fun project for getting something reasonable and probably slow perform
Read the rest
ant) - a curve filling algorithm and plugging it to your rasterizer, which will probably be able to do humble things like drawing filled triangles and other simple shapes (PITA! :-p) - a word and paragraph layout engine (PITA again :-) Overall I'm happy half understanding the steps involved and not having to deal with all the messy steps in the middle. NETWORKING I'm super lazy in this area, and I would rather learn something like ZeroMQ to posix sockets... back in the day I followed Beej's tutorial which was nice. [6] Then you can connect your sockets to some pre-existing HTTP parser which are a dime a dozen these days [7] and you are all set! :-p SCRIPTING Not much to say here... hundreds of languages available. Probably Lua is a nice alternative to JavaScript, but there are also plenty of lightweight JavaScript implementations these days (I think there is a nice little one called V7). If you want to learn how to actually implement an interpreter there are plenty of resources too. If I went this route I would start by implementing some version of lisp or scheme for simplicity. 1: https://yogalayout.com/ 2: https://github.com/randrew/layout 3: https://github.com/NotCamelCase/RasterizationInOneWeekend 4: http://www.scratchapixel.com/index.php 5: https://github.com/nothings/stb/blob/master/stb_truetype.h 6: https://beej.us/guide/bgnet/ 7: https://github.com/search?q=http+parser&ref=opensearch
In Let’s build a browser engine (2014)
Proper "stb-style" header-only libs split the header into 2 parts: the declaration part that's always included and parsed but only contains the public API declarations, and the implementation part inside an #ifdef XXX_IMPLEMENTATION section which is only included and parsed in a single source file. The same idea can also be used for C++ headers (unless it's all template interfaces). With such stb-style headers, you can even get better compile times, because you can include all header-libs into a single implementation source file, giving the same advantages as unity-builds (merging all sources into one file). PS: origin of the name "stb-style": https://github.com/nothings/stb (although I guess the general idea existed before)
In Mio – Cross-platform header-only C++11 library for memory-mapped file IO
One thing that I like about Lua over Javascript is how self-documenting, fun to write, and easy to read it is. It has a very simple syntax, but the extensibility of its core structures (like tables) let you accomplish a lot with that simplicity. Its 3rd-party libraries also tend to be closer to C/C++'s "drop-in" solutions like STB[1] than the enormous JS ecosystem which often requires extra tools like Node and/or extra packages like JQuery. Admittedly, Lua's ecosystem is much smaller than Javascript's, but in my experience Lua is vastly easier to maintain. You can certainly write bad Lua, but it's one of the only languages where I don't implicitly dread reading other people's code. It is sort of annoying that tables which are treated like arrays are 1-indexed by convention, though. [1]: https://github.com/nothings/stb
In Tables
For C vectors, look at stb's[1] stretchy_buffer[2] or klib's[3] kvec[4]. The basic concept of these is they use macros to specify the type/size of the elements so you can have generic containers in C. For hash's, you can also look at klib's khash [5] [1] https://github.com/nothings/stb [2] https://github.com/attractivechaos/klib [3] https://github.com/nothings/stb/blob/master/stretchy_buffer.... [4] https://github.com/attractivechaos/klib/blob/master/kvec.h [5] http://attractivechaos.github.io/klib/#Khash%3A%20generic%20...
In One year of C
Sean Barrett (who I think popularized the idea) has a FAQ on this (https://github.com/nothings/stb) where he justifies it by pointing at difficulties with deploying libraries on Windows. Which is a fair point, but by going straight to header-only he skips the step where you can also just distribute a bunch of headers and .C files. The convenience of only having to include a single header is nice for quick weekend projects, but for anything bigger you're dealing with dependencies and build issues anyway. I get some of the reasons that you would initially start out with a header-only implementation, but when your library grows, you probably want to split it at some point. For me personally, that point would be some time before the header reached 25k (!!) lines.
In Nuklear: A single-header ANSI C GUI library

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.