A pragmatic Go framework for HTTP (Gin) and gRPC services.
Trellis focuses on practical defaults, modular middlewares, and clean configuration.
go get trellis.tech/trellis/framework.v0
Minimal HTTP
package main
import (
"github.com/sirupsen/logrus"
"trellis.tech/trellis/framework.v0/configs"
"trellis.tech/trellis/framework.v0/services"
)
func main() {
cfg := &configs.Config{
ServiceType: configs.ServiceTypeHTTP, // or ServiceTypeGRPC
ServiceConfig: configs.ServiceConfig{Name: "my-service", Address: ":8080"},
LoggerConfig: configs.LoggerConfig{Level: logrus.InfoLevel, Formatter: "json"},
}
service, err := services.NewWithConfig(cfg)
if err != nil { panic(err) }
service.Start2StopWithSignal()
}
See:
Note: Core implementations for rate limiting, circuit breaker, and tracing are provided by trellis.tech/trellis/common.v3:
trellis.tech/trellis/common.v3/middleware/ratelimittrellis.tech/trellis/common.v3/middleware/circuitbreakertrellis.tech/trellis/common.v3/middleware/tracingframework/ ├── configs/ # Configuration structures and validation ├── middlewares/ # Middleware components (HTTP & gRPC) │ ├── httpmw/ # HTTP: timeout, body limit, compression, validation, auth, swagger, cache, ... │ ├── grpcmw/ # gRPC: timeout, error, logging, auth, cache, deduplication, ... │ ├── ratelimitmw/ # Rate limiting middleware (uses common.v3/middleware/ratelimit) │ └── circuitbreakermw/# Circuit breaker middleware (uses common.v3/middleware/circuitbreaker) ├── services/ # Service implementation (HTTP/gRPC) ├── utils/ # Framework-specific utilities │ ├── errors/ # Error response formatting │ ├── iputil/ # IP utility functions │ └── metrics/ # Metrics registry ├── routes/ # Route definitions ├── servers/ # Server registration interface └── examples/ # Example implementations
Dependencies: This framework uses trellis.tech/trellis/common.v3 for core implementations:
common.v3common.v3/clients/redisSee examples for runnable HTTP Gateway and gRPC servers.
# Run all tests (excluding examples)
make test
# Run tests with coverage
make test-cover
# Run tests with HTML coverage report
make test-cover-html
Copyright © 2025 Henry Huang
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.