🌐 简体中文 | 繁體中文 | Español | Deutsch | 日本語 | Français | Português | Русский | 한국어 | العربية
NewLife.Cube is a rapid web development platform for "data-driven + fast iteration + deep customization" scenarios. In minutes, an entity class or database table becomes a complete admin UI with permissions, lists, details, CRUD, export and statistics, while standard APIs are exposed for Vue / Blazor / Antd / mobile or third-party systems. The default template has been proven in real projects with a single table of 10 billion rows.
Demo: https://cube.newlifex.com CentOS7 + CDN · SSO center: https://sso.newlifex.com OAuth server · Swagger: https://cube3.newlifex.com
Cube tutorial: https://newlifex.com/cube · XCode tutorial: https://newlifex.com/xcode · Core library tutorial: https://newlifex.com/core
Contents: Quick Start · Main Features · Ecosystem Map · Documentation · Contributing · Team · License
Install NewLife.Cube.Core from NuGet. MIT licensed; you may replace the "NewLife" string for private builds. Works with Visual Studio and the CLI. newlife.snk is public for strong-name consistency.
dotnet add package NewLife.Cubedotnet new install NewLife.Templates
dotnet new cube --name CubeWeb
dotnet new xcode --name Zero.Data
cd CubeWeb
dotnet build
start http://localhost:6080
dotnet run
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddCube(); // registers permissions, menus, entity controller scanning
var app = builder.Build();
app.UseMetronic(app.Environment); // or UseAdminLTE / UseTabler ...
app.UseCube(app.Environment); // routing, static assets and middleware
app.Run();Open / to sign in, use Swagger for APIs, and call the standard CRUD APIs from any front-end.
| Item | Coverage |
|---|---|
| Target frameworks | 5 in one package: net6.0, net7.0, net8.0, net9.0, net10.0 |
| OS and architecture | Windows, Linux, macOS; x64, x86, arm64, arm, loongarch64, riscv64, s390x |
| Databases | MySql / SQLite / SqlServer / Oracle / PostgreSql / SqlCe / Access / DM |
| NativeAOT | 18 smoke scenarios for the non-MVC foundation (JIT/AOT); see the badge above for the current count |
- Create an
ASP.NET Core Webproject in Visual Studio. - Reference
NewLife.Cube.Corefrom NuGet, or build the latest Cube NewLife.CubeNC source. - Set a connection string named
Membershipinappsettings.json; users, roles, permissions and menus are stored there. - The database type is detected automatically; the default is
Data Source=../Data/Membership.db. - Build the project, right-click -> View -> View in Browser to run Cube.
- MySQL/SQLite/Oracle/SqlCe drivers are downloaded automatically (x86/x64); change
PluginServerinConfig/Core.configif needed. - Scripts and styles are downloaded automatically; change
PluginServerinConfig/Cube.configif needed. - The default login is
admin/admin; third-party OAuth such as NewLife also works. The first user becomes administrator andadminis disabled. - When publishing, copy
*.dll,appsettings.json,*.deps.json,*.runtimeconfig.jsonand your own assets.
- Create an
ASP.NET MVCproject in Visual Studio. - Reference
NewLife.Cubefrom NuGet, or build the latest Cube NewLife.Cube source. - Set a connection string named
Membershipin the<connectionStrings>section ofWeb.config. - The database type is detected automatically; the default is
<add name="Membership" connectionString="Data Source=../Data/Membership.db" providerName="Sqlite"/>. - Build the project, right-click -> View -> View in Browser to run Cube.
- MySQL/SQLite/Oracle/SqlCe drivers are downloaded automatically (x86/x64); change
PluginServerinConfig/Core.configif needed. - Scripts and styles are downloaded automatically; change
PluginServerinConfig/Cube.configif needed. - The default login is
admin/admin; third-party OAuth such as NewLife also works. The first user becomes administrator andadminis disabled. - Installing the Razor Generator Visual Studio extension and setting it as the custom tool for
.cshtmlfiles compiles views into the DLL. - Publish and copy the DLLs, configuration and assets.
Data-to-UI productivity (9)
| Feature | Key Characteristics |
|---|---|
| EntityController scaffolding | Entity class + controller gives CRUD, statistics, export and permissions immediately; ReadOnlyEntityController covers read-only lists. |
| Static-constructor configuration | Configure fields, action buttons, related links, statistics and export in a controller static constructor. |
| Field metadata API | GetFields?kind=1..4 (List / Detail / AddForm / EditForm) drives dynamic front-end generation — no hard coding. |
| Menu tree | /Cube/MenuTree builds multi-level menus from permissions; /Admin/Index/GetMenuTree serves the classic MVC UI. |
| Standard API response | ApiResponse wraps code / data / page / stat for every endpoint. |
| Zero deployment | Schema creation and seed data happen automatically on first run, with no manual intervention. |
| Powerful view engine | A child project can override any parent view at the same path (.cshtml). |
| Built-in editors | Rich text (Quill) and Markdown (EasyMDE) with image upload and security controls. |
| Scalar API docs | Scalar UI grouped by area alongside Swagger, for easier online debugging. |
Field and UI customization (3)
| Feature | Key Characteristics |
|---|---|
| Field set customization | ListFields.RemoveField / AddListField adjust columns, links and targets per controller. |
| Change log | LogOnChange = true writes an audit entry for every modification. |
| Dynamic front-end fields | The front-end fetches /Cube/App/GetFields?kind=1 for list field definitions — no hard coding. |
public class AppController : EntityController<App, AppModel>
{
static AppController()
{
LogOnChange = true; // change log
ListFields.RemoveField("Secret"); // hide a sensitive column
var log = ListFields.AddListField("Log", "UpdateUserId");
log.DisplayName = "Change log";
log.Url = "/Admin/Log?category=App&linkId={ID}";
log.Target = "_blank";
}
}API and front-end separation (6)
| Endpoint | Purpose |
|---|---|
/Auth/Login |
Sign in and receive a JWT token (header / cookie / query). |
/Cube/MenuTree |
Permission-aware menu tree. |
/{Area}/{Controller}/GetFields?kind=1..4 |
Field metadata for list / detail / add form / edit form. |
| Main route + dynamic parameters | Query with paging, sorting and condition composition. |
Detail / Insert / Update / Delete |
Standard CRUD actions. |
stat / page |
Statistics row and paging information. |
Permissions and security (7)
| Feature | Key Characteristics |
|---|---|
| Generic permission management | Users, roles, menus and actions with controller-action granularity. |
| EntityAuthorize | Login + role + menu action checks on every action. |
| First user becomes administrator | The built-in admin account is disabled afterwards; admin/admin works for the first sign-in. |
| Unified identity | External OAuth / SSO / JWT across desktops, web and mobile clients. |
| Security defense | Built-in threat detection (scanners / injection / honeypots), persistent auto-ban with escalating durations and a security audit trail. Automatic mode bans repeated attackers, temporarily blocks broad attacks and recovers automatically; trusted proxies can be configured or learned to prevent spoofing; observation / blocking modes are switchable. |
| Production advice | Disable unused third-party logins, enable HTTPS and enforce a strong password policy. |
| Multi-tenancy switch | Enable or disable multi-tenancy with one switch; tenant menus and fields are hidden when off, and runtime tenant switching is supported. |
AI capabilities (4)
| Feature | Key Characteristics |
|---|---|
| AI assistant | A single chat panel in the lower-right corner with page / entity / query context. The global AiController.AiChat endpoint (/Ai/AiChat) plus NAI AiChatService orchestrate session history, the tool loop and SSE streaming events. |
| Extension point | Entity controllers expose data queries, tool sets and prompt overrides through IEntityAiContext (SearchData / CreateCubeTools / BuildChatSystemPrompt). Tools include get_data_context, get_form_schema, fill_form, get_page_context, get_system_info and run_js. |
| AI insight | Merged into the assistant; AiInsightHelper remains for data collection (14 sensitive-field blacklists). One-click analysis offers statistics, anomaly detection, trend prediction and actionable advice with deep reasoning, on both MVC and Vue. |
| Dashboard widgets | Dashboards are composed of configurable widgets (KPI, charts, monitoring) with personalized layouts and /Cube/Widget management. |
Front-ends, themes and skins (7)
| Feature | Key Characteristics |
|---|---|
| Multiple front-ends | Vue / Blazor / AntDesign / classic Razor coexist and migrate gradually. |
| Embedded theme assets | CubeEmbeddedFileProvider ships theme assets inside the package. |
| Theme registration | Register skins via AddTheme/AddSkin and pick one in UseCube (app.UseMetronic(env) etc.). |
| Custom themes | Implement IModule like MetronicModule and mount it in the use phase. |
| View overrides | A .cshtml with the same path in a child project overrides the parent. |
| Localization | 11 runtime languages for API messages, request-level culture detection and an 11-language Vue front-end. |
| New-generation skins | pnpm workspace with shared packages @newlifex/api-core (API / token / types) and @newlifex/field-mapping (field metadata -> controls); reference the NuGet package to get the complete front-end. |
| NuGet package | Framework | UI library | Dev port |
|---|---|---|---|
NewLife.Cube.NaiveUI |
Vue 3 | Naive UI | 5180 |
NewLife.Cube.MUI |
React 19 | MUI 6 (Material) | 5181 |
NewLife.Cube.Shadcn |
React 19 | Radix UI + Tailwind CSS 4 | 5182 |
NewLife.Cube.ArcoVue |
Vue 3 | Arco Design Vue | 5183 |
NewLife.Cube.Angular |
Angular 19 | NG-ZORRO | 5184 |
NewLife.Cube.Vuetify |
Vue 3 | Vuetify 3 | 5185 |
NewLife.Cube.Svelte |
SvelteKit 2 + Svelte 5 | Tailwind CSS 4 | 5186 |
NewLife.Cube.TDesign |
Vue 3 | TDesign | 5187 |
// Pick one
app.UseNaiveUI(app.Environment);
app.UseMUI(app.Environment);
app.UseShadcn(app.Environment);
app.UseArcoVue(app.Environment);
app.UseAngular(app.Environment);
app.UseVuetify(app.Environment);
app.UseSvelte(app.Environment);
app.UseTDesign(app.Environment);Front-end workspace conventions:
- Root
pnpm build: builds only the shared modules underpackages/; it no longer recurses into every skin. - Build one skin:
pnpm build:vue,pnpm build:react,pnpm build:naive,pnpm build:mui,pnpm build:shadcn,pnpm build:arco,pnpm build:angular,pnpm build:vuetify,pnpm build:svelte,pnpm build:tdesign. - Develop one skin: the matching
pnpm dev:xxx. - Build or start everything:
pnpm build:all/pnpm dev:all. - Inside a skin's
web/directory, use its ownpnpm build/pnpm dev.
Data and big data (5)
| Feature | Key Characteristics |
|---|---|
| XCode data layer | Schema synchronization, field evolution, automatic sharding, read/write splitting and second-level cache. |
| Multiple databases | MySql / SQLite / SqlServer / Oracle / PostgreSql / SqlCe / Access / DM. |
| Database separation | Three-database example: Membership (permissions) / Cube (business) / Log (logs). |
| PluginServer | Downloads database drivers and front-end assets automatically on first run; configurable. |
| Proven scale | Real projects with a single table of 10 billion rows. |
Performance and NativeAOT (4)
| Feature | Key Characteristics |
|---|---|
| Unified timing | Filters record elapsed time uniformly and integrate with Stardust APM. |
| Cheap logging | Log level checks avoid unnecessary string concatenation. |
| Modern frameworks | Multiple TFMs allow Span / ValueTask optimizations on newer frameworks. |
| NativeAOT | 18 smoke scenarios for the non-MVC foundation, run as JIT/AOT pairs in CI. |
Deployment and operations (5)
| Scenario | How |
|---|---|
| Single machine | dotnet publish, then copy the DLLs and configuration. |
| Service | Use NewLife.Agent for Windows Service or systemd. |
| Cluster | Publish, zip, start under the StarAgent daemon or deploy via Stardust. |
| Container | A simple Dockerfile (copy the publish folder, set environment variables). |
| Scale-out | Stateless instances sharing the database and cache. |
- Clone the source, build CubeSSO, go to
Bin/SSO, adjustappsettings.json, package the exe/dll/appsettings/runtimeconfig files and deploy.
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"Urls": "http://*:8080;https://*:8081",
//"StarServer": "http://star.newlifex.com:6600",
"ConnectionStrings": {
"Membership": "Data Source=../Data/Membership.db;provider=sqlite",
"Cube": "Data Source=../Data/Cube.db;provider=sqlite",
"Log": "Data Source=../Data/Log.db;provider=sqlite"
}
}- Start and open the SSO site. The first login can use
admin/adminor a third-party login; the first user becomes administrator andadminis disabled. - For a production user center, disable third-party login: Cube settings -> OAuth -> disable all.
- Rename the system in Cube settings -> System -> Display name.
Cube generation 3 (5)
| Item | Description |
|---|---|
| Focus | Front-end/back-end separation + multi-front-end ecosystem + minimal intrusion. |
| Backend | WebApi APIs live in master (NewLife.Cube); MVC stays in NewLife.CubeNC. |
| Front-ends | Independent repositories (Vue / QuickVue / Antd / Blazor). |
| Blueprint | Modern UI while keeping the override mechanism; multi-framework front-ends (Vue/React/Angular/Svelte + 8 ready-to-use skins); NuGet package brings the default skin; mobile, mini-programs and hybrid apps; enhanced data dashboards. |
| Tasks | https://github.com/orgs/NewLifeX/projects/1 |
Front-end repositories:
https://github.com/NewLifeX/NewLife.CubeVue · https://github.com/NewLifeX/NewLife.QuickVue · https://github.com/NewLifeX/NewLife.CubeAntd · https://github.com/NewLifeX/NewLife.CubeBlazor
Live sites: Vue https://vue.newlifex.com, https://quickvue.newlifex.com · Antd https://antd.newlifex.com · Swagger https://cube3.newlifex.com/swagger/index.html
Participation notes:
- Join the NewLifeX team and submit to the dev branch.
- WebApi backend:
NewLife.Cube; MVC stays inNewLife.CubeNC. - New front-ends live in independent repositories (e.g.
NewLife.CubeAntd). - Mark owners in docs and code.
- Tasks: https://github.com/orgs/NewLifeX/projects/1.
Milestones (excerpt):
- New WebApi project
NewLife.Cube - Move NetCore-specific code to
NewLife.CubeNC - New
EntityController/EntityReadOnlyController - API docs and Vue login page
- Vue user/role list and forms
Architecture and projects (9)
+-------------------------------------------------------------+
| Front-end (Vue / Blazor / Antd / classic Razor) |
+----------------------+------------------+-------------------+
| Skin views (Razor) | API Controllers | Swagger by area |
+----------------------+------------------+-------------------+
| EntityController / ReadOnlyEntityController core |
+------------------+---------------------+--------------------+
| Permissions (EntityAuthorize) | Filters (ApiFilter) | ApiResponse |
+-------------------------------------------------------------+
| Entities & business logic (XCode ORM + extensions)|
+-------------------------------------------------------------+
| Data access: MySql/SqlServer/SQLite/Oracle/PostgreSQL/DM ... |
+-------------------------------------------------------------+
| NewLife.Core (logging/config/cache/serialization/tracing) |
+-------------------------------------------------------------+
| Project | Role |
|---|---|
| NewLife.Cube | Core: entity controllers, permissions, menus, field metadata, API. |
| NewLife.CubeNC | Legacy MVC / Razor compatibility layer. |
| Classic skins | AdminLTE / Metronic / Metronic8 / Tabler / LayuiAdmin / ElementUI / Blazor (separate packages). |
| New-generation skins | pnpm workspace: NaiveUI / MUI / Shadcn / ArcoVue / Angular / Vuetify / Svelte / TDesign. |
| NewLife.Cube.Swagger | Swagger documents grouped by area. |
| CubeDemo / CubeDemoNC | Samples. |
| CubeSSO | Unified user center and OAuth server. |
| NewLife.Cube.Blazor | Blazor front-end experiment. |
| Test / XUnitTest / E2EMvcTest / AotSmoke / WebSmoke | Tests and verification (WebSmoke starts Kestrel and does one HTTP round-trip on non-x64/arm64 instruction sets). |
Core concepts (7)
| Concept | Description |
|---|---|
| EntityController | Configure fields, action buttons, related links, statistics and export in a static constructor. |
| Field metadata API | GetFields?kind=List|Detail|AddForm|EditForm drives dynamic front-end generation. |
| Menu tree | /Admin/Index/GetMenuTree builds multi-level menus from permissions. |
| Permission model | User -> role -> menu (action set). The first registered user becomes administrator and admin is disabled. |
| ApiResponse | Standard response wrapper with code / data / page / stat. |
| IModule | Startup module that injects services and static assets (themes, Swagger, etc.). |
| AI assistant | Global AiController.AiChat endpoint (/Ai/AiChat) plus NAI AiChatService orchestration (session history, tool loop, SSE events); entity controllers expose capabilities through IEntityAiContext. AiInsightHelper remains for data collection (14 sensitive-field blacklists). |
Common scenarios (5)
| Scenario | Typical use |
|---|---|
| Enterprise / department admin | Internal management backends and SaaS control panels. |
| IoT operations | Device / point / log / alert management and data export. |
| Data platform | Rapid publication of standard query APIs. |
| Identity center | Unified identity and authorization (SSO / OAuth). |
| Operations support | Orders, configuration, scheduling and release management. |
NewLife is a layered ecosystem of independently versioned open-source projects. The map below is shared verbatim by every NewLife repository; each project links to its repository and its primary NuGet package.
| Project | What it does | Downloads |
|---|---|---|
| Foundation | ||
| NewLife.Core | Logging, configuration, caching, networking, serialization, scheduling and APM tracing. | |
| NewLife.XCode | Data middleware: single tables at the tens-of-billions scale, automatic sharding, read-write splitting, 10+ databases. | |
| NewLife.Net | High-performance network library: 1.77M pps / 14.5 Gbps on a single machine (TCP 1KB, 2026-10), 4M long-lived TCP connections. | |
| NewLife.Remoting | Protocol communication and RPC framework for client/server applications and IoT devices. | |
| NewLife.Agent | Installs .NET applications as OS daemons: Windows services and Linux systemd. | |
| NewLife.Templates | dotnet new project templates for console, web, API, service, data and IoT projects. |
|
| Data & Messaging | ||
| NewLife.Redis | Redis client with microsecond latency, millions of ops/s and built-in message queues. | |
| NewLife.RocketMQ | Pure managed RocketMQ client for Apache RocketMQ and Alibaba Cloud Message Queue. | |
| NewLife.MQTT | MQTT client and server, including Alibaba Cloud IoT connectivity. | |
| NewLife.NovaDb | Hybrid database in C#: embedded or networked, relational, time-series, message queue and KV in one. | |
| NewLife.MySql | MySql driver and helper layer built on the NewLife data stack. | |
| Web, AI & Distributed | ||
| NewLife.Cube | Rapid admin-platform framework: permissions, SSO, OAuth server and CRUD scaffolding. | |
| Stardust | Distributed service platform: node management, APM, configuration center, registry and release center. | |
| AntJob | Distributed task and real-time data scheduling platform with sharding, retries and backfill. | |
| NewLife.AI | Unified client for 46 LLM providers plus ChatAI, a ready-to-run web chat application. | |
| Industrial & IoT | ||
| NewLife.IoT | IoT standard library defining protocol contracts and device abstractions. | |
| NewLife.Modbus | Modbus TCP/RTU/ASCII implementation on top of NewLife.IoT. | |
| NewLife.Siemens | Siemens PLC protocol on top of NewLife.IoT. | |
| NewLife.Omron | Omron PLC protocol on top of NewLife.IoT. | |
| NewLife.Melsec | Mitsubishi Melsec PLC protocol on top of NewLife.IoT. | |
| NewLife.OPC | OPC client for industrial data access. | — |
| NewLife.BACnet | BACnet building-automation protocol stack. | |
| ZeroIoT | Lightweight open-source IoT platform with gateway and device management. | — |
| Vehicle Telematics | ||
| NewLife.JT808 | JT/T 808 vehicle positioning protocol: 70+ message bodies, 2011/2013/2019. | |
| NewLife.JT809 | JT/T 809 platform-to-platform protocol for transport authorities. | |
| NewLife.JT1078 | JT/T 1078 in-vehicle video: RTP parsing, FLV/fMP4 remuxing and live streaming. | |
| Domain Components | ||
| NewLife.Office | One package for Excel, Word, PPT, PDF and 15+ document formats. | |
| NewLife.Audio | Cross-platform audio: codecs, device I/O, DSP, containers and streaming. | |
| NewLife.Video | Video codecs, container formats, frame processing and streaming. | |
| NewLife.Map | Unified interface over Baidu, AMap, Tencent and Tianditu with geocoding and coordinate conversion. | |
| NewLife.IP | IPv4 geolocation with an offline memory-mapped database and an online API fallback. | |
| Tools & Products | ||
| CrazyCoder | Developer toolbox: network, serial port, crypto, regex, Modbus and MQTT. | |
| GitCandy | Self-hosted Git source code management system. | — |
| LuckyClover | Installs the matching .NET runtime automatically when launched from an older host. | — |
Badges show the primary package of each project; theme, extension and satellite packages are listed on their NuGet pages.The 30+ packages not listed here (FTP, LoRa, Office extensions, protocol drivers and more) are available under the NewLifeX organization and on newlifex.com. This table is maintained in the NewLife.Core README.
Detailed requirements, feature tracking and architecture live in Doc/ (written in Chinese):
- 📋 Requirements — vision, goals, functional requirements
- ✅ Feature list — implementation/test/comment tracking
- 🏗️ Architecture — layering, modules, key decisions
- 🤖 AI — AI capabilities, configuration and extension points
- 🔔 Alerts and inbox — online threshold alerts and broadcast messages
- ✉️ Email/phone verification — activation contract and UI integration
- 🛡️ Security — threat detection, auto-ban and security audit
- 📚 User manual — full user and developer guide
- Cube tutorial: https://newlifex.com/cube
- XCode tutorial: https://newlifex.com/xcode
- Core library tutorial: https://newlifex.com/core
- Online demo: https://cube.newlifex.com · SSO center: https://sso.newlifex.com · Swagger: https://cube3.newlifex.com
Q: Hide a field?
A: In the controller static constructor: ListFields.RemoveField("Field").
Q: Custom statistics?
A: Override search logic and fill stat on the returned collection.
Q: Switch themes?
A: Reference a theme package and call app.UseXXX(env); the default is configurable in the admin UI.
Q: Where do database drivers come from?
A: Downloaded from PluginServer on first run; configurable.
Q: Integrate a custom front-end?
A: Use the field metadata API plus the standard CRUD/JWT endpoints.
Cube builds with the .NET SDK 10 (or the matching SDK for your target framework) and also opens in Visual Studio. The front-end skins use pnpm.
dotnet build NewLife.Cube/NewLife.Cube.csproj -c Release
dotnet test XUnitTest -c Release- End-to-end MVC tests:
E2EMvcTest/ - NativeAOT smoke:
AotSmoke/, CI in.github/workflows/aot.yml - Web smoke:
WebSmoke/starts Kestrel and performs one HTTP round-trip
Push a v-prefixed tag to trigger .github/workflows/publish.yml; the workflow packs NewLife.Cube / NewLife.Cube.Core and publishes them to NuGet.org. Package README is generated from README.md by sync-readme-package.ps1, language switchers by sync-readme-languages.ps1 and metric badges by sync-readme-metrics.ps1; each script supports -Check for CI.
- Conventions: see
.github/copilot-instructions.md. - Issues/PRs: describe the scenario, expectation and reproduction; include data scale for performance topics.
- New themes: separate repository + README describing the build.
- Prefer the NewLife ecosystem and avoid unnecessary dependencies.
- Make sure all TFMs compile before submitting.
Founded in 2002, the NewLife team has spent more than two decades on the .NET and IoT ecosystem, maintains nearly 100 open-source projects (34 of them core to this map), and delivers integrated software and hardware solutions for power, logistics, healthcare, industrial control and internet industries. We live by the motto "learning has no seniority — mastery earns respect".
Open-source components have been downloaded 6.48M times from NuGet (ecosystem-wide, as of 2026-10).
Website: https://newlifex.com · Open source organization: https://github.com/NewLifeX
This project is licensed under MIT; the strong-name certificate newlife.snk is published so you can build and replace assemblies yourself, and the source may be modified and redistributed without attribution.
If this project is helpful to you, welcome to Star it, share it with your team, or provide improvement suggestions via Issue/PR.
