XiHan framework repository. Fast, lightweight, efficient, and dedicated development framework. Built on .NET 9.
XiHan.Framework is a modern, modular enterprise-level development framework based on .NET 9, specifically designed for front-end and back-end separated ASP.NET Core applications. The framework prioritizes .NET 9 native features, reduces third-party dependencies, and ensures modularity, extensibility, and ease of use.
- π¦ Modular Architecture - Highly extensible modular design with on-demand selection
- β‘ Quick Start - Download and run instantly, quickly experience complete Web API projects
- π― .NET 9 First - Fully leverage .NET 9 native features (DI, logging, serialization, AOT)
- ποΈ DDD Support - Complete Domain-Driven Design architecture support
- π Enterprise Security - Comprehensive authentication, authorization, and security mechanisms
- π Frontend-Backend Separation - Designed for modern web applications
- π Monitoring & Logging - Complete monitoring, logging, and performance analysis
The framework adopts a modular package design that users can select on demand:
# Minimal configuration - Start Web API in 5 minutes
dotnet add package XiHan.Framework
dotnet add package XiHan.Framework.Web.Api
dotnet add package XiHan.Framework.Web.Docs
dotnet add package XiHan.Framework.Logging# Production-ready Web API solution
dotnet add package XiHan.Framework.Authentication # Authentication
dotnet add package XiHan.Framework.Data # Data access
dotnet add package XiHan.Framework.Validation # Data validation
dotnet add package XiHan.Framework.Caching # Cache management# Advanced feature extensions
dotnet add package XiHan.Framework.Web.RealTime # Real-time communication
dotnet add package XiHan.Framework.BackgroundJobs # Background jobs
dotnet add package XiHan.Framework.Messaging # Message queues
dotnet add package XiHan.Framework.SearchEngines # Full-text search
dotnet add package XiHan.Framework.MultiTenancy # Multi-tenancyβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Presentation Layer β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β Web API β β SignalR β β Swagger/Scalar β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Application Layer β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β Application β β Background Jobsβ β AI Services β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Domain Layer β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β Domain Models β β Domain Events β β Domain Servicesβ β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Infrastructure Layer β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β Data Access β β Caching & MQ β β External APIs β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- .NET 9 - Base runtime with AOT compilation support
- ASP.NET Core - Web framework
- System.Text.Json - High-performance serialization
- Entity Framework Core - ORM framework
- Swagger/Scalar - API documentation
- JWT - JSON Web Token
- OAuth 2.0 - Open authorization protocol
- OpenID Connect - Identity authentication protocol
- ASP.NET Core Identity - Identity management
- Redis - Distributed caching
- SignalR - Real-time communication
- Hangfire/Quartz.NET - Background jobs
- RabbitMQ/Kafka - Message queues
- Elasticsearch - Full-text search
- ML.NET - Machine learning
dotnet new webapi -n MyApi
cd MyApi# Metadata package (required)
dotnet add package XiHan.Framework
# Web API core packages
dotnet add package XiHan.Framework.Web.Api
dotnet add package XiHan.Framework.Web.Docs
dotnet add package XiHan.Framework.Logging// Program.cs
using XiHan.Framework.Web.Api;
var builder = WebApplication.CreateBuilder(args);
// Add framework services
builder.Services.AddXiHanWebApi();
builder.Services.AddXiHanDocs();
builder.Services.AddXiHanLogging();
var app = builder.Build();
// Configure middleware
app.UseXiHanWebApi();
app.UseXiHanDocs(); // Auto-generate Swagger documentation
app.Run();dotnet runVisit https://localhost:5001/swagger to view API documentation!
# Add authentication and data access
dotnet add package XiHan.Framework.Authentication
dotnet add package XiHan.Framework.Data
dotnet add package XiHan.Framework.Validation// Update Program.cs
builder.Services.AddXiHanAuthentication();
builder.Services.AddXiHanData(options =>
{
options.UseInMemoryDatabase("MyDb"); // Or use SQL Server
});
builder.Services.AddXiHanValidation();
app.UseXiHanAuthentication();- β Complete metadata package development
- π Complete quick start core packages
- π Complete Web API and documentation packages
- π Release v0.1.0-alpha - Basic runnable version
- Complete authentication, authorization, and data access packages
- Release v0.2.0-beta - Complete API functionality
- Complete system function packages
- Complete advanced data packages and development tools
- Release v1.0.0 - Stable production version
- Complete all extension packages
- Release v1.1.0+ - Complete feature version
- Users can run complete Web API immediately after download
- Minimal configuration, maximum experience
- Interactive API documentation out of the box
- Single responsibility, clear dependencies
- Users select modules on demand
- Support independent development and testing
- Prioritize built-in features (DI, logging, serialization)
- Only use third-party libraries when necessary
- Support AOT compilation and high-performance features
- Provide Chinese documentation and examples
- Support domestic NuGet mirrors
- Compatible with international standards (OpenAPI, gRPC)
- Current Version: 0.11.7-preview.3
- Target Framework: .NET 9.0
- License: MIT
- Development Status: Actively Developing
We welcome Issue submissions and Pull Requests to improve this framework.
- Fork the project
- Create a 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
This project is licensed under the MIT License - see the LICENSE file for details.
- Author: ZhaiFanhua
- Email: me@zhaifanhua.com
- Project URLs: GitHub | Gitee
- Documentation: Development Docs
XiHan Framework, making .NET development simpler.
