CLI Introduction
Overview
The NitroStack CLI is a powerful command-line tool for creating, developing, and building MCP servers with v3.0's decorator-based architecture.
Features
- 🚀 Quick Initialization - Create new projects in seconds
 - 🔥 Hot Reload - Development mode with automatic reloading
 - 🎨 Studio Integration - Visual testing environment
 - 🔨 Code Generation - Generate modules, tools, types, and more
 - 📦 Production Builds - Optimize for deployment
 - 🎯 Templates - Pre-built templates (basic, typescript-auth)
 
Commands
| Command | Description | 
|---|---|
init | Create a new NitroStack project | 
dev | Start development server with Studio | 
build | Build project for production | 
generate | Generate code (types, modules, tools, etc.) | 
Installation
Global Installation
npm install -g nitrostack
Verify installation:
nitrostack --version
Using npx
No installation required:
npx nitrostack init my-project
Quick Start
# Create a new project
nitrostack init my-server --template typescript-auth
# Navigate to project
cd my-server
# Install dependencies
npm install
# Start development
nitrostack dev
Studio opens at http://localhost:3000 automatically!
Command Reference
nitrostack init
Create a new NitroStack project.
nitrostack init <project-name> [options]
Options:
--template <name>- Template to use (typescript, typescript-auth)
Example:
nitrostack init ecommerce --template typescript-auth
nitrostack dev
Start development server with hot reload and Studio.
nitrostack dev [options]
Options:
--port <number>- Studio port (default: 3000)
Example:
nitrostack dev --port 8080
nitrostack build
Build project for production.
nitrostack build
Outputs to dist/ directory.
nitrostack generate
Generate code from templates.
nitrostack generate <type> [name] [options]
Types:
types- Generate TypeScript types from toolsmodule- Generate a new moduletool- Generate a tool definitionresource- Generate a resource definitionprompt- Generate a prompt definitionguard- Generate an authentication guardmiddleware- Generate middlewareinterceptor- Generate an interceptorpipe- Generate a pipefilter- Generate an exception filterservice- Generate a service
Examples:
# Generate types
nitrostack generate types
# Generate module
nitrostack generate module payments
# Generate tool
nitrostack generate tool create-payment --module payments
# Generate guard
nitrostack generate guard admin
Configuration
CLI behavior can be configured via:
- Command-line flags - Highest priority
 - Environment variables - Medium priority
 - Config file - Lowest priority
 
Environment Variables
# .env
NITROSTACK_PORT=3000
NITROSTACK_WIDGET_PORT=3001
Config File
Create nitrostack.config.js:
export default {
  dev: {
    port: 3000,
    widgetPort: 3001,
    openBrowser: true
  },
  build: {
    outDir: 'dist',
    sourcemap: true
  }
};
Development Workflow
- Initialize - Create project with 
init - Develop - Use 
devfor hot reload + Studio - Generate - Add features with 
generate - Test - Test in Studio with AI chat
 - Build - Production build with 
build - Deploy - Deploy 
dist/to server 
Best Practices
1. Use Templates
Start with a template for best practices:
nitrostack init my-project --template typescript-auth
2. Generate Code
Use generators instead of manual coding:
nitrostack generate module users
nitrostack generate tool get-user --module users
3. Type Generation
Regenerate types after tool changes:
nitrostack generate types
4. Test in Studio
Always test in Studio before deployment:
nitrostack dev
# Test with AI chat
# Test manual execution
Troubleshooting
Command Not Found
# If installed globally
npm install -g nitrostack
# Or use npx
npx nitrostack --version
Port Already in Use
# Use different port
nitrostack dev --port 8080
Permission Errors
# Fix npm permissions
sudo chown -R $USER /usr/local/lib/node_modules
Next Steps
CLI Version: 3.0.0