Protocol buffer configuration for Connect RPC + gRPC-Gateway using buf, including plugins, imports, annotations, and code generation
Before creating any server code, you MUST create proto definitions!
# 1. Create proto directory
mkdir -p proto/api/v1
# 2. Create buf configuration files
touch proto/buf.yaml
touch proto/buf.gen.yaml
# 3. Create service definition
touch proto/api/v1/auth_service.proto
# 4. Generate Go code
cd proto && buf generate
Without proto files, server implementations cannot import generated types and will fail to compile!
proto/
├── buf.gen.yaml # Code generation configuration
├── buf.yaml # Lint and breaking change rules
├── buf.lock # Dependency lock file (auto-generated)
├── api/v1/ # API service definitions
│ ├── auth_service.proto
│ ├── user_service.proto
│ ├── memo_service.proto
│ └── common.proto # Shared enums
└── gen/ # Generated code (auto-generated)
├── api/v1/
│ ├── *_pb.go # Protobuf messages
│ ├── *_connect.go # Connect RPC handlers
│ ├── *_grpc.go # gRPC stubs
│ └── openapi.yaml # OpenAPI spec