sphere
is a backend scaffolding designed for rapid development. It leverages ent
for database schema definition and gRPC/Protobuf
for API interface contracts. The framework includes a suite of tools for generating code and documentation, such as Protobuf
files, Swagger
/OpenAPI
specifications, and TypeScript
client libraries.
Sphere build tool. Usage: make [target]
build Build binary for current architecture
build/all Build for all supported platforms
clean Clean gen code and build files
gen/wire Generate wire code
gen/conf Generate example config
gen/db Generate ent code
gen/proto Generate proto files and run protoc plugins
gen/docs Generate swagger docs
gen/all Generate all code (ent, docs, wire)
gen/dts Generate swagger typescript docs
build/assets Build assets
build/docker Build docker image
build/multi-docker Build multi-arch docker image
run Run the application
run/swag Run the swagger server
deploy Deploy binary
lint Run linter
fmt Run formatter and fix issues
install Install dependencies tools
init Init all dependencies
help Show this help message
├── api # Go files generated by Protobuf definitions
├── assets # Static files (e.g., UI assets, templates)
├── cmd # Application entry points
│ ├── app # Main application
│ └── tools # Developer tools
├── devops # DevOps and infrastructure files (e.g., Docker, CI/CD)
├── internal # Private application and library code
│ ├── biz # Business logic layer (use cases)
│ ├── config # Configuration loading and management
│ ├── pkg # Shared internal packages
│ │ ├── database # Database setup, including ent schemas and client
│ │ └── ... # Other shared utilities
│ ├── server # Server implementation (gRPC, HTTP)
│ └── service # Service layer implementing the API interfaces
├── proto # Protobuf source files (.proto)
├── scripts # Helper scripts for development
└── swagger # Generated Swagger/OpenAPI documentation