logologo
Get Started
Guide
Development
Plugins
API
English
简体中文
Get Started
Guide
Development
Plugins
API
English
简体中文
logologo
API Overview

@nocobase/auth

AuthManager
Auth
BaseAuth

@nocobase/cli

NocoBase CLI
Global Environment Variables

@nocobase/client

Application
Plugin

@nocobase/database

Collection
Field

interfaces

BaseInterface
Filter Operators

RelationRepository

BelongsToManyRepository
belongs-to-repository
HasManyRepository
HasOneRepository
Repository

shared

create-options
destroy-options
find-one
find-options
transaction
update-options

@nocobase/flow-engine

DataSourceManager
FlowContext
FlowEngine
FlowModel
FlowResource

@nocobase/server

AppCommand
Application
AuditManager
Context
Migration
Plugin

@nocobase/sdk

Auth
Storage
Previous PageNocoBase CLI
Next PageApplication

#Global Environment Variables

#TZ

Used to set the application's time zone, defaults to the operating system's time zone.

https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

WARNING

Time-related operations will be processed according to this time zone. Modifying TZ may affect the date values in the database. For details, see 'Date & Time Overview'

#APP_ENV

Application environment, default value is development. Options include:

  • production - Production environment
  • development - Development environment
APP_ENV=production

#APP_KEY

The application's secret key, used for generating user tokens, etc. Change it to your own application key and ensure it is not disclosed.

WARNING

If APP_KEY is changed, old tokens will become invalid.

APP_KEY=app-key-test

#APP_PORT

Application port, default value is 13000.

APP_PORT=13000

#API_BASE_PATH

NocoBase API address prefix, default value is /api/.

API_BASE_PATH=/api/

#API_BASE_URL

#CLUSTER_MODE

v1.6.0+

Multi-core (cluster) startup mode. If this variable is configured, it will be passed through to the pm2 start command as the -i <instances> parameter. The options are consistent with the pm2 -i parameter (see PM2: Cluster Mode), including:

  • max: use the maximum number of CPU cores
  • -1: use the maximum number of CPU cores minus 1
  • <number>: specify the number of cores

The default value is empty, which means it is not enabled.

Note

This mode needs to be used with cluster mode-related plugins, otherwise the application's functionality may be abnormal.

For more information, see: Cluster Mode.

#PLUGIN_PACKAGE_PREFIX

Plugin package name prefix, defaults to: @nocobase/plugin-,@nocobase/preset-.

For example, to add the hello plugin to the my-nocobase-app project, the full package name of the plugin would be @my-nocobase-app/plugin-hello.

PLUGIN_PACKAGE_PREFIX can be configured as:

PLUGIN_PACKAGE_PREFIX=@nocobase/plugin-,@nocobase-preset-,@my-nocobase-app/plugin-

Then the mapping between plugin names and package names is as follows:

  • The package name for the users plugin is @nocobase/plugin-users
  • The package name for the nocobase plugin is @nocobase/preset-nocobase
  • The package name for the hello plugin is @my-nocobase-app/plugin-hello

#DB_DIALECT

Database type, options include:

  • mariadb
  • mysql
  • postgres
DB_DIALECT=mysql

#DB_HOST

Database host (required when using MySQL or PostgreSQL database).

Default value is localhost.

DB_HOST=localhost

#DB_PORT

Database port (required when using MySQL or PostgreSQL database).

  • MySQL, MariaDB default port 3306
  • PostgreSQL default port 5432
DB_PORT=3306

#DB_DATABASE

Database name (required when using MySQL or PostgreSQL database).

DB_DATABASE=nocobase

#DB_USER

Database user (required when using MySQL or PostgreSQL database).

DB_USER=nocobase

#DB_PASSWORD

Database password (required when using MySQL or PostgreSQL database).

DB_PASSWORD=nocobase

#DB_TABLE_PREFIX

Table prefix.

DB_TABLE_PREFIX=nocobase_

#DB_UNDERSCORED

Whether to convert database table names and field names to snake case style, defaults to false. If you are using a MySQL (MariaDB) database and lower_case_table_names=1, then DB_UNDERSCORED must be true.

WARNING

When DB_UNDERSCORED=true, the actual table and field names in the database will not be consistent with what is seen in the interface. For example, orderDetails in the database will be order_details.

#DB_LOGGING

Database logging switch, default value is off. Options include:

  • on - Enabled
  • off - Disabled
DB_LOGGING=on

#LOGGER_TRANSPORT

Log output transport, multiple values are separated by ,. The default value in development environment is console, and in production environment is console,dailyRotateFile. Options:

  • console - console.log
  • file - File
  • dailyRotateFile - Daily rotating file
LOGGER_TRANSPORT=console,dailyRotateFile

#LOGGER_BASE_PATH

File-based log storage path, defaults to storage/logs.

LOGGER_BASE_PATH=storage/logs

#LOGGER_LEVEL

Output log level. The default value in development environment is debug, and in production environment is info. Options:

  • error
  • warn
  • info
  • debug
  • trace
LOGGER_LEVEL=info

The database log output level is debug, and whether it is output is controlled by DB_LOGGING, not affected by LOGGER_LEVEL.

#LOGGER_MAX_FILES

Maximum number of log files to keep.

  • When LOGGER_TRANSPORT is file, the default value is 10.
  • When LOGGER_TRANSPORT is dailyRotateFile, use [n]d to represent days. The default value is 14d.
LOGGER_MAX_FILES=14d

#LOGGER_MAX_SIZE

Rotate logs by size.

  • When LOGGER_TRANSPORT is file, the unit is byte, and the default value is 20971520 (20 * 1024 * 1024).
  • When LOGGER_TRANSPORT is dailyRotateFile, you can use [n]k, [n]m, [n]g. Not configured by default.
LOGGER_MAX_SIZE=20971520

#LOGGER_FORMAT

Log printing format. The default in development environment is console, and in production environment is json. Options:

  • console
  • json
  • logfmt
  • delimiter
LOGGER_FORMAT=json

See: Log Format

#CACHE_DEFAULT_STORE

The unique identifier for the cache store to use, specifying the server-side default cache store. Default value is memory. Built-in options:

  • memory
  • redis
CACHE_DEFAULT_STORE=memory

#CACHE_MEMORY_MAX

Maximum number of items in memory cache, default value is 2000.

CACHE_MEMORY_MAX=2000

#CACHE_REDIS_URL

Redis connection, optional. Example: redis://localhost:6379

CACHE_REDIS_URL=redis://localhost:6379

#TELEMETRY_ENABLED

Enable telemetry data collection, defaults to off.

TELEMETRY_ENABLED=on

#TELEMETRY_METRIC_READER

Enabled monitoring metric readers, defaults to console. Other values should refer to the registered names of the corresponding reader plugins, such as prometheus. Multiple values are separated by ,.

TELEMETRY_METRIC_READER=console,prometheus

#TELEMETRY_TRACE_PROCESSOR

Enabled trace data processors, defaults to console. Other values should refer to the registered names of the corresponding processor plugins. Multiple values are separated by ,.

TELEMETRY_TRACE_PROCESSOR=console