Announcing Jetzig (web framework) and Zmpl (templating language) for Zig

Here are some links if you want to skip reading the text below:

I have been working on a “batteries-included” web framework for Zig for a couple of months in my spare time. The project has been coming along quite well and already has some pretty nice features, including a Templ-like (kind of) templating language called Zmpl, dynamic JSON/template data object building, structured encrypted user session cookies, static content rendering, file-based routing and template discovery, etc.

It has a long way to go before being production ready but it is now possible to create “real” web applications with it. I am using it with HTMX and I am finding Zig a very nice language to use for web dev (I come from a Python/Ruby background).

I have a long list of features I plan to add to the framework and it is winter here so I am not going outside much. :slight_smile:

Hope you are all having a nice weekend.

18 Likes

Haven’t looked at the code or tried it, but had to say: That logo ROCKS!

6 Likes

Haha, yeah I just got it today, I’ll add a link to the designer’s fiverr to the website.

Thank you so much for your videos, I watch all of them and have learned so much, I’ve been planning to make a donation to your channel soon !

5 Likes

would you use the zmpl file extension instead of an html one?

You might be interested in dependency injection and automatic body/path/query de-serialization into structs like I do here GitHub - Cloudef/zig-router: Straightforward HTTP-like request routing.

1 Like

Great, I will take a look ! Jetzig routing is very basic at the moment and I am expecting to overhaul it completely (internally), so anything I can learn from your work would be very helpful.

I thought about using .html.zmpl but I decided to go with .zmpl since Zmpl is (primarily) an HTML templating language, so the extra extension seemed redundant.

I’m hoping I can figure out how to get zls integration working but that’s for later.

3 Likes

Hi again, just coming back from illness so apologies for the delay but wanted to let you know I added a link to your project to Jetzig’s GitHub here: GitHub - jetzig-framework/jetzig: Jetzig is a web framework written in Zig

This is very cool! I started down the road of doing this recently, but have not put much time into it. I may use this framework instead.

Are you taking inspiration from any existing web frameworks?

I was going on the same route on doing a web framework also, mostly following laravel convention and structure.

Hi, Ravin. Inspiration comes from all the frameworks I’ve used over the years - Rails, Django, Laravel, Next.js, Phoenix, etc. etc.

I’m planning to add Inertia.js middleware soon as well.

If you are interested in contributing to the project, please feel free to join our Discord (see https://jetzig.dev/ for details) or, if you are building your own project, let me know and I will add a link to it on the website/README.