feature/epic1-core-infrastructure #2
@@ -1,7 +1,7 @@
|
||||
# Go‑Platform Boilerplate Play‑book
|
||||
**“Plug‑in‑friendly SaaS/Enterprise Platform – Go Edition”**
|
||||
|
||||
## 1️⃣ ARCHITECTURAL IMPERATIVES (Go‑flavoured)
|
||||
## 1 ARCHITECTURAL IMPERATIVES (Go‑flavoured)
|
||||
|
||||
| Principle | Go‑specific rationale | Enforcement Technique |
|
||||
|-----------|-----------------------|------------------------|
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
---
|
||||
|
||||
## 2️⃣ CORE KERNEL (What every Go‑platform must ship)
|
||||
## 2 CORE KERNEL (What every Go‑platform must ship)
|
||||
|
||||
| Module | Public Interfaces (exported from `pkg/`) | Recommended Packages | Brief Implementation Sketch |
|
||||
|--------|-------------------------------------------|----------------------|------------------------------|
|
||||
@@ -40,7 +40,7 @@ All *public* interfaces live under `pkg/` so that plug‑ins can import them wit
|
||||
|
||||
---
|
||||
|
||||
## 3️⃣ MODULE (PLUGIN) FRAMEWORK
|
||||
## 3 MODULE (PLUGIN) FRAMEWORK
|
||||
|
||||
### 3.1 Interface that every module must implement
|
||||
|
||||
@@ -167,7 +167,7 @@ A **code‑gen** tool (`go generate ./...`) can scan each module’s `module.yam
|
||||
|
||||
---
|
||||
|
||||
## 4️⃣ SAMPLE FEATURE MODULE – **Blog**
|
||||
## 4 SAMPLE FEATURE MODULE – **Blog**
|
||||
|
||||
```
|
||||
modules/
|
||||
@@ -312,7 +312,7 @@ func (r *PostRepo) Create(ctx context.Context, p *Post) (*Post, error) {
|
||||
|
||||
---
|
||||
|
||||
## 5️⃣ INFRASTRUCTURE ADAPTERS (swap‑able, per‑environment)
|
||||
## 5 INFRASTRUCTURE ADAPTERS (swap‑able, per‑environment)
|
||||
|
||||
| Concern | Implementation (Go) | Where it lives |
|
||||
|---------|---------------------|----------------|
|
||||
@@ -328,7 +328,7 @@ All adapters expose an **interface** in `pkg/infra/…` and are registered in th
|
||||
|
||||
---
|
||||
|
||||
## 6️⃣ OBSERVABILITY STACK
|
||||
## 6 OBSERVABILITY STACK
|
||||
|
||||
| Layer | Library | What it does |
|
||||
|-------|---------|--------------|
|
||||
@@ -372,7 +372,7 @@ func PromMetrics() gin.HandlerFunc {
|
||||
|
||||
---
|
||||
|
||||
## 7️⃣ CONFIGURATION & ENVIRONMENT
|
||||
## 7 CONFIGURATION & ENVIRONMENT
|
||||
|
||||
```
|
||||
config/
|
||||
@@ -405,7 +405,7 @@ All services receive a `*Config` via DI.
|
||||
|
||||
---
|
||||
|
||||
## 8️⃣ CI / CD PIPELINE (GitHub Actions)
|
||||
## 8 CI / CD PIPELINE (GitHub Actions)
|
||||
|
||||
```yaml
|
||||
name: CI
|
||||
@@ -469,7 +469,7 @@ jobs:
|
||||
|
||||
---
|
||||
|
||||
## 9️⃣ TESTING STRATEGY
|
||||
## 9 TESTING STRATEGY
|
||||
|
||||
| Test type | Tools | Typical coverage |
|
||||
|-----------|-------|------------------|
|
||||
@@ -523,7 +523,7 @@ func TestCreatePost_Integration(t *testing.T) {
|
||||
|
||||
---
|
||||
|
||||
## 10️⃣ COMMON PITFALLS & SOLUTIONS (Go‑centric)
|
||||
## 10 COMMON PITFALLS & SOLUTIONS (Go‑centric)
|
||||
|
||||
| Pitfall | Symptom | Remedy |
|
||||
|---------|----------|--------|
|
||||
@@ -540,7 +540,7 @@ func TestCreatePost_Integration(t *testing.T) {
|
||||
|
||||
---
|
||||
|
||||
## 11️⃣ QUICK‑START STEPS (What to code first)
|
||||
## 11 QUICK‑START STEPS (What to code first)
|
||||
|
||||
1. **Bootstrap repo**
|
||||
```bash
|
||||
@@ -586,7 +586,7 @@ After step 10 you have a **complete, production‑grade scaffolding** that:
|
||||
|
||||
---
|
||||
|
||||
## 12️⃣ REFERENCE IMPLEMENTATION (public)
|
||||
## 12 REFERENCE IMPLEMENTATION (public)
|
||||
|
||||
If you prefer to start from a **real open‑source baseline**, check out the following community projects that already adopt most of the ideas above:
|
||||
|
||||
@@ -602,7 +602,7 @@ Fork one, strip the business logic, and rename the packages to match *your* `git
|
||||
|
||||
---
|
||||
|
||||
## 13️⃣ FINAL CHECKLIST (before you ship)
|
||||
## 13 FINAL CHECKLIST (before you ship)
|
||||
|
||||
- [ ] Core modules compiled & registered in `internal/di`.
|
||||
- [ ] `module.IModule` interface and static registry in place.
|
||||
@@ -617,4 +617,4 @@ Fork one, strip the business logic, and rename the packages to match *your* `git
|
||||
- [ ] Sample plug‑in (Blog) builds, loads, registers routes, and passes integration test.
|
||||
- [ ] Documentation: `README.md`, `docs/architecture.md`, `docs/extension-points.md`.
|
||||
|
||||
> **Congratulations!** You now have a **robust, extensible Go platform boilerplate** that can be the foundation for any SaaS, internal toolset, or micro‑service ecosystem you wish to build. Happy coding! 🚀
|
||||
> **Congratulations!** You now have a **robust, extensible Go platform boilerplate** that can be the foundation for any SaaS, internal toolset, or micro‑service ecosystem you wish to build. Happy coding!
|
||||
Reference in New Issue
Block a user