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 initAfter running the command, you will be prompted to choose a project foundation:
Choose the foundation that best fits your project requirements and press Enter to continue.
Again, you 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:
-
express-starter -
mongoose-starter -
drizzle-mysql-starter -
drizzle-pg-starter
npx servercn-cli init express-starternpx servercn-cli init mongoose-starternpx servercn-cli init drizzle-mysql-starternpx servercn-cli init drizzle-pg-starterExample:
This creates a configured project with servercn.config.json:
list
List all available registry item commands.
npx servercn-cli listlist --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 --jsonadd
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-starterThis 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 --jsonls cp
Displays all reusable components available in the registry.
npx servercn-cli ls cpnpx servercn-cli ls cp --jsonls bp
Display all blueprints available in the servercn.
npx servercn-cli ls bpnpx servercn-cli ls bp --jsonls sc
Display all schema available in the servercn.
npx servercn-cli ls scnpx servercn-cli ls sc --jsonls tl
Display all tooling available in the servercn.
npx servercn-cli ls tlnpx servercn-cli ls tlnpx servercn-cli ls tl --json