Go Web GraphQL Backend
English | 中文
A modern Go web backend featuring:
- GraphQL API powered by gqlgen
- Ent ORM for database modeling
- Redis for Automatic Persisted Query (APQ) caching
- Custom error handling and i18n
- Developer experience enhancements (Playground, hot reload, etc.)
Features
- GraphQL API with schema-first development
- Ent ORM integration
- Redis APQ cache for persisted queries
- Unified error handling and internationalization
- GraphQL Playground for API exploration
- Transaction and query complexity middleware
Getting Started
Prerequisites
- Go 1.18+
- Redis
- (Optional) a SQL database supported by Ent
Installation
git clone <your-repo-url>
cd go-web
make install # or go mod tidyConfiguration
- Edit
.envfor database and Redis connection settings.
Running
make run # or go run main.go- GraphQL endpoint:
POST /query - Playground:
GET /playground
Development
- Hot reload: use air or fresh
- Schema changes: edit
graph/*.graphql, then runmake generate - Add resolvers in
interface/resolvers/
Testing
make testProject Structure
graph/- GraphQL schema and generated codeinterface/resolvers/- Resolver implementationspkg/redis/- Redis APQ cachepkg/errors/- Custom error typespkg/i18n/- Internationalization
License
MIT
On this page
Languages
Go99.1%Makefile0.9%
Contributors
MIT License
Created March 30, 2023
Updated December 12, 2025