Skip to content

Core ConceptsΒΆ

Welcome to the Core Concepts guide! This section explains the architectural patterns and principles that Neuroglia is built upon. Each concept is explained for beginners - you don't need prior knowledge of these patterns.

🎯 Why These Patterns?¢

Neuroglia enforces specific architectural patterns because they solve real problems in software development:

  • Maintainability: Code that's easy to change as requirements evolve
  • Testability: Components that can be tested in isolation
  • Scalability: Architecture that grows with your application
  • Clarity: Clear separation of concerns and responsibilities

πŸ“š Concepts OverviewΒΆ

Architecture PatternsΒΆ

  • Clean Architecture - Organizing code in layers with clear dependencies

  • Problem it solves: Tangled code where everything depends on everything

  • Key benefit: Business logic independent of frameworks and databases

  • Dependency Injection - Providing dependencies instead of creating them

  • Problem it solves: Hard-coded dependencies that make testing difficult
  • Key benefit: Loosely coupled, testable components

Domain-Driven DesignΒΆ

  • Domain-Driven Design Basics - Modeling your business domain

  • Problem it solves: Business logic scattered across services

  • Key benefit: Rich domain models that encapsulate business rules

  • Aggregates & Entities - Building blocks of your domain

  • Problem it solves: Unclear boundaries and consistency rules
  • Key benefit: Clear transaction boundaries and data consistency

Application PatternsΒΆ

  • CQRS (Command Query Responsibility Segregation) - Separating reads from writes

  • Problem it solves: Single model trying to serve both read and write operations

  • Key benefit: Optimized read and write paths, better scalability

  • Mediator Pattern - Request routing and handling

  • Problem it solves: Controllers knowing about specific handlers

  • Key benefit: Loose coupling, easy to add cross-cutting concerns

  • Event-Driven Architecture - Reacting to business occurrences

  • Problem it solves: Tight coupling between components
  • Key benefit: Extensible, loosely coupled systems

Data PatternsΒΆ

  • Repository Pattern - Abstracting data access

  • Problem it solves: Domain code coupled to database

  • Key benefit: Testable, swappable data access

  • Unit of Work - Managing transactions

  • Problem it solves: Manual transaction management and event publishing
  • Key benefit: Consistent transactional boundaries

🚦 Learning Path¢

New to these concepts? Follow this path:

  1. Start here: Clean Architecture
  2. Then learn: Dependency Injection
  3. Domain modeling: Domain-Driven Design
  4. Application layer: CQRS β†’ Mediator
  5. Integration: Event-Driven Architecture
  6. Data access: Repository β†’ Unit of Work

Already familiar? Jump to any concept for Neuroglia-specific implementation details.

πŸ’‘ How to Use These GuidesΒΆ

Each concept guide includes:

  • ❌ The Problem: What happens without this pattern
  • βœ… The Solution: How the pattern solves it
  • πŸ”§ In Neuroglia: How to implement it in the framework
  • πŸ§ͺ Testing: How to test code using this pattern
  • ⚠️ Common Mistakes: Pitfalls to avoid
  • 🚫 When NOT to Use: Scenarios where simpler approaches work better

πŸ• See It In ActionΒΆ

All concepts are demonstrated in the Mario's Pizzeria tutorial:

  • Part 1 shows Clean Architecture and Dependency Injection
  • Part 2 covers Domain-Driven Design and Aggregates
  • Part 3 demonstrates CQRS and Mediator
  • Part 5 explores Event-Driven Architecture
  • Part 6 implements Repository and Unit of Work

πŸŽ“ Additional ResourcesΒΆ


Ready to dive in? Start with Clean Architecture to understand the foundation of Neuroglia's approach!