# Tutorials Step-by-step tutorials for building applications with Svrnty.CQRS. ## Overview This section provides comprehensive, hands-on tutorials that walk you through building real-world applications using Svrnty.CQRS. ## Tutorial Series ### [Modular Solution](modular-solution/) Build a properly structured solution with separated concerns: 1. **[Solution Structure](modular-solution/01-solution-structure.md)** - Create project structure (Api, CQRS, Domain, Infrastructure) 2. **[Domain Layer](modular-solution/02-domain-layer.md)** - Define entities, value objects, and domain events 3. **[CQRS Layer](modular-solution/03-cqrs-layer.md)** - Implement commands, queries, and handlers 4. **[DAL Layer](modular-solution/04-dal-layer.md)** - Set up Entity Framework Core and repositories 5. **[API Layer](modular-solution/05-api-layer.md)** - Configure HTTP and gRPC endpoints 6. **[Testing Strategy](modular-solution/06-testing-strategy.md)** - Unit and integration testing **What You'll Learn:** - Multi-project solution architecture - Layer separation and dependencies - Best practices for code organization - Testing strategies for each layer **Prerequisites:** - .NET 10 SDK - Basic understanding of C# and ASP.NET Core **Duration:** ~2-3 hours ### [Event Sourcing](event-sourcing/) Build an event-sourced application from scratch: 1. **[Fundamentals](event-sourcing/01-fundamentals.md)** - Event sourcing concepts and benefits 2. **[Aggregate Design](event-sourcing/02-aggregate-design.md)** - Design aggregates and domain events 3. **[Events and Workflows](event-sourcing/03-events-and-workflows.md)** - Implement event workflows 4. **[Projections](event-sourcing/04-projections.md)** - Build read models from events 5. **[Snapshots](event-sourcing/05-snapshots.md)** - Optimize with snapshots 6. **[Replay and Rebuild](event-sourcing/06-replay-and-rebuild.md)** - Replay events to rebuild projections **What You'll Learn:** - Event sourcing pattern - Aggregate root design - Projection building - Event replay - Snapshot optimization **Prerequisites:** - Completed "Getting Started" guide - Understanding of domain-driven design - PostgreSQL installed **Duration:** ~3-4 hours ### [E-Commerce Example](ecommerce-example/) Build a complete e-commerce order system: 1. **[Requirements](ecommerce-example/01-requirements.md)** - Define domain and requirements 2. **[Domain Events](ecommerce-example/02-domain-events.md)** - Design order lifecycle events 3. **[Commands](ecommerce-example/03-commands.md)** - PlaceOrder, CancelOrder, ShipOrder 4. **[Queries](ecommerce-example/04-queries.md)** - GetOrder, ListOrders, SearchOrders 5. **[Projections](ecommerce-example/05-projections.md)** - Order summaries and analytics 6. **[Sagas](ecommerce-example/06-sagas.md)** - Order fulfillment saga 7. **[HTTP API](ecommerce-example/07-http-api.md)** - Expose via HTTP endpoints 8. **[gRPC API](ecommerce-example/08-grpc-api.md)** - Expose via gRPC services 9. **[Complete Code](ecommerce-example/09-complete-code.md)** - Full working implementation **What You'll Learn:** - Real-world CQRS application - Event-driven workflows - Saga pattern for distributed transactions - Dual HTTP/gRPC endpoints - Complete working code **Prerequisites:** - Completed "Modular Solution" tutorial - PostgreSQL installed - Understanding of e-commerce domain **Duration:** ~4-6 hours ## Quick Start Projects ### Hello World CQRS ```bash # Create new project dotnet new webapi -n HelloCQRS cd HelloCQRS # Add packages dotnet add package Svrnty.CQRS dotnet add package Svrnty.CQRS.MinimalApi # Create command # Create handler # Register services # Run ``` See [Getting Started](../getting-started/README.md) for full guide. ### Event Streaming Quick Start ```bash # Add event streaming dotnet add package Svrnty.CQRS.Events.PostgreSQL dotnet add package Svrnty.CQRS.Events.ConsumerGroups # Start PostgreSQL docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=postgres postgres:16 # Configure services # Publish events # Consume events ``` See [Event Streaming Getting Started](../event-streaming/fundamentals/getting-started.md) for full guide. ## Learning Path ### Beginner 1. [Introduction to CQRS](../getting-started/01-introduction.md) 2. [Your First Command](../getting-started/03-first-command.md) 3. [Your First Query](../getting-started/04-first-query.md) 4. [Adding Validation](../getting-started/05-adding-validation.md) ### Intermediate 1. [Modular Solution Tutorial](modular-solution/README.md) 2. [Dynamic Queries](../core-features/dynamic-queries/README.md) 3. [gRPC Integration](../grpc-integration/getting-started-grpc.md) ### Advanced 1. [Event Sourcing Tutorial](event-sourcing/README.md) 2. [Consumer Groups](../event-streaming/consumer-groups/README.md) 3. [Projections and Sagas](../event-streaming/projections/README.md) 4. [E-Commerce Example](ecommerce-example/README.md) ## Sample Code All tutorial code is available in the [Svrnty.Sample](../../Svrnty.Sample/) project. **Key Examples:** - [Commands](../../Svrnty.Sample/Commands/) - [Queries](../../Svrnty.Sample/Queries/) - [Events](../../Svrnty.Sample/Events/) - [Projections](../../Svrnty.Sample/Projections/) - [Sagas](../../Svrnty.Sample/Sagas/) - [Workflows](../../Svrnty.Sample/Workflows/) ## Community Examples Share your tutorials and examples: - Submit a pull request with your tutorial - Link to your blog post or GitHub repo - Join the discussion on GitHub ## See Also - [Getting Started](../getting-started/README.md) - [Best Practices](../best-practices/README.md) - [Samples](../samples/README.md) - [Troubleshooting](../troubleshooting/README.md)