RepositoryGo
sklinkert

sklinkert/go-ddd

Opinionated Domain Driven Design Template for Go

830sao
68fork
7issue
6lượt xem

Thành tựu nổi bật

Những danh hiệu mới nhất của dự án

1
TINIX TRENDING·Chủ đề: command-query

#1 Repository của tuần

1
TINIX TRENDING·Chủ đề: cqrs-pattern

#1 Repository của tuần

2
TINIX TRENDING·Chủ đề: ddd-architecture

#2 Repository của tuần

🏗️ Template Go-DDD: Xây dựng service Go theo chuẩn DDD & CQRS ngay từ đầu

go-ddd cung cấp một bộ khung xây dựng backend Go theo chuẩn Domain-Driven Design, CQRS, Onion architecture, kèm pipeline idempotent và tooling đồng bộ schema.

go-ddd là một template opinionated giúp bạn xây dựng nhanh các dịch vụ Go bán sản phẩm (production-grade), nơi business rules, infrastructure và lớp giao tiếp được tách biệt rõ rệt. Dự án mẫu marketplace minh họa cách mô hình hóa Seller, Product, cùng các aggregate, value object và validation rule.

✨ Điểm nổi bật

  • Onion architecture: Tách biệt domain, application, infrastructure và interface rõ rệt.
  • CQRS command/query: Tách biệt luồng ghi (command) và đọc (query) để tối ưu hiệu năng.
  • Pipeline idempotent: Retry-safe command handlers tránh ghi trùng lặp.
  • Migration discipline: SQL migrations, migrate.go và sqlc giữ schema và code đồng bộ.
  • Testcontainers: Cung cấp Postgres disposable trong test.
  • Soft delete: Xóa mềm bằng cột deleted_at để hỗ trợ khôi phục dữ liệu.
  • Domain-first validation: Validation diễn ra ở tầng domain, không phải ở database.

💡 Vì sao đáng chú ý

Khác với các template chung, go-ddd không chỉ là khung cấu trúc — mà còn đưa ra các nguyên tắc thiết kế sâu như việc set default value ở domain layer thay vì database, đọc lại dữ liệu sau khi ghi để tránh stale data, và phân biệt rõ find (có thể trả về null) vs get (bắt buộc có giá trị). Đây là lựa chọn lý tưởng cho nhóm muốn áp dụng DDD thực sự vào dự án Go mà không cần phải thiết kế lại từ đầu.


#Go #DDD #CQRS #OnionArchitecture #TiniX

Dự án tương tự

Khám phá các dự án và mô hình AI khác có sự tương đồng.

RepositoryC#
kgrzybek/modular-monolith-with-ddd

Full Modular Monolith application with Domain-Driven Design approach.

14.2k
Jun 4, 2024
RepositoryC#
evolutionary-architecture/evolutionary-architecture-by-example

Navigate the complex landscape of .NET software architecture with our step-by-step, story-like guide. Unpack the interplay between modular monoliths, microservices, domain-driven design, and various architectural patterns. Go beyond the one-size-fits-all solutions and understand how to blend these approaches based on your unique needs.

3.6k
Oct 26, 2026
RepositoryGo
ollama/ollama

Get up and running with Inkling, Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

189.0k
Dec 3, 2026
RepositoryGo
looplab/eventhorizon

Event Sourcing for Go!

1.7k
Sep 2, 2026
RepositoryGo
avelino/awesome-go

A curated list of awesome Go frameworks, libraries and software

197.4k
Dec 3, 2026
RepositoryC#
ardalis/CleanArchitecture

Clean Architecture Solution Template: A proven Clean Architecture Template for ASP.NET Core 10

18.6k
Dec 1, 2026
RepositoryTypeScript
mehdihadeli/awesome-software-architecture

📚 A curated list of awesome articles, videos, and other resources to learn and practice software architecture, patterns, and principles.

11.9k
Nov 25, 2026
RepositoryC#
EduardoPires/EquinoxProject

Web Application ASP.NET 9 using Clean Architecture, DDD, CQRS, Event Sourcing and a lot of good practices

6.8k
Apr 14, 2026
RepositoryJava
ddd-by-examples/library

A comprehensive Domain-Driven Design example with problem space strategic analysis and various tactical patterns.

6.1k
Sep 17, 2026