# \[ANN\] ProtocGen.jl protobuf support for julia

**URL:** https://discourse.julialang.org/t/ann-protocgen-jl-protobuf-support-for-julia/137265
**Category:** Package Announcements
**Created:** [May 24, 2026, 7:52am UTC](https://discourse.julialang.org/t/ann-protocgen-jl-protobuf-support-for-julia/137265 "2026-05-24T07:52:08Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jw3126](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jw3126/32/3086_2.png) [@jw3126](https://discourse.julialang.org/u/jw3126)
#### Post date: [May 24, 2026, 7:52am UTC](https://discourse.julialang.org/t/ann-protocgen-jl-protobuf-support-for-julia/137265/1 "2026-05-24T07:52:08Z")

</div>

# [ProtocGen.jl](https://github.com/jw3126/ProtocGen.jl)

[![CI](https://global.discourse-cdn.com/julialang/original/3X/9/c/9c5043a4204370d027b108e6b8348f2f60107e7a.svg)](https://github.com/jw3126/ProtocGen.jl/actions/workflows/ci.yml)

Julia code generator for Protocol Buffers.  
It is meant to be used as a protoc plugin.  
Passes the official required proto2 and proto3 [conformance tests](https://github.com/protocolbuffers/protobuf/tree/c06e6b41d66d6d380427d29ef95ba59991866bf4/conformance) for both binary and JSON.

## Install

Install `protoc-gen-julia` binary:

```julia
julia> using Pkg
pkg> app add ProtocGen

```

## Usage

```sh
cd examples
mkdir out

protoc --julia_out=out addressbook.proto

```

where

```proto
// addressbook.proto
syntax = "proto3";

package tutorial;

import "google/protobuf/timestamp.proto";

enum PhoneType {
    PHONE_TYPE_UNSPECIFIED = 0;
    PHONE_TYPE_MOBILE = 1;
    PHONE_TYPE_HOME = 2;
    PHONE_TYPE_WORK = 3;
}

message PhoneNumber {
    string number = 1;
    PhoneType type = 2;
}

message Person {
    string name = 1;
    int32 id = 2;
    optional string email = 3;
    repeated PhoneNumber phones = 4;
    google.protobuf.Timestamp last_updated = 5;
}

message AddressBook {
    repeated Person people = 1;
}

```

This generates `out/addressbook_pb.jl`. It depends on the  
`ProtocGen.jl` package:

```julia
include("out/addressbook_pb.jl")

person = Person(
    name = "Alice",
    id = Int32(42),
    email = "alice@example.com",
    phones = [
        PhoneNumber(number = "+1-555-0100", type = PhoneType.MOBILE),
        PhoneNumber(number = "+1-555-0101", type = PhoneType.WORK),
    ],
    last_updated = google_protobuf.Timestamp(seconds = Int64(1_715_000_000)),
)

# Binary wire format
bytes = encode(person)
@assert decode(bytes, Person) == person

# Canonical protobuf JSON mapping (Timestamp renders as RFC 3339)
js = encode_json(person)
# {"name":"Alice","id":42,"email":"alice@example.com",
# "phones":[…],"lastUpdated":"2024-05-06T12:53:20Z"}
@assert decode_json(Person, js) == person

```

## Alternatives

[ProtoBuf.jl](https://github.com/JuliaIO/ProtoBuf.jl) is a good alternative.  
It is meant to be used as a julia package, not protoc plugin.

## Acknowledgement

The wire codec under `src/codec/` is copied with light modifications  
from [ProtoBuf.jl](https://github.com/JuliaIO/ProtoBuf.jl)  
(MIT-licensed, © 2022 RelationalAI / Tomáš Drvoštěp / contributors).  
ProtoBuf.jl is the long-running Julia Protocol Buffers library; this  
package takes a different architectural route (descriptor-driven, with  
proto3 `optional` presence and proto2 `required` semantics fixed) but  
stands on its codec. See LICENSE.md.

---

<div class="post-metadata">

### Author: ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)
#### Post date: [May 25, 2026, 7:22am UTC](https://discourse.julialang.org/t/ann-protocgen-jl-protobuf-support-for-julia/137265/2 "2026-05-25T07:22:42Z")

</div>

> [@jw3126](#):
>
> ## Alternatives
> 
> [ProtoBuf.jl](https://github.com/JuliaIO/ProtoBuf.jl) is a good alternative.  
> It is meant to be used as a julia package, not protoc plugin.

If I recall correctly, Protobuf.jl 0.x was a protoc plugin, and my user experience improved significantly with the standalone 1.x versions.

In what use cases is it more attractive to have a protoc plugin?

---

<div class="post-metadata">

### Author: ![jw3126](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jw3126/32/3086_2.png) [@jw3126](https://discourse.julialang.org/u/jw3126)
#### Post date: [May 27, 2026, 9:29am UTC](https://discourse.julialang.org/t/ann-protocgen-jl-protobuf-support-for-julia/137265/3 "2026-05-27T09:29:02Z")

</div>

Great question! As a julia enthusiast, I favor the flexibility of having a julia proto package with detailed julia api to do stuff. As a protoc user for whom Julia is just another language in the stack that some colleagues prefer, I want the protoc plugin.  
So there are a bunch of arguments in both directions.

For me, the protoc plugin was the lazier option. Protoc handles the frontend stuff like import resolution etc for you. You mostly need to produce strings from a fully resolved data structure. Also there are standard testing tools for protoc plugins that you can just reuse.  
Still, with the help of LLMs a standalone variant could also be coded pretty quickly. If people actually use this package and have strong arguments for a pure julia package variant, I am open to implement that.

If you wonder why I did not use ProtoBuf.jl? I initially tried, I ran into a bunch of issues and the package feels “collectively unmaintained”.

---

<div class="post-metadata">

### Author: ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)
#### Post date: [May 27, 2026, 9:43am UTC](https://discourse.julialang.org/t/ann-protocgen-jl-protobuf-support-for-julia/137265/4 "2026-05-27T09:43:17Z")

</div>

> [@jw3126](#):
>
> If you wonder why I did not use [ProtoBuf.jl](https://juliaregistries.github.io/General/packages/redirect_to_repo/ProtoBuf)? I initially tried, I ran into a bunch of issues and the package feels “collectively unmaintained”.

Ah, that’s the bigger picture I was missing. The Protobuf package has worked well for me, but I haven’t exactly stressed it much.
