2025-08-13 19:12:51 +02:00
2025-08-13 19:12:51 +02:00
2025-08-13 19:12:51 +02:00
2025-08-13 19:12:51 +02:00
2025-08-13 19:12:51 +02:00
2025-08-13 19:12:51 +02:00
2025-08-13 19:12:51 +02:00
2025-08-13 19:12:51 +02:00
2025-08-13 19:12:51 +02:00
2025-08-13 19:12:51 +02:00

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

  • Go 1.21+
  • Protocol Buffers compiler (protoc)
  • just task runner
  • nushell (for justfile execution)

Getting Started

  1. Install dependencies:

    just deps
    
  2. Generate protobuf files:

    just proto
    
  3. Build and run the server:

    just dev
    

Available Commands

  • just proto - Generate protobuf files
  • just build - Build the server binary
  • just run - Run the server
  • just dev - Full development workflow (deps + proto + run)
  • just test - Run tests
  • just lint - Run linter
  • just 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 examples
  • POST /v1/examples - Create a new example
  • GET /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
Description
No description provided
Readme 56 KiB
Languages
HTML 62.8%
Go 30.4%
Just 4.3%
Dockerfile 2.5%