A fresh ThinkHomeOS application built on the official NocoBase 3 Community beta template. It starts with an empty business database. See the NocoBase terms, the referenced Apache license, and GITHUB.md for repository checks.
Install and start Docker with a current Docker Compose plugin. From a fresh clone, run:
docker compose up --build --waitOpen ThinkHomeOS and sign in as nocobase with the initial local password admin123. The app is published on loopback. PostgreSQL 16 is accessible within the Compose network. These defaults are for local development.
To use a different app port or set PostgreSQL credentials for a new local database, copy the example and edit it before starting:
cp .env.example .env| Variable | Default | What it sets |
|---|---|---|
APP_PORT |
13000 |
The host port in the app URL. |
POSTGRES_DB |
thinkhomeos |
The initial database name. |
POSTGRES_USER |
thinkhomeos |
The initial database role. |
POSTGRES_PASSWORD |
thinkhomeos-local |
The initial database password. |
PostgreSQL applies its initialization settings when it creates a fresh volume. To change credentials on an existing database, update the database itself as well as the application settings. Compose stores the database, app files, and generated runtime configuration in named volumes. Stop both services with docker compose down and start them again with the same command above. Adding --volumes to down deletes the local data.
The server runs on @nocobase/app-server and the browser client is React with shadcn/ui and Tailwind CSS.
You own everything in this directory. Add pages, API routes, database tables, and business logic directly here — this is your application's source code, not a framework you extend from the outside.
Ask the application agent to upgrade NocoBase using the application-local template upgrade Skill. This is the supported version-selection and three-way source reconciliation entry point. Before merging, read the selected target package’s AGENTS.md, this section and the upgrade Skill from its declared @nocobase/app-skills dependency, even if the application still has an older Skill. Fetch and inspect that guidance without first installing it.
Complete the target’s requirements in that same upgrade: reconcile dependencies, copied template and Registry sources, application-owned table/card consumers and translations while preserving business customizations, grants, records and executed migrations. For list feedback, follow the target Skill’s references/list-feedback-upgrade.md. Do not finish with only a version bump, dependency update or Skill sync. Missing targets, unresolved business conflicts or failed acceptance stop completion; confirm defaultTemplateVersion only after the checks pass. See the target Skill’s references/versioned-upgrade-verification.md for package integrity records and verification after publication.
Default provides the application shell and product capabilities without example plugins or business demo pages. Application-owned business API routes start empty, and new databases receive no article sample data. A bare create-app shows Home and, for unrestricted administrators only, System settings with App foundation and Database Explorer; Database Explorer is also shown to anyone granted its page:database-explorer/access page permission. Foundation is installed and registered on both Client and Server; its read-only overview is available at /foundation under the application base path. As business capabilities are developed, the app development skill reconciles missing core administration on every iteration and registers the prepared Users and Roles and permissions contribution (client/pages/settings/routes.ts); each actually used configurable capability includes its administration as part of feature delivery. Its built-in Users integration lists direct Authorization Permission Sets as application roles, while access assigned to all authenticated users remains separate. Use app-template-examples for article management and runnable plugin demonstrations.
Existing Default installations retain their data when example plugins are unregistered. If an installation already ran the article migration, retain its original migration sources as described in the upgrade migration rules before upgrading. Do not erase migration history or delete existing data to make an upgrade start.
Business lists reuse the template's standard DataTable and companions from #components/data-table. The template declares the compatible TanStack Table v8 dependency and provides controlled server pagination/sorting; application agents should not generate an independent table engine. See the table guide.
Configure the application, then start the development server:
pnpm nocobase config init --dialect sqlite
pnpm nocobase config check
pnpm devpnpm nocobase config init writes config.yml from config.example.yml, keeping its comments and generating the first key of secrets.keys, which encrypts what the application stores as a secret and from which the sign-in and session keys are derived. It is only needed once; pnpm dev and pnpm start refuse to run until it has been. pnpm nocobase config check loads the configuration the way a start would, connects to any database other than SQLite, and reports what would stop the application from starting or quietly misbehave.
pnpm dev starts the API server and the Vite client together, picks free ports if the defaults are taken, and prints the URL to open. Use the printed URL rather than assuming a port.
Set PROXY_TARGET_URL to the backend application's public URL, including its mount path but excluding /api:
# Example only: replace /main with the backend's actual public mount path.
PROXY_TARGET_URL=http://127.0.0.1:13000/main pnpm dev/main is the fallback, not a required or fixed path. Local development reads APP_BASE_PATH from the command-line environment, then .env.local, then .env, falling back to /main when unset. The remote path comes from PROXY_TARGET_URL; it is not inferred from the local APP_BASE_PATH. Read the target application's actual public URL before constructing this value. If it is mounted at the origin root, use the origin URL without a mount path.
For example, these applications can use different paths:
APP_BASE_PATH=/local PROXY_TARGET_URL=http://127.0.0.1:13000/crm pnpm dev
# /local/api/users -> http://127.0.0.1:13000/crm/api/users
# /local/ws -> ws://127.0.0.1:13000/crm/wsThis runs Vite with your local client source and proxies API and WebSocket requests to that application. It does not start a local backend, allocate its port, wait for its health endpoint, or watch server configuration/plugins. Existing beforeDev hooks still run to prepare client artifacts. Open the printed Local URL (the Vite port); Backend identifies the target.
The target can be another local project running pnpm dev, or an HTTP(S) deployment. Use its printed application URL, not its Vite URL. Local APP_BASE_PATH and the remote mount path may differ: local /main/api/users can map to remote /crm/api/users. Trailing slashes are accepted. Credentials, query strings, and fragments are not accepted in the target URL.
Requests use the remote backend's data and permissions, including writes. Only <APP_BASE_PATH>/api and <APP_BASE_PATH>/ws are proxied; application root callbacks and absolute URLs returned by the backend keep their original routing. Cookie domain/path scopes are adapted to the local application. HTTP and WebSocket requests whose Origin matches the local request's protocol and Host are forwarded with the target Origin, so browser authentication and realtime connections pass the backend's same-origin checks. Same-origin Referer URLs within the local app base are mapped to the target app base as well; requests without Origin keep it absent. Other origins and referers remain unchanged and subject to backend validation. HTTPS-only cookie requirements remain enforced, and authentication flows using explicit callback URLs still require appropriate callback configuration.
The variable can also be set in .env or .env.local; the command-line environment takes precedence. Restart pnpm dev after changing the target. Without this variable, development still starts both the local backend and Vite. Production builds ignore it.
Use APP_SERVER_PORT to choose the local application port in either development mode. With PROXY_TARGET_URL set, it selects Vite's preferred port (5173 when unset); without a proxy target, it selects the local backend's preferred port (13000 when unset), while Vite still starts from 5173. If the preferred port is occupied, development selects the next available port and prints the actual URL. The remote backend address is always taken from PROXY_TARGET_URL.
APP_SERVER_PORT=13399 PROXY_TARGET_URL=http://127.0.0.1:13000/main pnpm dev
# Local: http://127.0.0.1:13399/main/ when 13399 is available.
# Replace /main with the remote application's actual mount path.pnpm nocobase config init wrote config.yml from config.example.yml, with a generated secrets.keys key filled in. It gets you running on SQLite; adjust it for your situation:
- Database. Default preinstalls the SQLite, PostgreSQL, MySQL, SQL Server and Oracle drivers in
devDependencies. In a fresh application,pnpm nocobase config init --dialect sqliteselects SQLite and moves its driver todependencieswith its existing range. Choose--dialect postgresfor PostgreSQL and set the connection withpnpm nocobase config set. Include the driver for each additional connection independencies. Runpnpm nocobase config check --no-connectfor an offline check. A driver error lists the affected connections, the package to promote and the command to retry. - Change a value with
pnpm nocobase config set key=value, which keeps the comments and refuses a section the application does not know. Values that differ per machine —APP_SERVER_PORT,APP_SERVER_HOST,APP_PUBLIC_ORIGIN— are better set in the environment, which is applied over this file;config setsays when an environment variable overrides what it wrote. - Where the application is served.
APP_BASE_PATHis the public mount path,/mainby default, so the development URL looks likehttp://127.0.0.1:13000/main/.APP_SERVER_PORTandAPP_SERVER_HOSTchange what the server binds to. - Anything a feature you enable requires — mail delivery, IM webhooks, storage. Every section is already here, commented out where it is optional.
config.yml is gitignored because it holds your secrets.keys. Deploy it through your secret management rather than committing it.
Keep the key: what was encrypted under it cannot be read without it. To rotate it, put a new key first in secrets.keys with a higher version and keep the old one after it, run pnpm nocobase secrets rotate (pnpm nocobase secrets status shows what is left to reseal), then remove the old key. Changing the current key signs everyone out.
To run against a production build instead:
pnpm build
pnpm startclient/ Browser application
├── routes.ts Your page routes
├── pages/ Your page components
├── components/ Your components
│ └── ui/ shadcn/ui primitives
├── layouts/ App layout
│ └── components/ Layout containers, navigation, branding and account controls
├── routing/ Route rendering, access checks, loading and error UI
├── locales/ Your translated strings
├── theme/ App-wide theme and light/dark selector
├── extensions/ Application-owned copies of plugin-published UI
├── plugins.ts Which plugins the browser loads
├── react-providers.ts Your React context providers
├── service-provider.ts Your client startup logic
└── runtime.ts Composition root tying the above together
server/ API server
├── routes/ Your HTTP endpoints
├── providers/ Your services and their lifecycle
├── config/ Application configuration composition
├── plugins.ts Which plugins the server loads
├── app.ts Application assembly
├── runtime.ts Composition root
├── standalone.ts Node entry point
└── embedded.ts Entry point when a host process mounts it
cli/ Command line
├── plugins.ts Which plugins contribute commands and build and dev hooks
└── commands/ Your own commands, under the app topic (created when needed)
database/
└── main/
├── migrations/ Your schema history (initially empty)
└── seeds/ Your required initial data (initially empty)
tests/ Unit and integration tests, run by Vitest
└── playwright/ Browser tests against a running application, run by Playwright
config.yml Your configuration, written by pnpm nocobase config init; gitignored
config.example.yml Documented configuration template
The three files named runtime.ts, plugins.ts, and routes.ts are composition roots: they list what the application is made of. Reading them tells you what is loaded and in what order.
pnpm dev, pnpm build and pnpm start are the application's scripts. Everything else is pnpm nocobase <topic> <command>, which pnpm resolves to the application's CLI without a script; pnpm nocobase --help lists them all.
| Script | What it does |
|---|---|
pnpm dev |
Start the API server and client with hot reload |
pnpm build |
Build the client and server into dist/ |
pnpm start |
Run the built server; requires pnpm build first |
pnpm build --tar |
Build, then pack dist/, config.example.yml and the Dockerfile with its .dockerignore into storage/exports/dist.tar.gz |
| Command | What it does |
|---|---|
pnpm nocobase db apply |
Apply pending migrations from your database/main/migrations/ and from every registered plugin, then pending seeds from database/main/seeds/ and from those plugins |
pnpm nocobase db reset |
Destructive: drop every managed schema object, then rerun all migrations and seeds from empty; asks first, and needs --force in CI |
pnpm nocobase db repair |
Realign recorded migration and seed checksums with the current sources; --dry-run reports without writing |
pnpm nocobase collections generate |
Write collection.json, metadata.json and schema.json for every Collection under database/<connection>/collections/, plus a _manifest.json; --check fails when the files are out of date |
Migrations and seeds also run automatically on startup while database.connections.main.migrations.autoRun is true in config.yml. Run pnpm nocobase db apply explicitly when you want to apply a change without restarting. Both halves run only what is pending, so running it on an already-migrated database applies seeds alone.
Database tasks support --connection <name> and --all; no argument targets database.default. Per-connection source and upgrade rules are documented in migrations and seeds.
| Script | What it does |
|---|---|
pnpm test |
Run the test suite once |
pnpm test:watch |
Re-run tests as files change |
pnpm test:coverage |
Run tests and write a coverage report |
pnpm typecheck |
Typecheck the client, tooling, and server |
pnpm lint |
Report lint problems |
pnpm fix |
Fix lint problems, then format |
pnpm check |
Everything above plus a build; what to run before committing |
pnpm nocobase locales check reports a language declared in client/locales/ but not server/locales/, or the reverse, and exits nonzero until the lists align. The browser builds its language picker from the client list, so a client-only language still works in the interface; server messages fall back to English and the language control explains that fallback. Add the matching server locale when server-produced text should use the same language.
Mail (@nocobase/app-plugin-mail) is included and registered on the client and server. Configure mailbox providers under mail.providers in config.yml before connecting accounts; no provider credentials or demo mailboxes are included. See the Mail configuration guide. The plugin provides services and UI components; applications compose their own mailbox pages.
Plugins add features to your application. Let these commands edit package.json, client/plugins.ts, and server/plugins.ts for you rather than editing those files by hand.
Preinstalled plugins belong in devDependencies and provide Skills. Run pnpm nocobase plugin register <name> to enable one. Run plugin unregister <name> to retain it for development or plugin remove <name> to uninstall it together with its synchronized Skills.
| Command | What it does |
|---|---|
pnpm nocobase plugin register <name> |
Install a plugin and wire it into the client and server |
pnpm nocobase plugin remove <name> |
Remove a plugin and its wiring |
pnpm nocobase plugin update [name] |
Upgrade one or all registered plugins and re-sync skills |
pnpm nocobase plugin inspect <name> |
Report a plugin's registration state; read-only |
pnpm nocobase package remove <name> |
Remove a direct NocoBase package and its synchronized Skill |
pnpm nocobase skills sync |
Sync direct NocoBase package Skills into .agents/skills/ |
pnpm install automatically runs pnpm nocobase skills sync through the application's postinstall hook. Run pnpm nocobase skills sync manually when install scripts were disabled or Skills need refreshing.
Use a full package name, as with plugin register and plugin remove; short names such as authentication also work. The optional name is a positional argument, not --plugin.
pnpm nocobase plugin update @nocobase/app-plugin-authentication # Update one registered plugin
pnpm nocobase plugin update authentication # Equivalent short name
pnpm nocobase plugin update # Update all registered plugins
pnpm nocobase plugin update @nocobase/app-plugin-authentication --dry-run # Preview onlyWith no arguments, the command updates every plugin registered in client/plugins.ts, server/plugins.ts or cli/plugins.ts. To update a preinstalled plugin in devDependencies, pass its name explicitly. The command uses the application's package manager. With pnpm, it follows the declared version ranges. After a successful update, the application synchronizes its agent Skills.
Ordering in client/plugins.ts and server/plugins.ts is contribution order, and a plugin is enabled by appearing in the array. Reorder entries or pass a plugin its options by hand; leave adding and removing entries to the commands.
Before removing a direct @nocobase/* dependency, search the application's imports, plugin registrations, routes, services, configuration keys, tests, and build scripts for references to it. Migrate or remove those references first. The removal command updates package metadata and synchronized Skills; it does not rewrite application source or configuration and cannot decide whether the capability is still required.
pnpm nocobase package remove @nocobase/example
pnpm nocobase package remove @nocobase/example --dry-run
pnpm nocobase package remove @nocobase/example --jsonFor an ordinary package, the command uses the application's package manager to remove the dependency and update both package.json and the lockfile, then removes only the Skill directories recorded as owned by that package. For an @nocobase/app-plugin-* package, it reuses the plugin remove steps so Client, Server, and CLI registrations are removed together with the dependency and its Skills. Use pnpm nocobase plugin unregister <name> to keep the package and its Skills available for development.
After an interrupted or manual removal, make sure the manifest no longer declares the package and run a full pnpm nocobase skills sync to reconcile stale package-owned output. Passing a package already absent from the manifest to package remove can clean its recorded historical Skill ownership without uninstalling any other package.
| Command | What it does |
|---|---|
pnpm nocobase dist retarget |
Replace native binaries with the target platform's; part of pnpm build |
pnpm nocobase dist check |
Check that everything your server and CLI import reaches a deployment; part of pnpm build |
pnpm build produces dist/, which is the whole deployment: copy it to a server and run it. The build already ran pnpm install --prod inside dist/, so the tree ships with its node_modules and needs no install step on the server. It also keeps its own package.json, so pnpm install --prod run inside dist/ on the server reinstalls exactly the same set: useful when node_modules was left out of a copy, never required after a normal build.
Client packages are not among them. Plugins declare what their browser code needs as peer dependencies, so your application installs one shared copy for its Vite build, while dist/ opts out of peer installation entirely — lucide-react, @base-ui/react and the rest never reach a server that has no browser in it.
The build targets the machine you run it on, so pnpm build && pnpm start works. Deploying elsewhere means saying where:
pnpm build --help # all build options
pnpm build # this machine
pnpm build --target linux-x64 # most Linux servers
pnpm build --target linux-arm64 # ARM servers, Graviton
pnpm build --target linux-x64-musl # Alpine, and most slim container images
pnpm build --target linux-x64 --node-version 24 # explicitly target Node 24A .node binary is compiled for one platform, architecture, C library, and Node version at once, so a build made on a Mac installs binaries a Linux server cannot load. --target sets platform, architecture, and C library together, because they are chosen together: linux-x64 and linux-x64-musl are different binaries, and Alpine needs the musl one. If you are unsure, ldd --version on the server prints musl for musl and GNU libc otherwise.
--node-version takes the major version your server runs, separately, because the same Linux host may run any of several. The binary retargeter knows ABI mappings for 20, 22, 24, and 26; the application itself requires Node >=24.
pnpm build --help (or -h) lists build options and exits without loading build dependencies, running hooks, or modifying dist/. Every successful build records nocobase.buildTarget in dist/package.json, including builds with no native modules: platform, arch, libc, nodeMajor, and nodeAbi. Use libc only for Linux; its value on other platforms is a compatibility placeholder. Deployment checks should compare these fields with the host runtime and also respect engines.node. With --target current (the default), the Node version and ABI come from the running process; an explicit platform target defaults to Node 24 unless --node-version is supplied.
For example, pnpm build --target linux-x64 --node-version 24 produces:
{
"nocobase": {
"buildTarget": {
"platform": "linux",
"arch": "x64",
"libc": "glibc",
"nodeMajor": 24,
"nodeAbi": 137
}
}
}nodeMajor describes the target runtime, not the Node version used to run the build. No target patch version is implied. These fields provide platform and Node ABI checks for deployment; they do not describe system libraries, CPU instruction requirements, or other runtime prerequisites.
If your application has no native modules — pg, mysql2, and tedious are all plain JavaScript — no platform-specific binaries need retargeting. The build still records the selected target, and the deployment runtime must satisfy engines.node.
Set CDN_BASE_URL when building to use a CDN for Vite-generated asset URLs:
CDN_BASE_URL=https://cdn.example.com/my-app/v1/ pnpm buildUse a full HTTPS URL ending in /. The build reads the process environment first, then .env.local, then .env. Unset, empty or whitespace-only values keep the default relative base (./). Development ignores this variable. This is a build parameter, not a config.yml option or a runtime variable listed by pnpm nocobase config variables or dist/variables.json; changing it requires rebuilding.
Upload the static files in dist/client/ to the configured CDN prefix, preserving their paths. For example, dist/client/assets/index-abc.js must be available at https://cdn.example.com/my-app/v1/assets/index-abc.js. Configure the CDN to allow cross-origin module and font requests from the application origin. A release-specific prefix keeps different builds separate; retain assets needed by clients still running an older release.
Keep the complete dist/client/ tree on the application server, and serve the application's HTML through it so runtime configuration is injected. The CDN setting changes Vite-processed HTML, JavaScript and CSS resource URLs, and static files addressed with resolveAssetUrl, including this template's logos:
import { resolveAssetUrl } from '@nocobase/app-client';
<img src={resolveAssetUrl('/assets/logo-mark.png')} alt='Logo' />;Pass the file's path relative to dist/client/, with or without a leading slash. resolveAssetUrl reads import.meta.env.BASE_URL, which Vite replaces with the configured base during the application build; the browser does not read CDN_BASE_URL from the server environment. With an absolute HTTP(S) CDN base it returns the CDN URL, otherwise it falls back to resolveAppUrl and the runtime APP_BASE_PATH. Already resolved URLs are preserved. Use resolveAppUrl for API URLs, page links and runtime-generated resources; the CDN must actually contain a file before it can be served there.
pnpm build --tar writes storage/exports/dist.tar.gz, the artifact @nocobase/app-installer installs on a server.
The archive has two levels: config.example.yml, dist/ and, when the application has them, the Dockerfile and Dockerfile.dockerignore sit at the root, and the build is inside dist/. A server builds the image from the extracted archive alone with docker build --build-arg DIST=prebuilt .. What dist/ holds varies with the application; this is the shape:
dist.tar.gz
├── Dockerfile
├── Dockerfile.dockerignore
├── config.example.yml
└── dist/
├── cli/
├── client/
├── node_modules/
├── server/
├── package.json
└── pnpm-workspace.yaml
Combine it with --target when the archive is for another machine:
pnpm build --target linux-x64 --tarFor a source build using a CDN, pass its URL as a build argument:
docker build --build-arg CDN_BASE_URL=https://cdn.example.com/my-app/v1/ -t my-app .With DIST=prebuilt, set CDN_BASE_URL on the earlier pnpm build command instead: the image packages the existing client files unchanged. Setting CDN_BASE_URL on a prebuilt image build or with docker run -e cannot change their compiled URLs. The source build does not read the host's .env; use the build argument.
Dockerfile builds this application from its sources into a production image. From the project root:
docker build -t my-app .The build runs pnpm build inside the container, and the image holds only dist/ and config.example.yml. Dockerfile.dockerignore keeps config.yml, .env, storage/, and node_modules out of the build context; keep the two files together. Settings in .env do not reach the image, so pass them to the container as environment variables.
The client is not tied to a mount path, so choose it when starting the container, -e APP_BASE_PATH=/crm; the image defaults to /main. The build runs on the builder's own architecture and cross-targets native modules, so docker buildx build --platform linux/amd64,linux/arm64 compiles nothing under emulation.
To package a dist/ you have already built instead, build it for the image's platform and pass DIST=prebuilt. Nothing is installed or compiled in the image, and it works in any directory that holds the build:
pnpm build --target linux-x64
docker build --platform linux/amd64 --build-arg DIST=prebuilt -t my-app .--target and --platform must name the same architecture: Docker otherwise builds for the machine it runs on, which on Apple silicon is linux/arm64. The image build fails unless dist/ was built for linux with glibc, the image's architecture, and Node 24, and unless it records nocobase.relocatable, which an @nocobase/app-cli from before relocatable builds does not. dist/.env, which pnpm build fills from your local .env files, is never copied in. One dist/ covers one architecture, so a multi-platform image has to be built from source.
Run it with the configuration and data mounted, never copied in:
docker run -d --init -p 13000:13000 \
-v ./config.yml:/app/config.yml:ro \
-v ./storage:/app/storage \
my-appThe image runs as the node user without pnpm, so storage/ must be writable by UID 1000, and application commands run through node dist/cli/index.js, as in docker run --rm -v ./config.yml:/app/config.yml:ro my-app node dist/cli/index.js config check.
Where a package goes depends on which half of your application imports it.
| Imported from | Declare it in |
|---|---|
server/, database/, or cli/ |
dependencies |
client/, build tooling, tests |
devDependencies |
dist/package.json is generated from dependencies and is what a server installs, so a package in devDependencies is missing there however well it works locally. Client packages need nothing at runtime — Vite resolves and inlines them into dist/client while building.
Plugins' browser packages need nothing from you: a plugin declares those as peer dependencies, so installing the plugin brings one shared copy into your application, and dist/ never installs them.
pnpm build verifies the server half and fails the build if something is missing, naming the package. One case it cannot check is an import whose name is assembled while the program runs:
await import(`${name}/index.js`);Nothing can tell in advance which package that names, so declare it in dependencies when you write the code.
Cannot find module on the server, but it runs locally. The package is in devDependencies, which dist/package.json is not generated from. Move it to dependencies and rebuild.
A browser package fails to resolve while building your application. A plugin declares it as a peer dependency and something has to provide it. Add it to your devDependencies.
Error loading shared library, invalid ELF header, or a bare reference to a .node file at startup. The binary does not match the server. Compare what the build targeted against the server:
node -e "console.log(require('./dist/package.json').nocobase.buildTarget)"
node -p "process.platform + '-' + process.arch" # on the server
node -p "process.versions.modules" # on the server: the ABIRebuild with a matching --target and --node-version. ABI 115 is Node 20, 127 is Node 22, 137 is Node 24, 147 is Node 26.
no prebuilt binary for <target> during the build. The package publishes no build for that combination. Check whether the version you depend on supports the target, and whether a musl build exists if you asked for one — musl coverage is thinner than glibc.
server/config/ and client/config/ contain editable TypeScript defaults. config.yml holds environment-specific overrides, written by pnpm nocobase config init and yours to edit from there. It is gitignored because it carries your secrets.keys; deploy it through your secret management rather than committing it. It is generated from config.example.yml, which is kept beside it as the reference for every option.
Two settings decide where the application is reachable:
APP_BASE_PATHis the public path the application is mounted at,/mainby default. The browser API base URL is derived from it as<APP_BASE_PATH>/api.APP_PUBLIC_ORIGINis the external origin used to build callback and redirect URLs. Set it in production. It must not repeat the base path — the runtime joins the two.
An environment variable a section declares takes precedence over the file, and the file over the code defaults. pnpm nocobase config env lists the variables and whether each is set; pnpm nocobase config variables describes each one — what it sets, whether it is a secret, whether a deployment must supply it — and pnpm build writes that description to dist/variables.json. DB_* set the main database connection, INITIAL_ADMIN_USERNAME, INITIAL_ADMIN_EMAIL and INITIAL_ADMIN_PASSWORD the first administrator, and APP_SAMPLE_DATA=true loads the sample data when the database is first installed. ${NAME} in config.yml is not expanded.
Tests live in tests/, never beside the source they cover. Group tests by the source they cover: tests/client/ for pages, components and client logic; tests/server/ for services and routes; tests/database/ for migrations and seeds; tests/cli/ for application commands; and tests/project/ for package configuration and build artifacts. Create optional directories with their first test. Vitest projects select jsdom for client tests and Node for the other groups, so no per-file environment override is needed. Both projects run files sequentially because client integration tests also provision databases; client setup files apply only to the client project. Keep shared helpers and data in tests/helpers/ and tests/fixtures/, without test files. Browser tests belong in tests/playwright/, which Vitest skips. Playwright does not start the application: start it first (pnpm dev, or pnpm build and then the built application), then run pnpm test:e2e; each test reads the application URL, including its base path, from APP_URL. Tests that only need a real server, real authentication, or a real database run under Vitest with createAppTest() from @nocobase/app-testing/server.
Application tests use the /server, /client and /cli entries of @nocobase/app-testing. Start page tests from tests/client/page-harness.test.tsx: it uses renderWithApp() with real application hooks, strict translations, permission checks and a test toaster. Prefer an actual test server for application requests. Use answerApi() for cases that require controlled protocol responses, and replace an external service through services only when the real boundary cannot be exercised, without also registering its owning plugin. The template's Vitest configuration includes client plugins in custom package scopes so their contexts and service tokens remain shared. See .agents/skills/nocobase-app-development/references/testing.md for fixture ownership and complete server, migration and CLI examples.
For authentication, permissions and persisted page behavior, use tests/helpers/authenticated-client.tsx. It starts the real application on isolated databases, signs in through its API, and forwards requests with a cookie jar to the in-process server. tests/setup/application-environment.ts keeps the DOM in jsdom and loads server dependencies through Vite's server environment so Node workers are not rewritten as browser workers. Prefer real components, hooks and services; inject a transport failure or delay only when the scenario requires it. Verify the final UI and server state after retries and permission reloads, not just that a request was called.
Exercise the application's business notification flow, or use a server-side command resolving notificationServiceToken and calling send() with complete messages and explicit recipients. Inspect the returned notification ID through the protected /api/notifications/logs API or the logs page installed by the application. Log access requires page:notification.logs access.
The application documents every /api endpoint it serves — its own routes, every registered plugin's, the data endpoints and Better Auth's sign-in endpoints — in an OpenAPI 3.1 document:
- Swagger UI:
<origin><APP_BASE_PATH>/api/swagger/docs, such ashttp://127.0.0.1:13000/main/api/swagger/docs - JSON:
<origin><APP_BASE_PATH>/api/swagger
Only a signed-in user or an API key may read them; anyone else gets 401. Open the Swagger UI in a browser where you are signed in, or, from a script, send an API key created with POST <APP_BASE_PATH>/api/apiKeys in the x-api-key header. Swagger UI's Authorize button takes a key too and keeps it across reloads.
curl -H "x-api-key: <key>" http://127.0.0.1:13000/main/api/swaggerReplace /main with the application's APP_BASE_PATH. An application without the authentication plugin registers no way to tell who is asking, so it does not serve the documentation at all and both URLs answer 404. There is no setting that makes it public.
AGENTS.md describes how to build features here, and .agents/skills/ contains package-owned guidance generated by pnpm nocobase skills sync. Give an agent an API key when it needs to call the application: it learns the available endpoints from the API document above rather than from route sources. If you use Claude Code, CLAUDE.md points at the same guidance. Keep application-specific rules in committed AGENTS.md files because synchronization replaces package-owned Skill directories.
MIT
runtime.paths, configuration context paths, and app.paths share one resolved AppPaths object. Use paths.storage('...'), paths.database('...'), or the corresponding directory fields. AppPathOptions is input only; application path policies run before the final object is created and configuration is loaded. Standalone entries declare the deployment root in server/runtime.ts so the server and CLI share persistent storage outside the compiled code directory. That storage is storage/ under the deployment root unless APP_STORAGE_DIR names another directory, absolute or relative to the deployment root; set it when the deployment root itself is replaced on every release, as an installer that keeps one directory per release does.
server/app.ts calls createAppFromRuntime(runtime) to transfer configuration, paths, mode and Host logging policy and bind runtime.app. Keep Provider, middleware and route registration explicit and ordered; startApplicationInScope owns startup and shutdown binding.
Set NOCOBASE_STRICT_STARTUP=true when running pnpm dev or pnpm start in automated verification. Startup failures, including job import failures, exit nonzero after resource cleanup. Strict dev runs the server without watch mode so a failed server cannot remain hidden behind a watcher; restart the command after server or configuration changes. Client HMR remains available. Omit the variable or set it to false for normal development with server hot reload. Request errors and individual job execution failures do not terminate the application.
The application can also be the root of a pnpm workspace, with internal packages under packages/* and the existing client/, server/ and database/ directories unchanged. New projects receive this workspace pattern automatically. Internal packages use workspace:* dependencies and may remain private. Run installation, development and deployment builds from the application root; pnpm check includes the internal packages' own checks. See internal packages for configuration and development conventions.
Password registration signs in new accounts by default (auth.emailAndPassword.autoSignIn: true in server/config/auth.ts and config.example.yml). An existing email returns an explicit error, exposing whether that email is registered. For enumeration protection, explicitly set autoSignIn: false and configure email verification with a sender or onExistingUserSignUp to notify the email owner. Existing explicit overrides remain effective; no configuration migration is performed. The authentication plugin warns at startup about registration with auto sign-in disabled and neither verification nor an existing-user notification.
The registration page treats usePasswordRegistration().isSuccess as request acceptance only. A refreshed session navigates signed-in users into the application. Visitors who remain signed out see neutral sign-in and recovery guidance, without an account-creation or email-delivery promise. Applications customizing this page must keep that distinction.