Looking for simple but "big" Zig code bases

So far I have used the zig book and the openmymind websites, to learn zig. I realized, that reading someone else’s code is a great help in learning, but these sites are teaching the language, and not the bigger picture.

Therefor, I struggle with breaking my code into several files, or smaller yet better reusable functions/structs etc. The code bases I found available (like ghostty or floooh/sokol-zig) are just too advanced for me. Does anyone know some simpler code bases, that are good as well? I don’t have the experience to judge them.

I would link you my own code base, but I’m probably too biased about the quality of my code.

I do however want to point at the standard library. It’s not only a way to find out about different ways to structure your code, but it also offers you a deeper understanding of the functions you use every day. (And unlike other programming languages, the standard library is actually readable).

9 Likes

Here’s mine:

It’s an example of a project that has a module and an executable (that uses the module). Kind of like ghostty and libghostty.

You will see examples of both file-structs (MainDevice.zig) and files as namespaces (esc.zig).

2 Likes

I understand exactly what you’re saying, and I’ve done the same as you.
check out my zig_sqlite project, it’s in progress, but you’ll get lots of tips, how to make a library, how to process a string or digital, etc.

It’s not perfect, I still have improvements to make and tests to run.

1 Like

TigerBeetle is more big than simple, but it is does have non-zero amount of documentation:

1 Like