go-spring/go-spring
Tentang
๐ฅ [dirilis] Framework pengembangan back-end Go lengkap berbasis IoC dan pendekatan IDLs-First (All-in-One Development Framework on IoC and IDLs-First for Go) ๐
Pengembangan web dan aplikasiPertumbuhan bintang terukur
- dalam 24 jam
- +2
- dalam 7 hari
- +3
- dalam 15 hari
- +2
- dalam 1 bulan
- 0
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AsliGo-Spring: Make Go Service Development as Simple as Spring Boot, and Then Some
Project status: unreleased. The stack is still being polished: APIs and boundaries may change, and large-scale breaking changes are allowed โ principles take precedence over compatibility. See STATUS.md.
If you think this is just another Go framework, keep reading.
Go-Spring's mission is building a complete, vendor-neutral application ecosystem for Go โ the assembly layer the Go ecosystem is missing: DI libraries ship parts, framework ecosystems orbit their own transport, component libraries don't know each other. Go-Spring assembles them all.
It takes the battle-tested paradigms from two decades of Java Spring โ dependency injection, auto-configuration, the Starter mechanism โ and reimagines them in idiomatic Go. Spring rescued Java from EJB hell, turning heavyweight applications into composable, reusable, modular engineering. Go-Spring aims to give Go developers that same superpower.
That mission matters more in the AI era, not less. As AI writes more and more of the code, the scarce resource stops being typing speed and becomes the substrate: a stable, complete, self-describing foundation that both people and agents can build on โ and be held to. Go-Spring is built to be that foundation โ 90+ Starters behind one configuration model, one application lifecycle and a single machine-checked observability contract, with the project's engineering conventions written down next to the code (starter/DESIGN.md, per-module
DESIGN/USAGEdocs, and the/gsClaude Code Skill).
The Ecosystem
Go-Spring is not a single repository โ it's a complete R&D ecosystem composed of a core framework, an ecosystem abstraction library, 90+ Starters, developer tooling, example applications, and project templates. The layers are strictly ordered โ dependencies flow one way, downward โ and each layer has a clear role; use what you need.
| Layer | Role | Key Projects |
|---|---|---|
| Foundation | Zero-dependency utilities + pure semantic pieces (HTTP client/server, โฆ) + structured logging engine | stdlib, log |
| Core | IoC container, DI, layered config engine, application lifecycle โ nothing else | spring (gs + conf) |
| Ecosystem Library | Container-free capability abstractions: governance center, discovery, load balancing, cache, lock, messaging, scheduling, security, โฆ โ imports no spring package | cloud |
| Integration | 90+ pluggable Starters: third-party SDKs + gs wiring | starter/ โ Gin, gRPC, Redis, MySQL, Kafka, Dubbo, Kitexโฆ |
| Tooling | CLI, code generation, mocking, AI skill | gs, gs-http-gen, gs-mock, skills/gs |
| Examples & Templates | End-to-end example apps + project scaffolds | contrib/, layout/ |
The rule of thumb that keeps the stack clean: abstractions go in cloud, third-party SDKs and gs wiring go in a starter, pure semantics with no ecosystem dependency go in stdlib โ a starter wires, cloud abstracts, spring runs.
What that adds up to today: 90+ starter modules โ 6 web frameworks plus the stdlib HTTP server, 8 RPC frameworks, 12 database engines, 4 caches, 7 message queues, 7 configuration sources, 5 registries, 4 distributed locks and 3 transaction models, plus object storage, mail, webhooks, scheduling, batch, gateway and security. They are configured through the same layered engine and join the same application lifecycle; most share a single governance center and observability model, and where a component brings a mature ecosystem of its own, the integration adapts to it rather than the other way round. Swapping a backend is a configuration change, not a rewrite: the abstraction is neutral, so nothing around it has to move.
The design constraints every starter follows live in starter/DESIGN.md; a categorized tour of the modules is in starter/README.md.
Why Go-Spring
The Mission: Completing the Go Ecosystem
Go's standard library is famously complete for a language runtime โ and deliberately minimal at the application level: no dependency-injection model, no layered-configuration convention, no starter-style auto-configuration, no unified application lifecycle or governance layer. Java fills that gap with Spring; Go has nobody filling it โ DI libraries ship parts, framework ecosystems orbit their own transport, component libraries don't know each other.
Go-Spring exists to fill exactly that gap: building a complete, vendor-neutral application ecosystem for Go โ not another RPC framework, not another web framework, and not a rewrite of anything you already use. It competes with nothing in your stack; it assembles your stack.
Who else plays this seat? An honest landscape:
| Adjacent players | Examples | Why they're not this |
|---|---|---|
| DI libraries | Wire, fx, dig | Solve injection only โ no config engine, no starter model, no lifecycle or governance. Parts, not an ecosystem. |
| Framework-centric ecosystems | Kratos, go-zero, CloudWeGo | Excellent, but the ecosystem orbits their own framework: transport, layout, codegen, tooling. Adopting one is a commitment. |
| Component libraries | dubbo-go, Kitex, Hertz, GORM, Ginโฆ | Peers, not competitors โ Go-Spring integrates them all symmetrically as Starters. |
The neutral Spring-Boot-shaped application platform for Go is an essentially empty niche. That is the seat Go-Spring takes.
Not Another RPC Framework โ an Application Platform
This is the sharpest day-to-day difference from projects like dubbo-go, Kitex, Kratos, or go-zero: those are (primarily) RPC / microservice frameworks โ they own the transport layer, the service model, and often a code-generation pipeline. Your application is a dubbo application or a Kitex application; adopting one means adopting its programming model.
Go-Spring owns no protocol and no transport. It is the assembly and runtime layer beneath and beside them: dependency injection, layered configuration with hot reload, lifecycle management, and centralized service governance. Proof by construction โ in this very repository, dubbo-go, Kitex, Kratos, go-zero, GoFrame, gRPC, tRPC, and Thrift each appear as one Starter among 90, integrated by the same gs.Module mechanism as Redis or MySQL:
| dubbo-go / Kitex / go-zero / Kratos | Go-Spring | |
|---|---|---|
| Category | RPC / microservice framework (owns transport, service model, codegen) | Application assembly & runtime platform (IoC + config + lifecycle + governance) |
| Relationship | Integrated by Go-Spring โ starter-dubbo wraps dubbo-go; starter-kitex, starter-kratos, starter-go-zeroโฆ wrap the rest |
Integrates them all symmetrically; picks no winner |
| Configuration | Each ships its own config model | One layered engine (CLI โ env โ files โ Nacos/etcd/Consul/Vault/K8s) driving every component, with gs.Dync[T] hot reload |
| Governance | Scoped to its own RPC calls (dubbo-go: URL-param overrides) | One centralized governance center โ timeout/retry/breaker/rate-limit + fault injection applied uniformly across Redis, GORM, HTTP, gRPC, gin, dubboโฆ from one governance rules document, with pluggable rule sources (file/HTTP console/nacos/etcd direct listeners) |
| Programming model | Framework-defined interfaces and structure required | Zero intrusion: standard net/http, plain structs, your layout |
| Use alone | Yes | Yes โ the core (spring) and ecosystem library (cloud) are usable without any RPC framework at all |
In short: they answer "how do services call each other"; Go-Spring answers "how an application is assembled, configured, governed, and kept maintainable". A production service typically needs both โ which is why Go-Spring integrates them rather than competing with them. (For the DI-framework axis โ Wire/fx/dig โ see the comparison in spring/README.md.)
Out-of-the-Box, Zero Intrusion
Every capability ships as a Starter. No inheritance, no adapters, no sprawling initialization boilerplate in main.go โ import a starter and it automatically wires your components into the application lifecycle. The framework doesn't hijack main(), doesn't impose routing groups, doesn't mandate a directory layout. You write business logic your way; the framework handles assembly and lifecycle.
Observability: Complete by Default, Extensible by Design
Observability is where an "ecosystem of parts" usually falls apart: every library brings its own idea of what a metric is called, and the moment you swap a backend your dashboards, alerts and queries stop meaning anything. Go-Spring treats it as a contract instead.
- Every component is instrumented โ not opt-in. All 54 instrumented components (the database, messaging, HTTP and RPC families, plus the cloud domain packages) emit their signals under one specification, where a missing signal โ or a result value that can't tell success from failure โ counts as a defect rather than a style difference. Coverage includes the operations the framework performs on your behalf: discovery heartbeats, lock acquisition, cache and MQ access, not just your own handlers.
- Same vocabulary across same-kind components. Components of the same kind share names, instrument types and value vocabularies, following OpenTelemetry semantic conventions (
db.system,messaging.system,http.*). Trade one cache backend for another, or Kafka for Pulsar, and your operations assets keep reading the same way. Components are still free to add their own fields โ consistency is required only where the meaning is the same. - Enforced by a script, not by good intentions.
scripts/check-observability.shmechanically verifies the specification across all 54 components, andscripts/check-all.shruns it on every push and PR โ drift breaks the build instead of quietly rotting. - Your own data goes in without forking the framework. Annotate a context with
log.WithFields/log.Collect, orattrs.WithSpanAttributes(packagecloud/observability/attrs), and the values land on the log lines and on every span โ including spans the framework starts on your behalf, which you never get a handle on. Metrics stay deliberately closed (unbounded labels are how cardinality blows up); when you need a metric of your own, build one withotel.Meter(...). - No bespoke observability API to learn. It is the framework's
logpackage and OpenTelemetry itself, so everything you already know about OTLP, collectors and backends still applies.
Dependency Injection, the Go Way
No reflection magic, no @Autowired annotations, no XML configuration. Every dependency is declared explicitly through constructor parameters and wired by type automatically:
gs.Provide(func(db *gorm.DB) *UserService {
return &UserService{db: db}
})
Declare what you need, expose what you provide โ nothing more.
Unified Runtime Model: Runners & Servers
Go-Spring distills all service patterns into two abstractions:
- Runner โ A one-shot execution unit (scheduled tasks, batch processing, startup-only logic). The container collects all Runners and executes them in configured order.
- Server โ A long-lived service (HTTP, gRPC, Thrift, WebSocketโฆ). The container handles
ListenAndServeand graceful shutdown;ReadySignalnotifies when the service is ready.
No manual signal handling, no goroutine lifecycle management โ the framework has you covered.
Built-in Enterprise Infrastructure
| Domain | Capability | Coverage |
|---|---|---|
| Configuration | Multi-source layered merging (CLI โ env vars โ config files โ remote config centers), type-safe binding, dynamic refresh | Nacos, Consul, Etcd, K8s ConfigMap, Vault, Apollo |
| Service Governance | Centralized governance center: timeout/retry/breaker/rate-limit/bulkhead + fault injection, one rules document for every client, hot-reloaded | default & sentinel backends; rule sources: file, HTTP console, nacos, etcd |
| Logging | Structured logging model, concise config DSL, pluggable Appenders | Console, File, custom |
| Service Discovery | Unified Discovery abstraction, multiple discovery backends |
Consul, Etcd, Nacos, Zookeeper, K8s |
| Distributed Coordination | Distributed locks, messaging, transactions, scheduling, batch processing | Lock (4 backends), Kafka, Pulsar, RocketMQ, RabbitMQ, NATS, MQTT, Saga, TCC, AT |
| Observability | Every component instrumented under one specification, with a machine-checked contract; import one starter to light up tracing and metrics for all of them | starter-otel + per-starter example-otel |
| Security | Access control, OAuth2, JWT, Session | Casbin (RBAC/ABAC/ACL), OAuth2 Client/Server, JWT, distributed Session |
A Rich Starter Ecosystem โ 90+ Modules
Each starter is an independent Go module. Pull in only what you need; the dependency graph stays clean:
- Web Frameworks: Gin, Echo, Hertz, go-zero, GoFrame, Kratos โ plus a middleware kit for the stdlib
net/httpserver - RPC Frameworks: gRPC, Kitex, Thrift, tRPC, Dubbo-go, go-zero/zrpc, GoFrame/gRPC, Kratos/gRPC
- WebSocket: Gorilla, Coder, GoFrame, Kratos
- HTTP Client: interface-driven clients with discovery, load balancing and resilience wired in (
gs-http-gengenerates the call sites) - Databases: MySQL, PostgreSQL, SQL Server, ClickHouse, SQLite, MongoDB, Neo4j, Elasticsearch, Cassandra/ScyllaDB, Milvus, InfluxDB, TDengine
- Caching: Redis (redigo), BigCache
- Object Storage: S3 protocol โ MinIO, AWS S3, Aliyun OSS, Tencent COS
- Message Queues: Kafka (franz-go / Sarama dual drivers), Pulsar, RocketMQ, RabbitMQ, NATS + JetStream, MQTT
- Task Queues: asynq, xxl-job
- Config Centers: File, Consul, Etcd, Nacos, K8s ConfigMap, Vault, Apollo
- Service Registries: Consul, Etcd, Nacos, Zookeeper, K8s
- Distributed Primitives: Locks (Consul/Etcd/K8s/Redis), Transactions (Saga/TCC/AT), Outbox, Scheduler, Batch, Goroutine Pool
- Security: Casbin, OAuth2 (Client/Server/Resource Server), JWT, Session-Redis, Lua request filters
- Observability: OpenTelemetry (Tracing + Metrics), pprof, Actuator, Admin UI
- Company Baseline:
starter-luohuaโ compose a whole organization's defaults (identity, wire vocabulary, error catalog, standard cache) into one module, so a service re-bases onto company conventions by blank-importing it - More: Mail, Webhooks, Schema Migration (goose), Swagger, API Gateway, Rate Limiting
Categorized overview: starter/README.md.
Powerful Toolchain
| Tool | Purpose |
|---|---|
gs |
One-stop CLI: create projects, add components, generate code, run services |
gs-http-gen |
Modern IDL syntax โ HTTP server + declarative client code generation (nullable types, generics, embedding โ OpenFeign-equivalent) |
gs-mock |
Type-safe Go mock library with native generics support and concurrency safety |
/gs |
Claude Code Skill for the full project lifecycle: plan โ execute โ deliver, holding the change to the project's existing conventions (install) |
Seamless Testing Integration
Deeply integrated with go test. Use gs.RunTest() to boot a real container in tests, with real dependencies โ no need to mock everything. When you do need mocks, gs-mock provides type-safe method/function-level mocking that's goroutine-safe via context-based data isolation.
Where Go-Spring Is Going
The direction is not "more features for their own sake" โ it's making the foundation complete and dependable enough that a Go team can stop rebuilding one. Four concrete moves:
- Close the long tail of integrations. If a service needs it, the answer should be a Starter rather than an in-house glue package. New starters land under the same shared design constraints (starter/DESIGN.md) โ ports, driver mode, multi-instance addressing, fail-fast validation โ so they behave like the ones already there.
- One governance and observability model, for every component. Coverage already spans the common stacks; the direction is that no backend is a second-class citizen โ governed from the same rules document, instrumented under the same vocabulary, checked by the same script.
- Keep the application-level API stable. A framework earns the word "foundation" by not forcing business code to change when it evolves. That is the standing constraint on everything above after release: additive helpers are fine, breaking changes are not. During the current pre-release polishing phase, breaking changes are allowed โ see STATUS.md.
- Make the conventions machine-readable. The project's rules already live next to the code โ starter/DESIGN.md, per-module
DESIGN/USAGEdocs, and the/gsskill. As agents take on more of the coding, a framework whose conventions an agent can read and follow โ not merely call โ is what makes it usable as a substrate.
If you build Go services for a living, this is a seat worth filling together: every integration you contribute is one fewer internal wrapper someone else has to write.
Get Started in One Minute
# 1. Install the gs tool
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/go-spring/gs/HEAD/install.sh)"
# 2. Create a project
gs init --module github.com/yourname/yourproject
# 3. Run it
go run main.go
Documentation
| Document | Description |
|---|---|
| Overview | Introduction, AI engineering philosophy, Claude Code best practices |
| Getting Started | Project creation, development, running |
| Guides | Configuration, IoC, lifecycle, logging, HTTP server, components, testing, http-gen |
| Examples | Complete example index |
| Integrations | Detailed integration docs for each starter |
| FAQ | Frequently asked questions |
| Contributing | How to contribute |
| Changelog | Version history |
If you prefer learning through complete, progressive examples, see go-spring-first, which provides 10 getting-started examples.
Contributing
How to become a contributor? Submit meaningful PRs or feature requests, and have them accepted. See CONTRIBUTING.md for details.
Concrete places to start, roughly in order of effort:
- Report a rough edge โ a component whose configuration, governance or observability doesn't match the rest of its family.
- Sync the docs โ every module ships an English/Chinese pair and they drift; translations count as contributions.
- Write an example under contrib/ that combines starters and is verified end to end.
- Add a Starter for a backend you already use โ follow starter/DESIGN.md and the closest existing starter as a template.
Community
![]() |
![]() |
| QQ Group: 721077608 | WeChat: GoSpringๅฎๆ |
Donation

To drive the continuous growth of Go-Spring, we warmly invite your support. Your donation will help us iterate faster, improve the ecosystem, and strengthen the community.
Star History
License
Go-Spring is released under version 2.0 of the Apache License.
Jelajahi proyek terkait
Memuatโฆ
.jpeg)
