A powerful Protocol Buffers build and management tool
- π Unified Build - One command to compile all proto files
- π¦ Multi-Source Dependencies - Support Go modules, Git, HTTP, S3, GCS, and local paths
- π Plugin Support - Flexible protoc plugin configuration
- π Linting - Built-in proto file linting with AIP rules
- π Formatting - Auto-format proto files
- βοΈ Configuration-driven - YAML-based project configuration
- π Progress Display - Visual progress bars and detailed error messages
- ποΈ Cache Management - Clean and manage dependency cache
- π Web UI - Visual configuration editor with proto file browser
- π₯ Environment Check - Doctor command to diagnose development environment
- π― Project Initialization - Quick project setup with templates
go install github.com/pubgo/protobuild@latest
- Create a
protobuf.yamlconfiguration file in your project root:
vendor: .proto root: - proto includes: - proto deps: - name: google/protobuf url: github.com/protocolbuffers/protobuf path: src/google/protobuf plugins: - name: go out: pkg opt: - paths=source_relative
- Vendor dependencies:
protobuild vendor
- Generate code:
protobuild gen
| Command | Description |
|---|---|
gen |
Compile protobuf files |
vendor |
Sync proto dependencies to vendor directory |
vendor -u |
Force re-download all dependencies (ignore cache) |
deps |
Show dependency list and status |
install |
Install protoc plugins |
lint |
Lint proto files using AIP rules |
format |
Format proto files using buf |
format -w |
Format and write changes to files |
format --diff |
Show diff of formatting changes |
format --builtin |
Use builtin formatter instead of buf |
web |
Start web-based configuration UI |
web --port 9090 |
Start web UI on custom port |
clean |
Clean dependency cache |
clean --dry-run |
Show what would be cleaned without deleting |
init |
Initialize a new protobuild project |
init --template grpc |
Initialize with specific template (basic, grpc, minimal) |
doctor |
Check development environment and dependencies |
doctor --fix |
Auto-install missing Go plugins |
version |
Show version information |
# Checksum for tracking changes (auto-generated) checksum: "" # Vendor directory for proto dependencies vendor: .proto # Base plugin configuration (applied to all plugins) base: out: pkg paths: source_relative module: github.com/your/module # Proto source directories root: - proto - api # Include paths for protoc includes: - proto - .proto # Exclude paths from compilation excludes: - proto/internal # Proto dependencies deps: - name: google/protobuf url: github.com/protocolbuffers/protobuf path: src/google/protobuf version: v21.0 optional: false # Protoc plugins configuration plugins: - name: go out: pkg opt: - paths=source_relative - name: go-grpc out: pkg opt: - paths=source_relative # Plugin installers (go install) installers: - google.golang.org/protobuf/cmd/protoc-gen-go@latest - google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest # Linter configuration linter: rules: enabled_rules: - core::0131::http-method disabled_rules: - all format_type: yaml
Each plugin supports the following options:
| Field | Type | Description |
|---|---|---|
name |
string | Plugin name (used as protoc-gen-{name}) |
path |
string | Custom plugin binary path |
out |
string | Output directory |
opt |
string/list | Plugin options |
shell |
string | Run via shell command |
docker |
string | Run via Docker container |
skip_base |
bool | Skip base configuration |
skip_run |
bool | Skip this plugin |
exclude_opts |
list | Options to exclude |
| Field | Type | Description |
|---|---|---|
name |
string | Local name/path in vendor directory |
url |
string | Source URL (Go module, Git URL, HTTP archive, S3, GCS, or local path) |
path |
string | Subdirectory within the source |
version |
string | Specific version (for Go modules) |
ref |
string | Git ref (branch, tag, commit) for Git sources |
source |
string | Source type: gomod, git, http, s3, gcs, local (auto-detected if not specified) |
optional |
bool | Skip if not found |
deps: # Go Module (default) - name: google/protobuf url: github.com/protocolbuffers/protobuf path: src/google/protobuf # Git Repository - name: googleapis url: https://github.com/googleapis/googleapis.git ref: master # HTTP Archive - name: envoy url: https://github.com/envoyproxy/envoy/archive/v1.28.0.tar.gz path: api # Local Path - name: local-protos url: ./third_party/protos # S3 Bucket - name: internal-protos url: s3://my-bucket/protos.tar.gz # GCS Bucket - name: shared-protos url: gs://my-bucket/protos.tar.gz
protobuild -c protobuf.custom.yaml gen
protobuild lint protobuild lint --list-rules # Show available rules protobuild lint --debug # Debug mode
# Format and preview changes (dry run) protobuild format # Format and write changes to files protobuild format -w # Show diff of formatting changes protobuild format --diff # Exit with error if files need formatting (useful for CI) protobuild format --exit-code # Use builtin formatter instead of buf protobuild format --builtin # Format specific directories protobuild format -w proto/ api/
# Start web UI on default port (8080) protobuild web # Start web UI on custom port protobuild web --port 9090
The web interface provides:
- π Visual configuration editor
- π¦ Dependency management
- π Plugin configuration
- π One-click build, lint, format operations
- π Real-time YAML preview
- π Project statistics dashboard
- π Proto file browser with syntax highlighting
- π Configuration examples reference
# Interactive initialization protobuild init # Use specific template protobuild init --template basic # Basic Go + gRPC project protobuild init --template grpc # Full gRPC-Gateway project protobuild init --template minimal # Minimal configuration # Specify output directory protobuild init -o ./my-project
# Diagnose environment issues protobuild doctor # Auto-install missing Go plugins protobuild doctor --fix
Example output:
π₯ Protobuild Doctor
Checking development environment...
β
protoc installed (v25.1)
β
protoc-gen-go installed
β
protoc-gen-go-grpc installed
β
buf installed (v1.28.1)
β
api-linter installed
β
go installed (go1.21.5)
β
Configuration protobuf.yaml found
β οΈ Vendor directory not found (run 'protobuild vendor')
β
Environment check passed!
protobuild vendor -f # Force update even if no changes detected protobuild vendor -u # Re-download all dependencies (ignore cache)
protobuild deps
Example output:
π¦ Dependencies:
NAME SOURCE VERSION STATUS
---- ------ ------- ------
google/protobuf Go Module v21.0 π’ cached
googleapis Git master βͺ not cached
Total: 2 dependencies
protobuild clean # Clean all cached dependencies protobuild clean --dry-run # Preview what will be cleaned
protobuild install
protobuild install -f # Force reinstallYou can place a protobuf.plugin.yaml file in any proto directory to override the root configuration for that directory and its subdirectories.
# proto/api/protobuf.plugin.yaml plugins: - name: go out: pkg/api opt: - paths=source_relative
google.golang.org/protobuf/cmd/protoc-gen-go@latestgoogle.golang.org/grpc/cmd/protoc-gen-go-grpc@latestgithub.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latestgithub.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latestgithub.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latestgithub.com/bufbuild/protoc-gen-validate/cmd/protoc-gen-validate@latest- And many more...
When dependency resolution fails, protobuild provides detailed error messages with suggestions:
β Failed to download dependency: google/protobuf
Source: Git
URL: git::https://github.com/protocolbuffers/protobuf.git?ref=v99.0
Ref: v99.0
Error: reference not found
π‘ Suggestions:
β’ Check if the repository URL is correct and accessible
β’ Verify the ref (tag/branch/commit) exists
β’ Ensure you have proper authentication (SSH key or token)
Dependencies are cached in:
- macOS/Linux:
~/.cache/protobuild/deps/ - Go modules: Standard Go module cache (
$GOPATH/pkg/mod)
protobuild
βββ cmd/
β βββ protobuild/ # Main CLI application
β β βββ cmd.go # Entry point and core handlers
β β βββ commands.go # Command factory functions
β β βββ config.go # Configuration structs
β β βββ proto_walker.go # Proto file walking utilities
β β βββ protoc_builder.go# Protoc command builder
β β βββ vendor_service.go# Dependency vendoring
β β βββ util.go # Shared utilities
β β βββ yaml_types.go # YAML type definitions
β βββ format/ # Proto file formatting (builtin)
β βββ formatcmd/ # Format command (buf integration)
β βββ linters/ # AIP linting rules
β βββ webcmd/ # Web configuration UI
β βββ cmd.go # Web command entry
β βββ server.go # HTTP server and API
β βββ templates/ # HTML templates (Alpine.js + Tailwind)
βββ internal/
βββ depresolver/ # Multi-source dependency resolver
βββ modutil/ # Go module utilities
βββ plugin/ # Plugin management
βββ protoutil/ # Protobuf utilities
βββ shutil/ # Shell utilities
βββ typex/ # Type extensions
- Configuration Examples - Detailed configuration examples for various use cases
- Multi-Source Dependencies - Design document for multi-source dependency resolution
- Design Document - Architecture and design documentation
Upcoming features planned for future releases:
| Feature | Description | Status |
|---|---|---|
| π Dependency Graph | Visualize proto file import dependencies | Planned |
| Detect incompatible changes between versions | Planned | |
| π API Documentation Generator | Auto-generate Markdown/HTML docs from proto comments | Planned |
| π Mock Server | Auto-start mock gRPC/HTTP server for testing | Planned |
| π Proto Templates | Quick generation of common proto patterns (CRUD, pagination) | Planned |
| π Field Statistics | Analyze field naming conventions and type distribution | Planned |
| βοΈ Online Editor | Edit proto files directly in Web UI | Planned |
Contributions are welcome! Please feel free to submit a Pull Request.