Advanced project ideas

Hey folks, I thought about making a post collecting ideas for really big projects that could be cool to do with Zig. Kind of like the other side of the spectrum from the “beginner project ideas” posts. Feel welcome to reply with other ideas, maybe this post can inspire some people.

Of course keep in mind that there will always be n alternatives in m different languages for each project.


Layouting engine
A library that calculates the sizes and positions of UI elements (boxes), typically implements the Flexbox, Grid and Block layout algorithms. Notable examples are taffy (Rust, it powers Bevy, Zed and is used in CosmicDE) and yoga (C++, from facebook)

Reverse Proxy
There are many reverse proxies out there, with nginx probably on top. A couple years ago Cloudflare came out with leaving nginx behind cause they hit some limitations and built their own in Rust called Pingora (also some shenanigans with nginx lead to a couple of forks). This kind of projects is a great fit for languages like C, C++, Rust and Go, so Zig will fit in nicely.

Raft
Raft is a consensus algorithm with leader election and log replication. At this point it is well used in several projects. In particular it powers etcd used by kubernetes and recently Kafka introduced KRaft, their own implementation of Raft, as an alternative of Zookeeper, used for metadata management.

Container Runtime
Zig can be great for any container-related project, not just runtimes. It is a field dominated by Go but some alternatives are present, such as youki (in Rust), crun (in C and also the most performant iirc). Also the many projects that work around containers are always either in Rust or Go (like runtime monitors, builders, etc). We apply this also to WebAssembly, but there is actually a Wasm runtime being built with Zig!

API Gateway
Well this does a lot of things. For what I know 2 big players here are Kong (made in Go) and Apache Apisix (I think in Lua?). From this we could just extract something like a Rate Limiter to implement in Zig.

Message Broker
A system to send and receive messages between services. There are ton of message brokers at this point. A few: Apache Kafka (in Java/Scala), Redis, RabbitMQ (in Erlang, <3 BEAM btw) and NATS (in Go) which I like a lot. A NATS client in Zig would be a very nice project which it’s currently lacking.

Game Engine
Well here we have a couple of projects going on for Zig in the gamedev scene. I’m pretty sure over the years Zig engines will pop up more and more. The bigger problem is doing the games more than the engines.


I had fun thinking about possible big projects to do in Zig. Suggest more without thinking it would be too impossible or the space is too saturated. I was very biased with the kind of projects cause I’m doing a phd in distributed systems and serverless computing :stuck_out_tongue: (zig FaaS platform anyone?) so feel free to go over completely different stuff.

7 Likes

I’d like to see a really good backup program. One of the things I miss from the Apple ecosystem is Time Machine. It backs up everything at every hour, but it manages the space it uses in a very clever way. Instead of simply deleting old backups, it keeps various backups with different ages. For stuff that you changed recently, you have access to an hourly backup that you can use as a version control. For stuff that hasn’t been touched in a while, it keeps backups with a granularity of once per day. And for older backups, you have a granularity of once a month. This keeps backup sizes manageable but provides a lot more value than simply having a bunch of backups, all with approximately the same age.
I’ve tested a bunch of backup solutions in Windows, and I’ve settled on Cobian reflector. It’ s good, but it’s a far cry from Time Machine. It has a bunch of problems, like spurious backups at random times, and it sometimes has problems cleaning up after itself, leaving me chasing temp files with an unstable system because I have literally 0 Gb free in my drives. And Cobian recently came out saying he got tired of it, and won’t continue development further.
A naive backup solution is easy to make, but a really great solution should have these properties:

  • Use shadow volume, so that it can backup files that are in use. This is crucial, as the files that are currently in use are the most important to backup.
  • Manage the space it occupies. When it runs out of space, it should cleanup in a clever way, like Time Machine. For example, if you delete a full backup, you significantly cripple all the differential backups that come after it. A much better solution is to make the full backup absorb the differential backups that came after it.
  • It should allow for clever recovery. If your backup consists of a bunch of zip files, when you have to recover, you need to take the last full backup, and then keep overwriting it with the differential backups that were done after it, in order. Not only is this inconvenient, but you’ll end up with a bunch of files that you had already deleted, because these backup tools don’t keep track of when files were deleted. A backup solution should allow you to select the moment in time you want to restore, do the full restore with all the differentials, and remove files that had already been deleted at that particular moment.
4 Likes

Here’s some Zig issues that could be written as a standalone project and then contributed upstream:

9 Likes

I am not sure I understand this one. Doesn’t objdump already works with zig binary? Sorry if this is obvious…

I believe the idea would be being able to do something like zig objdump/zig objcopy/etc which would work on any platform without needing anything but Zig installed. With https://github.com/ziglang/zig/issues/16270 in mind, that would mean implementing objdump/objcopy/etc in Zig without any dependency on LLVM.

