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 Existing Project 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:
-
nextjs-starter -
express-starter -
mongoose-starter -
drizzle-mysql-starter -
drizzle-pg-starter
npx servercn-cli init nextjs-starter --fw=nextjsnpx 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:
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-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 Provider
Install a provider integration for external services, databases.
npx servercn-cli add provider <provider-name>npx servercn-cli add pr mongodb-prismaAdd 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.
install
Install dependencies for a registry item without scaffolding files. This command is useful for recovery, manual setup, or partial installs.
Usage:
npx servercn-cli install <type> <name> [options]Alias
npx servercn-cli i <type> <name> [options]Types:
Options
Install Modes (mutually exclusive)
Only one mode can be used at a time.
Example:
Install all dependencies (default)
npx servercn-cli i cp jwt-utilsnpx servercn-cli i bp hybrid-authnpx servercn-cli i pr mongodb-mongoosenpx servercn-cli i sc authnpx servercn-cli i fd express-starterInstall only devDependencies
npx servercn-cli i cp jwt-utils --dev-onlynpx servercn-cli i bp hybrid-auth --dev-onlynpx servercn-cli i pr mongodb-mongoose --dev-onlynpx servercn-cli i sc auth --dev-onlynpx servercn-cli i fd express-starter --dev-onlyInstall only runtime dependencies
npx servercn-cli i cp jwt-utils --deps-onlynpx servercn-cli i bp hybrid-auth --deps-onlynpx servercn-cli i pr mongodb-mongoose --deps-onlynpx servercn-cli i sc auth --deps-onlynpx servercn-cli i fd express-starter --deps-onlyview
Inspect details of a registry item such as a component, blueprint, provider, or schema. This command helps you understand what will be installed, how it resolves, and what files are included—without making any changes.
Usage:
npx servercn-cli view <type> <name> [options]Types:
Options
Examples
Basic usage
npx servercn-cli view cp async-handlernpx servercn-cli view cp async-handler --jsonComponent with variant and architecture
npx servercn-cli view cp oauth --variant=github --arch=mvc --jsonVariant option is only applicable when architecture is specified for components
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 --jsonls 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 pr
Display all providers available in the servercn.
npx servercn-cli ls prnpx servercn-cli ls pr --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 tl --json