MiCake.Templates
10.0.0-preview.5
Prefix Reserved
See the version list below for details.
dotnet new install MiCake.Templates::10.0.0-preview.5
MiCake.Templates
A collection of production-ready project templates based on the MiCake framework, designed to help developers quickly scaffold high-quality ASP.NET Core applications following Domain-Driven Design (DDD) principles.
π Features
- Production-Ready: Built with best practices and real-world scenarios in mind
- DDD Architecture: Clear separation of Domain, Application, and Infrastructure layers
- Modern Stack: ASP.NET Core 9.0, EF Core, MySQL, JWT Authentication
- Developer Experience: Integrated logging (Serilog + Seq), API documentation (Scalar), hot reload support
- Extensible: Modular design makes it easy to add new features and customize for your needs
π¦ Available Templates
StandardWeb
An opinionated ASP.NET Core starter template featuring:
- Layered Architecture: Domain, Application, Common, Web layers with clear dependencies
- Authentication: JWT-based auth with refresh token support
- Database: MySQL with EF Core migrations
- API Documentation: OpenAPI (Swagger) + Scalar UI
- Logging: Serilog with Seq integration
- Validation: FluentValidation for request validation
- Mapping: AutoMapper for DTO conversions
- Error Handling: Standardized error codes and responses
π Detailed Documentation: See StandardWeb README (English) or StandardWeb README (Chinese)
π Quick Start
Installation
Install the template package:
dotnet new install .Create a new project:
dotnet new micake-standardweb -n YourProject.NameNavigate to the project:
cd YourProject.Name/src/StandardWebRestore dependencies:
dotnet restore StandardWeb.slnConfigure database connection:
- Update
StandardWeb.Web/appsettings.jsonwith your MySQL connection string - Set the
AESEncryption:Key(minimum 16 characters)
- Update
Apply database migrations:
dotnet ef database update --project StandardWeb.WebRun the application:
dotnet watch --project StandardWeb.WebAccess API documentation:
- Open your browser to
https://localhost:5001/scalar/v1(or the configured port)
- Open your browser to
ποΈ Architecture Overview
The StandardWeb template follows a clean layered architecture:
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Web Layer (StandardWeb.Web) β
β - Controllers, DTOs, Startup configuration β
βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β depends on
βββββββββββββββββββΌββββββββββββββββββββββββββββββββ
β Application Layer (StandardWeb.Application) β
β - Services, Providers, Cache, Use Cases β
βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β depends on
βββββββββββββββββββΌββββββββββββββββββββββββββββββββ
β Domain Layer (StandardWeb.Domain) β
β - Entities, Aggregates, Repositories, DbContextβ
βββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββ΄βββββββββ
β β
ββββββββββΌβββββββ ββββββββΌβββββββββββββ
β Common β β CommonWebLib β
β (Helpers, β β (Base Controllers,β
β Auth Config) β β HTTP Clients) β
βββββββββββββββββ βββββββββββββββββββββ
Layer Responsibilities
- Web: HTTP request handling, API endpoints, request/response DTOs
- Application: Business logic, orchestration, use cases, caching
- Domain: Core business entities, domain logic, repository interfaces
- Common: Shared utilities, helpers, and cross-cutting concerns
- CommonWebLib: Reusable web infrastructure components
π Configuration
Key configuration sections in appsettings.json:
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=standardweb;User=root;Password=yourpassword;"
},
"Jwt": {
"Issuer": "YourIssuer",
"Audience": "YourAudience",
"SecretKey": "your-secret-key-min-32-chars",
"AccessTokenExpirationMinutes": 30,
"RefreshTokenExpirationDays": 7
},
"AESEncryption": {
"Key": "your-16-char-key!"
},
"AllowedOrigins": "https://yourdomain.com,https://*.yourdomain.com",
"Serilog": {
"Using": ["Serilog.Sinks.Seq"],
"WriteTo": [
{ "Name": "Seq", "Args": { "serverUrl": "http://localhost:5341" } }
]
}
}
π§ Adding a New Feature Module
Follow these steps to add a new business module:
- Define Domain Models in
StandardWeb.Domain/Models/[YourModule] - Create Repository Interface in
StandardWeb.Domain/Repositories/Interfaces - Implement Repository in
StandardWeb.Domain/Repositories - Create Application Service in
StandardWeb.Application/Services/[YourModule] - Define DTOs in
StandardWeb.Web/Dtos/[YourModule] - Create Controller in
StandardWeb.Web/Controllers/[YourModule]Controller.cs - Add AutoMapper Profile in
StandardWeb.Web/Mapper/[YourModule]Profile.cs - Add Validators in
StandardWeb.Web/Validators/[YourModule](if needed)
Example controller structure:
[Route("api/[controller]")]
public class ProductController : BaseApiController
{
private readonly IProductService _service;
public ProductController(InfrastructureTools tools, IProductService service)
: base(tools)
{
ModuleCode = "03"; // Unique module code
_service = service;
}
[HttpGet("{id}")]
public async Task<IActionResult> GetById(long id)
{
var result = await _service.GetByIdAsync(id, HttpCancellationToken);
return result.IsSuccess
? Ok(result.Data)
: BadRequest(ErrorCodeDefinition.NotFound, result.ErrorMessage);
}
}
π§ͺ Testing
The template is designed to be easily testable:
- Unit Tests: Test domain logic and services in isolation
- Integration Tests: Test API endpoints with in-memory database
- E2E Tests: Test complete workflows through HTTP clients
Example test structure:
YourProject.Tests/
βββ Unit/
β βββ Domain/
β βββ Application/
β βββ Helpers/
βββ Integration/
β βββ Controllers/
βββ TestUtilities/
π Additional Resources
- MiCake Framework: GitHub Repository
- ASP.NET Core: Official Documentation
- Domain-Driven Design: DDD Reference
- Clean Architecture: Clean Architecture Guide
π€ Contributing
Contributions are welcome! Please feel free to submit issues or pull requests to improve these templates.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π¬ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- MiCake Framework: MiCake Repository
π― Roadmap
- Add more template variants (Microservices, Blazor, etc.)
- Include Docker and Docker Compose configurations
- Add example test projects
- Create migration guides from existing projects
- Add CI/CD pipeline templates (GitHub Actions, Azure DevOps)
Happy Coding! π
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.0 | 112 | 5/11/2026 |
| 10.0.0-preview.9 | 197 | 1/21/2026 |
| 10.0.0-preview.8 | 182 | 1/18/2026 |
| 10.0.0-preview.7 | 183 | 1/16/2026 |
| 10.0.0-preview.5 | 179 | 1/16/2026 |