
Create App API Project
Install or Upgrade Template
cs
dotnet new install ZhonTai.Template.AppThe upgrade template command is the same as the install template command.
Note
If ZhonTai.Template template is already installed, you need to uninstall the old ZhonTai.Template template first before installing the new ZhonTai.Template.App template to avoid short name MyApp conflicts.
cs
dotnet new uninstall ZhonTai.TemplateInstall Specific Version
cs
dotnet new install ZhonTai.Template.App::10.0.5View Help
cs
dotnet new MyApp -h[Template Options]
-at, --app-type <app|mem|sys>
Select different categories based on project requirements
Type: choice
sys Includes Admin permission management APIs. Suitable for system extension or monolithic project development. Has login, data permissions, and function permission restrictions.
app Does not include Admin permission management APIs. Requires gRPC and HTTP remote communication. Suitable for business module project development. Has login, data permissions, and function permission restrictions.
mem Does not include Admin permission management APIs. Suitable for user-side or member-side development. Does not depend on Admin APIs. Requires gRPC and HTTP remote communication.
Has login and data permission restrictions. No function permission restrictions.
Default: app
-ac, --app-code <app-code>
Optional. If not set, defaults to the app-type project category option.
Used to uniquely identify different functional modules in the project for management and differentiation, such as sys | biz | mem.
Type: string
-p, --port <port>
Set the port number the API project listens on at startup, such as 18010 | 18020 | 18030.
Required: true
Type: int
-gp, --grpc-port <grpc-port>
Configure the port number for gRPC remote communication. It is recommended to set it to the HTTP port + 1, such as 18011 | 18021 | 18031.
Required: true
Type: int
-sk, --security-key <security-key>
Optional. If not set, a Guid is auto-generated.
Sets the value of jwtconfig.securityKey for JWT token security verification to ensure API call security.
Enabled when: AppType == sys
Type: string
-db, --db-type <MySql|PostgreSQL|...>
Select the appropriate database type based on project requirements. Supports mainstream domestic and international databases.
Type: choice
MySql MySql
PostgreSQL PostgreSQL
SqlServer SqlServer
Oracle Oracle
Sqlite Sqlite
Firebird Firebird
MsAccess MsAccess
Dameng Dameng database, providing stable and reliable data storage and query services.
ShenTong ShenTong database, featuring high performance and scalability for complex business needs.
KingbaseES KingbaseES database, providing comprehensive data management and security protection.
Gbase GBase database, supporting large-scale data processing and analysis.
ClickHouse ClickHouse
QuestDb QuestDb
Xugu Xugu database, providing flexible data storage and efficient query performance.
Default: Sqlite
-nau, --no-apiui
Select this option to disable the new API documentation feature, reducing unnecessary resource usage.
Type: bool
Default: false
-nts, --no-task-scheduler
Select this option to not integrate the task scheduling service. Suitable for projects that don't need scheduled tasks.
Type: bool
Default: false
-nc, --no-cap
Select this option to not use CAP distributed transactions and event bus features, reducing system complexity.
Type: bool
Default: false
-nt, --no-tests
Select this option to not generate test projects. Suitable for projects that don't need automated testing.
Type: bool
Default: false
-ns, --no-sample
Select this option to not generate default sample modules and related files. Suitable for developers familiar with the development workflow who want to quickly start development.
Type: bool
Default: false
-md, --merge-db
Select this option to merge the admindb database into appdb for unified database resource management and maintenance. Suitable for monolithic project development.
Type: bool
Default: falseView Installed Templates
cs
dotnet new listUninstall Template
cs
dotnet new uninstall ZhonTai.Template.AppCreate Platform Project
The project APIs include platform APIs and Admin permission management APIs. dbconfig needs to configure sysdb (business primary database), admindb (permission database), logdb (log database), providing data permissions, user permissions, and operation log gRPC service interfaces.
- Set project code and port number
cs
dotnet new MyApp -n MyCompanyName.Module.MySys -at sys -ac sys -p 18010 -gp 18011cs
dotnet new MyApp -n MyCompanyName.Module.MySys -at sys -p 16010 -gp 16011- Switch database to
MySql
cs
dotnet new MyApp -n MyCompanyName.Module.MySys -at sys -ac sys -p 18010 -gp 18011 -db MySqlcs
dotnet new MyApp -n MyCompanyName.Module.MySys -at sys -ac sys -p 16010 -gp 16011 -db MySql- Merge the permission database
admindbinto the business databaseappdb, and switch database toMySql
cs
dotnet new MyApp -n MyCompanyName.Module.MySys -at sys -ac sys -p 18010 -gp 18011 -md true -db MySqlcs
dotnet new MyApp -n MyCompanyName.Module.MySys -at sys -ac sys -p 16010 -gp 16011 -md true -db MySql- For multi-module development, if you are familiar with development and don't need sample modules or test projects:
cs
dotnet new MyApp -n MyCompanyName.Module.MySys -at sys -ac sys -p 18010 -gp 18011 -nt true -ns true -db MySqlcs
dotnet new MyApp -n MyCompanyName.Module.MySys -at sys -ac sys -p 16010 -gp 16011 -nt true -ns true -db MySqlNote
Platform project default port range: 18010 - 18999, Monolithic project default port range: 16010 - 16999
gRPC port default range: port + 1
Create Business Project
- Set project code and port number
cs
dotnet new MyApp -n MyCompanyName.Module.MyBiz -at app -ac biz -p 19010 -gp 19011- Switch database to
MySql
cs
dotnet new MyApp -n MyCompanyName.Module.MyBiz -at app -ac biz -p 19010 -gp 19011 -db MySql- For multi-module development, if you are familiar with development and don't need sample modules or test projects:
cs
dotnet new MyApp -n MyCompanyName.Module.MyBiz -at app -ac biz -p 19010 -gp 19011 -nt true -ns true -db MySqlNote
Business project default port range: 19010 - 19999
gRPC port default range: port + 1
Create User Project
- Set project code and port number
cs
dotnet new MyApp -n MyCompanyName.Module.MyMem -at mem -ac mem -p 20010 -gp 20011- Switch database to
MySql
cs
dotnet new MyApp -n MyCompanyName.Module.MyMem -at mem -ac mem -p 20010 -gp 20011 -db MySql- For multi-module development, if you are familiar with development and don't need sample modules or test projects:
cs
dotnet new MyApp -n MyCompanyName.Module.MyMem -at mem -ac mem -p 20010 -gp 20011 -nt true -ns true -db MySqlNote
Member project default port range: 20010 - 20999
gRPC port default range: port + 1
Note
When using the source code project, remember to change the securityKey in the ZhonTai.Admin.Host/ConfigCenter/jwtconfig.json configuration file.
{
"JwtConfig": {
// Security key, note: string length must not be less than 32 characters
"securityKey": "33ce0d4b3a7b11ef8563526747b33ad4",
}
}