A modern event management system supporting HTTP REST, gRPC, and GraphQL APIs with shared business logic and maximum component reuse.
/Users/talabi/repo/bezaeel/go/context/eventify/
├── api/
│ ├── http/ # HTTP REST endpoints
│ │ ├── controllers/ # HTTP controllers
│ │ ├── middlewares/ # HTTP middlewares
│ │ └── routes/ # HTTP route definitions
│ ├── grpc/ # gRPC endpoints
│ │ ├── handlers/ # gRPC handlers
│ │ ├── interceptors/ # gRPC interceptors
│ │ └── proto/ # Protocol buffer definitions
│ └── graphql/ # GraphQL endpoints
│ ├── resolvers/ # GraphQL resolvers
│ ├── schemas/ # GraphQL schema definitions
│ └── directives/ # GraphQL directives
├── internal/
│ ├── domain/ # Shared domain models
│ ├── service/ # Shared business logic
│ ├── repository/ # Shared data access layer
│ └── shared/ # Shared utilities
│ ├── auth/ # Authentication & authorization
│ ├── config/ # Configuration management
│ └── constants/ # Shared constants
├── pkg/ # Shared packages
│ ├── database/ # Database connection
│ ├── logger/ # Logging utilities
│ └── telemetry/ # Observability & telemetry
├── cmd/
│ ├── http-server/ # HTTP server binary
│ ├── grpc-server/ # gRPC server binary
│ └── graphql-server/ # GraphQL server binary
└── tests/
├── integration/
│ ├── http/ # HTTP integration tests
│ ├── grpc/ # gRPC integration tests
│ └── graphql/ # GraphQL integration tests
└── unit/
├── http/ # HTTP unit tests
├── grpc/ # gRPC unit tests
└── graphql/ # GraphQL unit tests
All three API protocols (HTTP, gRPC, GraphQL) share the same core components:
- Domain Models: Single source of truth for data structures
- Business Logic: Shared service layer for all business operations
- Data Access: Unified repository pattern for database operations
- Authentication: Common JWT-based authentication system
- Telemetry: Unified observability and monitoring
- Configuration: Centralized configuration management
Each API type has its own transport layer:
- HTTP: Controllers, middlewares, and route definitions
- gRPC: Handlers, interceptors, and protocol buffer definitions
- GraphQL: Resolvers, schemas, and directives
- Go 1.21+
- PostgreSQL
- Docker (for development)
cd cmd/http-server
go run main.go
# Server starts on :3000cd cmd/grpc-server
go run main.go
# Server starts on :50051cd cmd/graphql-server
go run main.go
# Server starts on :8080# Run migrations
go run cmd/http-server/main.go migrate
# Seed initial data
go run cmd/http-server/main.go seed- Swagger UI:
http://localhost:3000/docs - Base URL:
http://localhost:3000/api/v1
- Reflection: Available for development tools
- Port:
:50051
- Playground:
http://localhost:8080 - Endpoint:
http://localhost:8080/query
# All tests
go test ./tests/...
# HTTP tests only
go test ./tests/unit/http/...
go test ./tests/integration/http/...
# gRPC tests only
go test ./tests/unit/grpc/...
go test ./tests/integration/grpc/...
# GraphQL tests only
go test ./tests/unit/graphql/...
go test ./tests/integration/graphql/...# Generate protobuf code
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
api/grpc/proto/*.proto# Generate GraphQL code (when using gqlgen)
go run github.com/99designs/gqlgen generate- Single Business Logic: All APIs use the same service layer
- Shared Domain Models: Consistent data structures across protocols
- Unified Authentication: Same JWT system for all APIs
- Common Telemetry: Unified observability and monitoring
- HTTP: RESTful design with JSON responses
- gRPC: High-performance binary protocol
- GraphQL: Flexible querying with schema introspection
- Independent Deployment: Each API can be deployed separately
- Different Scaling: Each API can scale independently
- API Gateway Ready: Can be fronted by an API gateway
- Follow the existing code structure
- Add tests for new features
- Update documentation
- Ensure all APIs remain consistent
[Add your license here]