start-server Command
Interface
The command starts the Blognami web server with the following signature:
blognami start-server [--host <host:port>] [--without-jobs]Parameters
--host <host:port>(optional) - Host and port configuration (e.g. "127.0.0.1:3000"). Defaults toBLOGNAMI_HOSTenvironment variable or "127.0.0.1:3000"--without-jobs(optional) - Skip starting the job worker
Examples
# Start server with default settings (127.0.0.1:3000)
blognami start-server
# Start server on specific host and port
blognami start-server --host "0.0.0.0:8080"
# Start server without job processing
blognami start-server --without-jobs
# Start server on custom port using environment variable
BLOGNAMI_HOST="127.0.0.1:4000" blognami start-serverDescription
The start-server command is a development and production server that launches your Blognami application with:
- HTTP Server - Handles web requests and API calls
- Job Processing - Automatically starts the job worker for scheduled tasks
- Request Routing - Processes requests through the call handler system
- Static File Serving - Serves static assets and uploads
- ETag Caching - Provides HTTP caching with ETag headers
- Environment Detection - Adapts behavior for development vs production
Server Features
HTTP Request Processing
- Multiple HTTP Methods - Handles GET, POST, PUT, PATCH requests
- File Upload Support - Processes multipart form data with automatic image optimization
- Parameter Extraction - Parses URL parameters, headers, and request bodies
- Response Caching - Generates ETags and handles 304 Not Modified responses
Job Integration
- Automatic Startup - Starts the job worker for scheduled jobs by default
- Job Scheduling - Processes jobs based on cron-like schedules
- Optional Disable - Use
--without-jobsto run server-only mode
Development vs Production
// Development logging (NODE_ENV !== 'test')
console.log(`GET: /api/posts (200)`);
console.log(`Blognami running at "http://127.0.0.1:3000/"`);
// Production mode
// Reduced logging, optimized performanceConfiguration
Host Configuration
The server accepts multiple host formats:
# Single host:port
--host "127.0.0.1:3000"
# Multiple servers (space-separated)
--host "127.0.0.1:3000 0.0.0.0:8080"
# Environment variable
export BLOGNAMI_HOST="127.0.0.1:3000"
blognami start-serverServer Limits
Configured via config.server.limits:
- Body size limits - Maximum request body size
- File upload limits - Maximum file size and count
- Image processing - Automatic resizing and optimization
- Field limits - Maximum form fields and parameters
Common Use Cases
Development Server
# Start development server with hot reloading
blognami start-server
# Development with custom port
blognami start-server --host "127.0.0.1:4000"Production Deployment
# Production server on all interfaces
blognami start-server --host "0.0.0.0:3000"
# Production with environment configuration
NODE_ENV=production blognami start-serverAPI-Only Server
# Server without job processing
blognami start-server --without-jobsRelated Commands
generate-project- Create new Blognami projects that can be servedinitialize-database- Set up database before starting serverstart-repl- Interactive development environmentrun-job- Manually execute jobsgenerate-static-site- Generate static files from server routes