@pulzar/cli
Version:
Ultimate command-line interface for Pulzar framework - scaffolding, development server, building, testing, code generation, health diagnostics, security auditing, and deployment tools for modern Node.js applications
577 lines (405 loc) โข 13.5 kB
Markdown
# ๐ Pulzar CLI
<div align="center">
[](https://badge.fury.io/js/@pulzar%2Fcli)
[](https://www.typescriptlang.org/)
[](https://opensource.org/licenses/MIT)
[](http://makeapullrequest.com)
[](https://www.npmjs.com/package/@pulzar/cli)
**The ultimate command-line interface for Pulzar framework**
_Build modern Node.js applications with zero-reflection DI, GraphQL, WebSockets, events, and edge runtime support_
[Quick Start](#-quick-start) โข [Commands](#-commands) โข [Examples](#-examples) โข [Documentation](https://pulzar.dev)
</div>
## โจ Features
- ๐ **Project Scaffolding** - Create new Pulzar projects with predefined templates
- ๐ง **Development Server** - Hot-reload enabled development environment
- ๐ฆ **Smart Building** - Production builds with edge runtime support
- ๐งช **Testing Suite** - Integrated testing with coverage reports
- ๐ ๏ธ **Code Generation** - Scaffold controllers, services, modules, and more
- ๐ **Health Diagnostics** - Comprehensive project health checks
- ๐ฏ **Zero-Reflection DI** - Advanced dependency injection container building
- ๐ **Performance Analysis** - Built-in performance profiling tools
- ๐ **Security Auditing** - Automated security vulnerability scanning
- ๐ **Docker Integration** - Container building and deployment tools
- ๐ **Plugin Management** - Install and manage Pulzar plugins
- ๐ **OpenAPI Generation** - Automatic API documentation generation
- ๐๏ธ **Database Tools** - Migration, seeding, and studio commands
- ๐ **Monitoring** - Application performance monitoring
- ๐จ **Code Linting** - Integrated Biome linting and formatting
## ๐ฆ Installation
### Global Installation (Recommended)
```bash
npm install -g @pulzar/cli
# or
yarn global add @pulzar/cli
# or
pnpm add -g @pulzar/cli
```
### Project Installation
```bash
npm install --save-dev @pulzar/cli
# or
yarn add -D @pulzar/cli
# or
pnpm add -D @pulzar/cli
```
## ๐ Quick Start
```bash
# Create a new Pulzar project
pulzar new my-app
# Navigate to project
cd my-app
# Start development server
pulzar dev
# Build for production
pulzar build
# Run health checks
pulzar doctor
```
## ๐ Commands
### ๐จ Project Management
#### `pulzar new <name>`
Create a new Pulzar project with advanced scaffolding.
```bash
pulzar new my-api # Basic API project
pulzar new my-app --template fullstack # Full-stack application
pulzar new my-service --database mongodb # With MongoDB
```
**Options:**
- `-t, --template <template>` - Project template (api, fullstack, microservice)
- `--database <db>` - Database type (postgresql, mysql, mongodb, sqlite)
- `--skip-install` - Skip dependency installation
### ๐ง Development
#### `pulzar dev`
Start the development server with hot-reload and advanced debugging.
```bash
pulzar dev # Start on localhost:3000
pulzar dev --port 8080 # Custom port
pulzar dev --host 0.0.0.0 # Bind to all interfaces
```
**Options:**
- `-p, --port <port>` - Port number (default: 3000)
- `-h, --host <host>` - Host address (default: localhost)
- `--watch` - Enable file watching (default: true)
- `--debug` - Enable debug mode
### ๐ฆ Building
#### `pulzar build`
Build your application for production with optimizations.
```bash
pulzar build # Standard build
pulzar build --edge # Edge runtime build
pulzar build --minify # Minified build
pulzar build --out dist-prod # Custom output directory
```
**Options:**
- `--edge` - Build for edge runtime (Cloudflare Workers, Vercel Edge)
- `--minify` - Minify output for smaller bundle size
- `-o, --out <dir>` - Output directory (default: dist)
- `--analyze` - Analyze bundle size
#### `pulzar build-di`
Build zero-reflection dependency injection container from source code.
```bash
pulzar build-di # Build DI container
pulzar build-di --watch # Watch mode
pulzar build-di --source-dir lib # Custom source directory
```
**Options:**
- `-s, --source-dir <dir>` - Source directory (default: src)
- `-o, --output-file <file>` - Output file for container
- `-w, --watch` - Watch for changes and rebuild
- `--no-validate` - Skip validation
### ๐งช Testing
#### `pulzar test`
Run your test suite with coverage and reporting.
```bash
pulzar test # Run all tests
pulzar test --coverage # With coverage report
pulzar test --watch # Watch mode
pulzar test --ui # Interactive UI
```
**Options:**
- `--coverage` - Generate coverage report
- `--watch` - Watch mode for development
- `--ui` - Launch interactive test UI
- `--reporter <type>` - Test reporter (json, html, verbose)
### ๐ ๏ธ Code Generation
#### `pulzar generate <type> <name>`
Generate boilerplate code for various components.
```bash
# Controllers and Routes
pulzar generate controller UserController
pulzar generate route auth/login
# Services and Modules
pulzar generate service UserService
pulzar generate module AuthModule
# GraphQL Components
pulzar generate graphql UserResolver
pulzar generate schema User
# Real-time Features
pulzar generate websocket ChatGateway
pulzar generate event UserCreatedEvent
# Middleware and Guards
pulzar generate middleware AuthMiddleware
pulzar generate guard AdminGuard
pulzar generate interceptor LoggingInterceptor
pulzar generate pipe ValidationPipe
# Background Processing
pulzar generate task EmailTask
pulzar generate decorator CacheResult
```
**Available Types:**
- `controller` - REST API controllers
- `service` - Business logic services
- `module` - Feature modules
- `route` - API routes
- `graphql` - GraphQL resolvers
- `schema` - Data schemas
- `websocket` - WebSocket gateways
- `event` - Event handlers
- `task` - Background tasks
- `middleware` - HTTP middleware
- `guard` - Authentication guards
- `interceptor` - Request interceptors
- `pipe` - Data transformation pipes
- `decorator` - Custom decorators
### ๐ Diagnostics & Health
#### `pulzar doctor`
Comprehensive health check and diagnostics for your project.
```bash
pulzar doctor # Full health check
pulzar doctor --fix # Auto-fix issues
pulzar doctor --config # Check configuration only
pulzar doctor --deps # Check dependencies only
pulzar doctor --security # Security audit only
```
**Options:**
- `--fix` - Automatically fix detected issues
- `--verbose` - Detailed output
- `--config` - Check configuration files
- `--deps` - Check dependencies
- `--types` - Check TypeScript setup
- `--lint` - Check code quality
- `--security` - Security vulnerability scan
- `--performance` - Performance analysis
#### `pulzar info`
Display project and environment information.
```bash
pulzar info # Project information
pulzar info --system # System information
pulzar info --dependencies # Dependency tree
```
### ๐จ Code Quality
#### `pulzar lint`
Lint and format your code using Biome.
```bash
pulzar lint # Lint all files
pulzar lint --fix # Auto-fix issues
pulzar lint src/controllers/ # Lint specific directory
```
**Options:**
- `--fix` - Automatically fix linting issues
- `--check` - Check without fixing
- `--format` - Format code only
### ๐ Security
#### `pulzar security audit`
Run security audit and vulnerability scanning.
```bash
pulzar security audit # Security audit
pulzar security audit --fix # Auto-fix vulnerabilities
pulzar security audit --report # Generate security report
```
### ๐ Performance
#### `pulzar perf analyze`
Analyze application performance and bottlenecks.
```bash
pulzar perf analyze # Performance analysis
pulzar perf analyze --profile # CPU profiling
pulzar perf analyze --memory # Memory analysis
```
### ๐ Docker Operations
#### `pulzar docker build`
Build Docker containers for your application.
```bash
pulzar docker build # Build container
pulzar docker build --tag my-app # Custom tag
pulzar docker run # Run container
```
### ๐ Plugin Management
#### `pulzar plugin <action>`
Manage Pulzar plugins and extensions.
```bash
pulzar plugin add @pulzar/redis # Install plugin
pulzar plugin list # List installed plugins
pulzar plugin remove redis # Remove plugin
```
### ๐๏ธ Database Operations
#### `pulzar db <action>`
Database management and migrations.
```bash
pulzar db migrate # Run migrations
pulzar db seed # Seed database
pulzar db studio # Launch database studio
```
### ๐ API Documentation
#### `pulzar openapi`
Generate and serve OpenAPI documentation.
```bash
pulzar openapi generate # Generate OpenAPI spec
pulzar openapi serve # Serve documentation
```
### ๐ Monitoring
#### `pulzar monitor`
Application monitoring and observability.
```bash
pulzar monitor start # Start monitoring
pulzar monitor status # Check status
```
### ๐ Deployment
#### `pulzar deploy`
Deploy your application to various platforms.
```bash
pulzar deploy # Deploy to configured platform
pulzar deploy --platform vercel # Deploy to Vercel
pulzar deploy --platform cloudflare # Deploy to Cloudflare
```
### ๐ Events Management
#### `pulzar events <action>`
Manage event bus and messaging.
```bash
pulzar events publish <event> # Publish event
pulzar events status # Event bus status
pulzar events dlq # Manage dead letter queue
```
### โฌ๏ธ Maintenance
#### `pulzar upgrade`
Upgrade Pulzar and dependencies to latest versions.
```bash
pulzar upgrade # Upgrade Pulzar
pulzar upgrade --all # Upgrade all dependencies
pulzar upgrade --interactive # Interactive upgrade
```
## ๐ก Examples
### Creating a Complete API
```bash
# Create new project
pulzar new todo-api --template api --database postgresql
# Navigate and start development
cd todo-api
pulzar dev
# Generate API components
pulzar generate controller TodoController
pulzar generate service TodoService
pulzar generate module TodoModule
# Add authentication
pulzar generate guard AuthGuard
pulzar generate middleware JwtMiddleware
# Add real-time features
pulzar generate websocket TodoGateway
pulzar generate event TodoCreatedEvent
# Build for production
pulzar build --minify
# Run health check
pulzar doctor --fix
```
### GraphQL API Development
```bash
# Create GraphQL project
pulzar new graphql-api --template graphql
# Generate GraphQL components
pulzar generate graphql UserResolver
pulzar generate schema User
pulzar generate schema Post
# Start development with GraphQL playground
pulzar dev --graphql
# Generate API documentation
pulzar openapi generate
```
### Microservice Development
```bash
# Create microservice
pulzar new user-service --template microservice
# Add event-driven features
pulzar generate event UserRegisteredEvent
pulzar generate event UserUpdatedEvent
# Add background processing
pulzar generate task EmailNotificationTask
pulzar generate task DataSyncTask
# Deploy to production
pulzar build --edge
pulzar deploy --platform cloudflare
```
## ๐ง Configuration
### CLI Configuration
Create a `.pulzarrc.json` file in your project root:
```json
{
"defaultTemplate": "api",
"defaultDatabase": "postgresql",
"codeGeneration": {
"typescript": true,
"decorators": true,
"validation": true
},
"build": {
"minify": true,
"sourceMap": true,
"target": "es2022"
},
"dev": {
"port": 3000,
"host": "localhost",
"watch": true,
"hotReload": true
}
}
```
## ๐ค Contributing
We welcome contributions! Please see our [Contributing Guide](https://github.com/pulzar-framework/pulzar/blob/main/CONTRIBUTING.md) for details.
### Development Setup
```bash
# Clone repository
git clone https://github.com/pulzar-framework/pulzar.git
cd pulzar
# Install dependencies
npm install
# Build CLI
npm run build
# Link for development
npm link
# Test CLI
pulzar --help
```
## ๐ Documentation
- [๐ Documentation](https://pulzar.dev)
- [๐ Quick Start Guide](https://pulzar.dev/getting-started)
- [๐ API Reference](https://pulzar.dev/api-reference)
- [๐ผ Examples](https://pulzar.dev/examples)
- [๐ Plugins](https://pulzar.dev/plugins)
## ๐ Support & Community
- [๐ฌ Discord Community](https://discord.gg/pulzar)
- [๐ง Email Support](mailto:support@pulzar.dev)
- [๐ Bug Reports](https://github.com/pulzar-framework/pulzar/issues)
- [๐ก Feature Requests](https://github.com/pulzar-framework/pulzar/discussions)
## ๐ License
MIT ยฉ [Pulzar Team](https://github.com/pulzar-framework)
<div align="center">
<strong>Built with โค๏ธ by the Pulzar community</strong><br>
<sub>Making Node.js development faster, better, and more enjoyable</sub>
</div>