- Full proto3 support with type-safe code generation
- gRPC services with all streaming types
- Well-known types (Timestamp, Duration, Any, etc.)
- Cross-file imports and nested types
https://github.com/renatillas/protozoa
#Protozoa :microbe: - A complete Protocol Buffers compiler and library for Gleam!
1 messages · Page 1 of 1 (latest)
For now it's unreleased on hex but you can use it with git deps as I make it prod ready
Tbf I made it just for the funsies it's my first attempt at vibe coding and it shows hahaha
Dope! That's so cool! It always saddens me that Protobuf doesn't support tagged unions, though
Yeah there are so many cool features and so many more missing ones in the protocol
There seems to be a pattern for code generation forming. that I like to see
oh yes, I'm testing
oneof is basically a tagged union though?
i dont know much about protobuf, do you think it makes sense to follow squirrel's approach where
your-project/
├── gleam.toml
└── src/
└── myapp/
└── proto/
├── user.proto
├── message.proto
└── user_service.proto
would generate myapp/proto.gleam, from the code that gets generated right now it looks like this would work nicely
What would be the advantages of having just a single module vs having multiple for each protobuf? I guess well-known types would live all in the same module and that would make more sense
That's just a union, not tagged, so it's harder to determine the actual type without type gymnastics
That's incorrect, they are tagged. Each proto language impl provides a way to find out the type the oneof is storing, you don't have to implement an external tag.
Oh fair. Apologies!
The protobuf docs are absolutely awful, so I probably wouldn't have known about it if I hadn't seen it in use. 🙂
Consistency mainly, as we start getting more of these things popping up it’d be great if they landed on the same not just similar ways of working
Great reasoning, I'm working on it atm thanks to your suggerence
🎉 Protozoa v2.0.2 - Major Architecture Overhaul!
11 commits of massive improvements since v1! 🚀
🔄 Revolutionary Architecture Change
- 📄 Single File Generation - All proto files now combine into ONE proto.gleam file!
- 🗂️ No more scattered files - Much cleaner project structure
- 🧹 Unified imports - Everything in one place, no more complex dependencies
🏗️ Enhanced Google Protocol Buffers Support
- ✅ Full google.protobuf.Struct & google.protobuf.StringValue integration
- 🔄 Fixed enum redefinition errors for well-known types
- 🤝 Seamless mixing - User types + well-known types in single output
- 📋 Smart deduplication - No duplicate definitions across files
🔍 Intelligent Project Discovery
- 🎯 Auto-finds gleam.toml in parent directories (../, ../../, etc.)
- 💡 Smart path resolution - Works from any subdirectory
- 🛠️ Better error messages - Clear feedback when things go wrong
⚡ Code Generation Quality
- 🚫 Zero unused variable warnings in generated code
- 🎨 Clean compiler output - Professional quality generated code
- 🔧 Enhanced type handling - Better nested message support
- 📝 Improved decoder generation - Handles complex proto structures
🐛 Critical Fixes
- 🔄 Fixed duplicate enum handling across multiple proto files
- 📂 Resolved path traversal bugs for project discovery
- 💾 Enhanced error handling and user feedback
- 🧪 Updated test suite for single-file architecture
📈 Version Progression
- 🏷️ v1 → v2.0.2 (major version bump!)
- 🔢 2.0.0 introduced the unified file architecture
- 🔧 2.0.1 & 2.0.2 added polish and fixes
Game-changing update! 🎯 One file to rule them all - much simpler, cleaner, and more maintainable! ✨
I freaking love claude code for this kinds of messages it just looks so off hahaha
Not all of them, there are some that are rarely used that I'm still implementing
More specifically
- google.protobuf.Type
- google.protobuf.Field
- google.protobuf.Enum
- google.protobuf.EnumValue
- google.protobuf.Option
- google.protobuf.SourceContext
- google.protobuf.Api
- google.protobuf.Method
- google.protobuf.Mixin
Looking into using some gRPC in my project, I am both a noob in gRPC and Gleam so please bear with me. do I need something like a gRPC server + protozoa to get gRPC "request" I see protozoa generates services too, but I guess some kind of server still needed to drive it right?
Yes you still need some kind of server
can the server be a mist server?
not right now as far as I'm aware as gRPC needs HTTP 2.0, and mist has it still not publicly available, so the api may change
Wow
How did I miss this project
Looks fantastic from the README. Do you generate bit array patterns for the decoding?
I think so, long ago that I look into this package code!
I haven’t yet published it to hex maybe that’s why!
Is it because you think it isn't usable yet, or it is because you've not implemented enough of protobuf's format?
There are still some code gen bugs, I think it’s not suitable for production (yet)
Makes sense
Could do a v0 release with a big warning to let people try it
It being available encourages people to contribute fixes etc if they find it promising
The protobuf format is already well implemented I think, the only major thing to proto v2 regarding that
Like how I published jot with very little support for the language
If you've got it mostly covered I say v0 sounds good, having people try it will help find the bugs
It's not like you're actively hunting them out
No, thanks for another amazing library, you're killing it
It would be really cool to have a package for decoding the Hex registry protobuf objects using this, I wager lots of people would find that useful
Oh that would be nice to have yeah
I wonder if you're person #2 for most published libraries 😛
sorry but no this sucks
it sucked when you did it for jot too
HAHAHAHA
It sucks less than it never getting any further updates
I feel like my two dads are arguing in the kitchen
I wouldn't have worked on jot, Glenatillas wouldn't have worked on this, and Gleam would have no djot and no protobuf!
classic mom and pop argument
Hahahaha
OK what's the alternative, how do we get people finding the bugs?
tbh this isn't like jot, we do actually think the whole spec is covered, we just don't have confidence that there's no bugs
the problem is OP not telling people about their library beyond a single post at 11pm cest, that problem goes away if OP talks about their library more 🙂
publish v1 with awarning
I don’t have enough time to talk about all my libraries…….
"this might have bugs" is a very normal state for an open source library to be in
OK yes Hayleigh is right, you have protobuf v1 sorted, v1 is ideal
But yeah I understand
To be fair the api is pretty solid, the bugs wouldn’t affect that
And I do always say "version numbers are not indicators of production readiness"
And publishing version 2 in a few weeks wouldn’t make much of a difference if the migration is simple and straightforward
Thx Hayleigh for wisdom
Thanks mom and dad
tbh when I see a package with v8.5.1 or something I'm like "hey they're actually paying attention to stuff like semver"
when i see v0 i think "hey im not using that" and move on with my life LOL
its hard without the stdlib but its honest work 😔
Yeah me too
v0.0.1 "coward"
v1.1.0 "new package"
v1.15.0 "semver violator or maybe a coward"
v9.4.0 "good shit"
How have you been finding it?
I just need to use protobuf 😄
fortunately Renata makes great packages I just need, so simple
Sounds like another vote in the "publish v1" camp 😁
yes
ive never felt more vindicated than this screenshot
@elder gazelle All the libraries you've been publishing have been super nice, and talking publicly about your Gleam app and it being in production is awesome too!
Can I send you some stickers or merch? 
just wait for gleam conf 2026, I'll be there!
POG
I was even thinking of giving a talk but the pressure of talking in public is killing me
please don't die, we need you 😉
I would enjoy to hear your talk about eventsourcing and deploying you recent app
submit a proposal!!!
We will def help you prepare the talk
Your libraries and your app are v interesting. I know Peter really wants to hear from production users too
are you suuuuuuuure?
can post some stickers!
weeeeell if you insist!
Protozoa and Protozoa/dev have been published to hex!
- https://hexdocs.pm/protozoa/index.html
- https://hexdocs.pm/protozoa_dev/index.html
I've decided to separate them into two packages to ensure the codegen is usable in browsers and javascript targets, while the CLI uses the erlang target
A Protocol Buffers library for Gleam, providing encoding and decoding of protobuf messages.
CLI tool for the Protozoa Protocol Buffers library
Is support for proto2 planned for this?
looking at the the differences it seems that proto2 is more complicated than proto3 sadly
sadly I don't think so
