GitHunt
SY

sy-vendor/go-web

Go-Web 是一个基于 Go 语言开发的现代化 Web 应用框架,它集成了多个优秀的开源组件,提供了一个完整的后端服务解决方案。

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 tidy

Configuration

  • Edit .env for 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 run make generate
  • Add resolvers in interface/resolvers/

Testing

make test

Project Structure

  • graph/ - GraphQL schema and generated code
  • interface/resolvers/ - Resolver implementations
  • pkg/redis/ - Redis APQ cache
  • pkg/errors/ - Custom error types
  • pkg/i18n/ - Internationalization

License

MIT

Languages

Go99.1%Makefile0.9%

Contributors

MIT License
Created March 30, 2023
Updated December 12, 2025
sy-vendor/go-web | GitHunt