From 672ab940425c1e2f50dfbcd33c9837a2086265d6 Mon Sep 17 00:00:00 2001 From: Rene Nochebuena Date: Sun, 13 Apr 2025 09:14:03 -0600 Subject: [PATCH] Update README with enhanced documentation and examples Revamp README to include detailed usage examples, installation instructions, scientific benchmarks, and core CQRS/Event-Sourcing patterns. Improve explanation of StoneCQRS features and benefits, targeting clearer communication and user engagement. --- README.md | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 701de2f..0d1d3ee 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,85 @@ -# stonecqrs +# 🔥 StoneCQRS - **10 billion% decoupled architecture!** -StoneCQRS - Ultimate CQRS/Event toolkit! ⚡ Command/Query separation with event-driven superpowers. Perfect for complex domains & microservices. Saga-ready architecture baked in. Part of stone-utils ecosystem. 10 billion% more decoupled! 🚀 \ No newline at end of file +Ultimate CQRS/Event toolkit! ⚡ Command/Query separation with event-driven superpowers. Perfect for complex domains & microservices. Saga-ready architecture baked in. Part of stone-utils ecosystem. 10 billion% more decoupled! 🚀 + +[![Kingdom of Science Approved](https://img.shields.io/badge/Approved%20By-Kingdom%20of%20Science-blueviolet)]() +[![EVENT-DRIVEN](https://img.shields.io/badge/Patterns-SO_BADASS!-blueviolet)]() +[![10 BILLION](https://img.shields.io/badge/Throughput-10_Billion%25-blueviolet)]() + +## 🚀 Why StoneCQRS? + +- **CQRS/Event-Sourcing** with Senku-level precision +- **Saga-ready** architecture out of the box +- **100% decoupled** components (like good science should be) +- **10 billion events/sec** handling capacity (theoretical) + +## 💥 Installation + +```bash +go get gitstormr.dev/stone-utils/stonecqrs@latest +``` + +## ⚡ Basic Usage + +```go +package main + +import ( + "gitstormr.dev/stone-utils/stonecqrs" +) + +type CreateOrderCommand struct{ UserID string } +type OrderCreatedEvent struct{ OrderID string } + +type OrderHandler struct{} + +func (h *OrderHandler) Handle(ctx context.Context, cmd stonecqrs.Command) ([]stonecqrs.Event, error) { + return []stonecqrs.Event{OrderCreatedEvent{OrderID: "123"}}, nil +} + +func main() { + dispatcher := stonecqrs.NewDispatcher() + dispatcher.RegisterCommandHandler(CreateOrderCommand{}, &OrderHandler{}) + events, _ := dispatcher.DispatchCommand(ctx, CreateOrderCommand{UserID: "u-456"}) + // events = [OrderCreatedEvent] +} +``` + +## 🔬 Core Patterns + +### Command -> Event -> Reaction + +```text +[CreateOrderCommand] + ↓ +[OrderCreatedEvent] → [PaymentHandler] → [InventoryHandler] +``` + +### Saga ready flow + +```go +// 1. Execute command +events, _ := dispatcher.DispatchCommand(ctx, cmd) + +// 2. Automatic event processing +// (Handlers trigger subsequent commands) + +// 3. Compensation on failure +// (Built-in rollback capabilities) +``` + +## ⚗️ Scientific Benchmarks + +| METRIC | STANDARD LIB | STONECQRS | +|---------------|---------------|-----------| +| Decoupling | 30% | 10B% | +| Scalability | 1x | ∞x | +| Debuggability | ❌ | 🔍💡 | + +**Join the Scientific Revolution!** + +> "This isn't just CQRS - it's revolutionizing software patterns like we revived civilization!" - Senku Ishigami + +Kingdom of Science Approved + +(Now with 100% more Chrome screaming "SO BADASS!") \ No newline at end of file