ServerCN CLI
The ServerCN CLI provides a set of commands to help you manage your ServerCN projects.
init
The init command bootstraps ServerCN configuration in an existing project or scaffolds a new project from a starter template.
1. Existing Project
Initialize ServerCN in an Existing Project
npx servercn-cli initYou will be prompted to configure your stack:
This generates a servercn.config.json file in your project root:
2. New Project
Initialize a New Project from a Starter
Available starters:
-
mongoose-starter -
express-server -
drizzle-mysql-starter -
drizzle-pg-starter
npx servercn-cli init drizzle-mysql-starterExample:
This creates a configured project with servercn.config.json:
list
List all available registry item commands.
npx servercn-cli listDescription:
Displays all available starters, components, and schemas in a readable format.
list --json
Return registry item commands in JSON format.
npx servercn-cli ls --jsonlist --all
Return all registry items.
npx servercn-cli ls --alllist --all --json
Return all registry items in JSON structure.
npx servercn-cli ls --all --jsonDescription:
Outputs registry metadata in machine-readable JSON format. Useful for automation and tooling.
add
The add command installs a registry resource into your existing ServerCN project.
It reads your servercn.config.json and resolves the correct implementation based on your selected stack (architecture, framework, database, ORM).
Add a Component
Use this to install reusable components such as utilities, middleware, or shared modules.
npx servercn-cli add <component-name>Example:
npx servercn-cli add jwt-utilsAdd a Foundation
Install a foundational layer that provides core system setup (e.g., base configs, global handlers, shared infrastructure).
npx servercn-cli add foundation <foundation-name>npx servercn-cli add fd express-serverThis integrates the foundation according to your selected architecture and stack configuration.
Add Tooling
Install development tooling such as linters, formatters, logging utilities, or build integrations.
npx servercn-cli add tooling <tooling-name>npx servercn-cli add tl prettierTooling is configured to match your runtime and language setup.
Add a Blueprint
Install a predefined feature structure that scaffolds a complete module pattern (routes, controller, service, model).
npx servercn-cli add blueprint <blueprint-name>npx servercn-cli add bp stateless-authBlueprints accelerate feature-level development while preserving architectural consistency.
Add a Schema
Install a predefined database schema aligned with your selected database and ORM.
npx servercn-cli add schema <schema-name>npx servercn-cli add sc auth/userThe schema is generated based on your configured database type and ORM.
ls fd
List available all foundation.
npx servercn-cli ls fdnpx servercn-cli ls fd --jsonDescription:
Shows all foundation available in the registry.
ls cp
List available components.
npx servercn-cli ls cpnpx servercn-cli ls cp --jsonDescription:
Displays all reusable components available in the registry.
ls bp
List available blueprints.
npx servercn-cli ls bpnpx servercn-cli ls bp --jsonDescription:
Display all blueprints available in the servercn.
ls sc
List available schema.
npx servercn-cli ls scnpx servercn-cli ls sc --jsonDescription:
Display all schema available in the servercn.
ls tl
List available tooling.
npx servercn-cli ls tlnpx servercn-cli ls tl --jsonDescription:
Display all tooling available in the servercn.