English | 简体中文
⚠️ Repository Reorganized: This repository has been reorganized. All code has been moved to the main repository.
New Repository: go-sweets/go-sweets
go-sweets is a Go framework for building cloud-native microservices with modern tools and best practices. It provides:
- CLI Tool: Project scaffolding tool
- Service Template: Production-ready microservice implementation using CloudWeGo framework
- Shared Packages: Reusable utilities for common tasks
git clone https://github.com/go-sweets/go-sweets.git
cd go-sweets/cli
go build -o mpctl main.go./mpctl new <service-name>The generated service includes everything you need:
cd <service-name>
go mod tidy
make runBy default, the service listens on:
- HTTP:
http://localhost:8080(Hertz) - RPC:
localhost:9090(Kitex)
curl 'http://localhost:8080/v1/hello?id=1'Expected response:
{"id":"1","message":"Hello 1 !"}Complete microservice implementation featuring:
- CloudWeGo Hertz: High-performance HTTP framework
- CloudWeGo Kitex: High-performance RPC framework with Protocol Buffers
- Wire: Compile-time dependency injection
- GORM: Database ORM with Goose migrations
- Redis: Caching and session management
- DDD Architecture: Domain-Driven Design with bounded contexts
See sweets-layout/CLAUDE.md for detailed documentation.
Independent utility packages:
conf/: Configuration managementdi/: Dependency injection utilitiesvalidator/: Input validationhash/: Hashing utilitieslock/: Distributed lockingmigrate/: Database migration toolsresp/: Response formattingcontains/: Container utilitiesconvert/: Type conversion utilitieserrcode/: Error code managementstr/: String utilitiesplugins/gorm/filter/: GORM database filters
cd cli
go build -o mpctl main.gocd sweets-layout
make init # Install dependencies and tools
make proto # Generate protobuf code
make wire # Run Wire dependency injection
make run # Run the service
make test # Run tests
make lint # Run linterImport packages in your code:
import "github.com/go-sweets/go-sweets/common/<package-name>"Or use local replace directives during development:
replace github.com/go-sweets/go-sweets/common/conf => ../common/conf- Main Repository: go-sweets/go-sweets
- Service Architecture: sweets-layout/CLAUDE.md
- Project Guide: CLAUDE.md
Apache License Version 2.0 - See LICENSE for details.
Contributions are welcome! Please visit the main repository to contribute.