2 Likes

Ok, maybe the benefit is that you have a cross-platform objdump? No need to install arm-elf-objdump, zig objdump would handle all the platform zig supports.

1 Like

Okaaay, what about music-making software (like LMMS or SUNVOX for ex.) or sound recording/processing (Audacity or similar DAWs)?

3 Likes

One idea I’ve been actively thinking about is a web server that runs within Node.js. Naturally, it’s related to my own project, Zigar. The idea is to basically reverse the relations between an app server (something running in Node.js) and a web server (say, Nginx), such that former has more or less total control over the latter. For example, in response to a request for the first page of a search query, the app server can push, through a function call, the next 49 pages into the cache of the web server so that response would be near instantaneous (and cheap computationally).

2 Likes

Several years ago I had similar idea - something like “do not use WSGI/UWSGI and a ‘framework’, just embed an HTTP-server into your application!”.

2 Likes

Son of a gun! A bit of off-topic. Also more than 10 years ago, while experimenting with various (HTTP) servers architectures, I had another idea. That was a hobby project and it was left unfinished.

In theory, Node.js has a HTTP server. Handling high traffic with a garbage-collected language is, of course, very far from ideal in terms of resource usage.

I think there’s a market of an in-process web server that’s efficient at handling basic tasks like serving (more-or-less) static content. Thanks to npm, there’s a distribution channel already. The solution just needs to be good enough. Being able to stuff everything into a single container is a strong selling point.

Anyway, I’ve been thinking about this. I even have a name for the project: Inzight. It’s the perfect name for a Zig-based HTTP server operating within Node.js, I believe. Problem is, networking is definitely not my area of expertise. I can’t program this thing.

1 Like

Zig implementation of QUIC / HTTP3.

9 Likes

x-plat GUI (Win/Lin/Mac/iOS/Android/Embedded) with full-fledged widget set suitable for applications (gameable but not game-centric).

  • bidi layout/languages
  • localization
  • accessibility

This is something that I want to see! It’s a project that’s been on my mind for a while, but I have too many other projects…

Similar to how @marler8997 is implementing a bunch of different flavors of the C standard library in Zig (see here), it would be cool to implement all the different “embedded friendly” flavors of the C standard library in Zig:

The Zig Embedded Group already has the start of something similar here:

I’m envisioning build.zig options being used to switch different flavors and options depending on your target and what you want to prioritize (speed, functionality, code size). Lots of embedded projects in C currently depend on the newlib/newlib-nano version of the C standard library. Currently this makes incrementally porting an embedded C project that depends on it to Zig kind of a headache since you have to either:

  • Manually link in pre-compiled standard library archives for your target bundled with the arm-none-eabi-gcc compiler
  • Build the standard library from source for your target by figuring out the build process of one of the above options and porting it to a build.zig (there exist some forks already that do this)

In a perfect world this project enables you to sub the above steps for the following:

  • Add Zig “embedded libc” to your dependencies in build.zig.zon
  • Specify your flavor with an option, IE -Dlibc_version=newlib-nano
2 Likes

A debugger frontend could be cool to make with zig.
I’ll be honest I’ve never used a cli debugger, I find it too hard. “Skill issue” I know.

4 Likes

A “PLC” (programmable logic controllers for industrial applications) runtime with associated IDE / debugging / deployment tooling. PLC’s are going away in favor of linux-based industrial computers, so it may look like just a GUI / IDE around the zig compiler. But the main features are:

  1. Visibility tooling: a way to remotely look into the state of your program while its running, the state of all your I/O, and other diagnostic information like your cycle times etc.
  2. Deployment tooling: remotely deploy and manage what applications are running on the target, even as far as doing “online changes” (making changes to the program while it is running)
  3. Lots and lots of plugins/libraries to interact with ModBusTCP, EtherCAT, Profinet, serial protocols.
  4. Motion control libraries for generating trajectories for motors
2 Likes

MODBUS-RTU over RS-485 is still alive.
Also RS485-Ethernet bridges are frequently used, so it is what’s called “MODBUS-RTU-OVER-TCP”

A debugger frontend in Flow Control would be really nice. And probably not all that difficult.

1 Like

But do not place no I/O code into a plugin/library.
I am for years designing dlls or just source files to be linked into man code using this strict principle:

  • a library must contain only CPU/RAM related code, i.e:
    • forming a request
    • interpreting a reply / asynchronous data

An application designer should have the ability to choose any I/O strategy he wants, be it simple blocking reads/writes, reactor pattern based on epoll/kqueue/etc, proactor pattern based on Windows IOCP/Linux uring or whatever.