Buffman is a CLI tool that wraps around the flatc
compiler. It simplifies converting .proto
files to .fbs
, and generates code in multiple languages using a declarative YAML config (buffman.yml
).
It currently supports two plugin types:
flatbuffers
— multi-language code generationnanobuffers
— minimal and ultra-fast C-only serialization
Important
This project is under active development. APIs, configurations, and features may change without notice. Use with caution in production environments.
You can install Buffman in three ways:
-
Download Precompiled Binary
Visit the Releases page and download the binary for your OS.curl -sSL https://raw.githubusercontent.com/machanirobotics/buffman/main/scripts/install.sh | bash
-
Build from Source
git clone https://github.com/your-org/buffman.git cd buffman go build -o buffman main.go
-
Docker Image
docker pull ghcr.io/tarran-sidhaarth/buffman:latest
Tip
Add the binary to your PATH
for convenient use from anywhere.
Buffman requires a YAML configuration file and does not auto-detect it.
You must specify the file explicitly using the -f
flag.
Here's a minimal example config (buffman.yml
):
version: v1
inputs:
- name: source
path: "./proto"
- name: googleprotobuf
remote: https://github.com/protocolbuffers/protobuf
commit: <commit-hash>
plugins:
- name: flatbuffers
out: "./fbs"
languages:
- language: go
out: "./generated/go"
opt:
- go_package=github.com/username/project/fb
- name: nanobuffers
out: "./nano"
Then run:
buffman generate -f ./buffman.yml
Or use Docker:
docker run --rm \
-v $(pwd):/buffman \
-w /buffman \
ghcr.io/tarran-sidhaarth/buffman:latest generate -f /buffman/buffman.yml
Note
When using Docker, all paths in your buffman.yml
must be relative to /buffman
, since that's where your local project is mounted in the container.
You can use any filename and location for the config—just update the path with -f
.
Command | Description |
---|---|
buffman generate |
Generates code as defined in your config file. Use the -f flag to specify the config path. |
buffman convert |
Converts .proto files to .fbs files using your config. Learn more |
Buffman uses a YAML configuration file (buffman.yml
) to define your input sources, output directories, plugins, and language-specific options.
version: v1
inputs:
- name: source
path: "./proto"
# Optional external repositories
# - name: googleprotobuf
# remote: https://github.com/protocolbuffers/protobuf
# commit: <commit-hash>
plugins:
- name: flatbuffers
out: "./fbs"
languages:
- language: cpp
out: "./generated/cpp"
- language: go
out: "./generated/go"
opt:
- go_package=github.com/username/project/fb
- language: java
out: "./generated/java"
opt:
- java_package_prefix=com.fb
- language: kotlin
out: "./generated/kotlin"
- language: php
out: "./generated/php"
- language: swift
out: "./generated/swift"
- language: dart
out: "./generated/dart"
- language: csharp
out: "./generated/csharp"
- language: python
out: "./generated/python"
- language: rust
out: "./generated/rust"
- language: ts
out: "./generated/ts"
- name: nanobuffers
out: "./nano"
inputs
define your schema sources.plugins
define how.proto
files are converted and which targets are generated.flatbuffers
supports multiplelanguages
with optional config per target.nanobuffers
is C-only, so it does not require alanguages
field.plugins
define how.proto
files are converted and which language targets to generate.opt
is required only forgo
(go_package
) andjava
(java_package_prefix
).
version: v1
inputs:
- name: source
path: "./proto"
plugins:
- name: flatbuffers
out: "./fbs"
languages:
- language: go
out: "./generated/go"
opt:
- go_package=github.com/username/project/fb
- name: nanobuffers
out: "./nano"
version: v1
inputs:
- name: source
path: "./schemas"
plugins:
- name: flatbuffers
out: "./build/fbs"
languages:
- language: go
out: "./services/go/generated"
opt:
- go_package=github.com/company/project/fb
- language: cpp
out: "./native/cpp/generated"
- language: java
out: "./services/java/generated"
opt:
- java_package_prefix=com.company.project.fb
- language: ts
out: "./web/src/generated"
- language: python
out: "./analytics/generated"
- name: nanobuffers
out: "./build/nano"
Buffman is open source under the MIT License. See LICENSE
for full details.
Note
For full documentation and advanced usage, read the DOCS