A sandbox for exploring modern .NET (.NET Core) development patterns: layered, message-based architecture with built‑in security best practices.
This project demonstrates a clean, layered architecture using:
- Domain Layer – domain models, business rules, value objects.
- Application Layer – orchestrates use cases; handles commands & queries.
- Infrastructure Layer – external concerns: persistence, messaging, security, logging.
- API Layer – .NET Core Web API exposing endpoints for operations.
The system embraces a message-based design—workflows are composed of commands, events, and handlers—promoting decoupling, scalability, and testability.
Security best practices included:
- Authentication via ASP.NET Core Identity or JWT
- Role-based and policy-based authorization
- Secure handling of sensitive data (e.g. using options, protected storage)
- Logging and error handling via middleware
- .NET SDK 7.0+
- Optional: Docker (for containerized infrastructure)
git clone https://github.com/Taximu/net_core_playground.git
cd net_core_playground
dotnet build
cd src/Api
dotnet run
➡️ The API will be hosted at https://localhost:5001
by default.
src/
├── Api/ → ASP.NET Core API project
├── Application/ → Use-cases, command/query handlers
├── Domain/ → Entities, value objects, domain logic
└── Infrastructure/ → Implementations for DB, messaging, security, etc.
- MessageBus: In-memory/event-driven bus for commands & events
- EF Core: For data persistence (Sqlite/PostgreSQL support)
- JWT/Auth: Authentication and role/permission-based access
- Middleware: Global exception handling, logging, model validation
- Register a new user via
POST /api/auth/register
- Log in to receive a JWT:
POST /api/auth/login
- Include
Authorization: Bearer <token>
in protected API calls - Submit a command, e.g.
POST /api/command/do-something
- Observe domain-handled workflow, event publication, persistence
- Add new Commands or Events in the Application layer
- Implement new Event Handlers for side effects
- Plug in alternative MessageBus implementations (e.g. RabbitMQ/Kafka adapters)
- Switch databases (e.g., from Sqlite to PostgreSQL) in Infrastructure
- Enhance Security:
- Add custom policies, claims transformation
- Integrate OAuth2 / external identity providers
Extensive unit and integration tests for all layers:
cd tests
dotnet test
- Fork the repo
- Create a branch:
feature/your-feature
- Commit your changes
- Push to GitHub & open a Pull Request
- Ensure all tests pass and new code is well documented
MIT License — see LICENSE for full details.
Feel free to open an issue or pull request. Happy coding! 🚀