1.8 KiB
1.8 KiB
Go gRPC Gateway Template
A simplified Go project template for gRPC services with HTTP/JSON gateway support, based on the Go Standard Project Layout.
Project Structure
├── cmd/server/ # Main application entry point
├── internal/
│ ├── handler/ # gRPC and gateway handlers
│ └── service/ # Business logic
├── pkg/pb/ # Generated protobuf files (auto-generated)
├── api/v1/ # Protocol buffer definitions
└── justfile # Task runner configuration
Prerequisites
Getting Started
-
Install dependencies:
just deps -
Generate protobuf files:
just proto -
Build and run the server:
just dev
Available Commands
just proto- Generate protobuf filesjust build- Build the server binaryjust run- Run the serverjust dev- Full development workflow (deps + proto + run)just test- Run testsjust lint- Run linterjust clean- Clean build artifacts
API Endpoints
The server runs on two ports:
- gRPC server:
:8080 - HTTP gateway:
:8081
Example HTTP endpoints:
GET /v1/examples- List all examplesPOST /v1/examples- Create a new exampleGET /v1/examples/{id}- Get a specific example
Monorepo Integration
This template is designed to be integration-friendly for monorepo structures by:
- Excluding shared proto folders
- Using internal packages for service-specific logic
- Minimal external dependencies
- Clear separation of concerns