content-workers-node-starter
v1.0.0
Published
Content Workers Node.js starter template - Production-ready traditional server deployment
Maintainers
Readme
Content Workers Node.js Starter
Production-ready Node.js starter template for Content Workers CMS
Traditional server deployment with full Node.js ecosystem support and enterprise-grade features.
🚀 Quick Start
# 1. Complete setup (dependencies, keys, migrations)
npm run setup
# 2. Start development server
npm run dev
# 3. Open admin interface
open http://localhost:6545/adminThat's it! Your Content Workers CMS is ready to use.
✨ What's Included
🏗️ Core Architecture
- Node.js Adapter - Traditional server deployment with clustering support
- SQLite/PostgreSQL - Flexible database options (SQLite for dev, PostgreSQL for prod)
- TypeScript - Full type safety with modern ES modules
- Hot Reload - Instant development feedback with nodemon
📦 Built-in Features
- Content Management - Pages and blogs with translations and revisions
- Admin Interface - Full-featured CMS admin panel
- Media Library - Image processing and file management
- User Management - Role-based permissions and authentication
- API Server - RESTful API with automatic documentation
🔧 Production Ready
- Docker Support - Multi-stage builds with health checks
- PM2 Integration - Process management and clustering
- Environment Management - Separate dev/prod configurations
- Security - Automatic key generation and secure defaults
- Monitoring - Logging, health checks, and metrics
- Backup System - Automated database and file backups
📋 Project Structure
content-workers-node-starter/
├── 📁 src/
│ └── 📁 collections/ # Content type definitions
│ ├── pages.ts # Website pages
│ └── blogs.ts # Blog posts
├── 📁 scripts/ # Automation scripts
│ ├── setup.js # Complete project setup
│ ├── generate-keys.js # Security key generation
│ └── deploy.js # Production deployment
├── 📁 logs/ # Application logs
├── 📁 data/ # SQLite database files
├── 📁 uploads/ # Media uploads
├── 📁 backups/ # Automated backups
├── 🔧 cw.config.ts # Main configuration
├── 🔧 tsconfig.json # TypeScript configuration
├── 🐳 Dockerfile # Docker container setup
├── 🐳 docker-compose.yml # Multi-service orchestration
├── ⚡ ecosystem.config.js # PM2 process management
├── 🔐 .env.example # Environment template
├── 🔐 .env.production # Production environment template
└── 📖 README.md # This documentation🔧 Configuration Options
🗄️ Database Configuration
SQLite (Default - Zero Setup)
// Automatic - no configuration needed
// Perfect for development and small deployments
// Database file: content-workers.sqlitePostgreSQL (Production Recommended)
# Add to .env
DATABASE_URL=postgres://user:pass@localhost:5432/content_workers
DATABASE_SSL=true🔐 Authentication Plugins
GitHub OAuth
npm install @content-workers/auth-github# Add to .env
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secretGoogle OAuth
npm install @content-workers/auth-google# Add to .env
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret📧 Email Services
Resend (Recommended)
npm install @content-workers/plugin-resend# Add to .env
RESEND_API_KEY=your_resend_api_key
RESEND_WEBHOOK_SECRET=your_webhook_secretSMTP (Nodemailer)
npm install @content-workers/plugin-nodemailer# Add to .env
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
[email protected]
SMTP_PASS=your_app_password
SMTP_SECURE=false💾 Storage & Caching
Redis Cache
npm install @content-workers/plugin-redis# Add to .env
REDIS_CONNECTION=redis://localhost:6379
REDIS_PASSWORD=your_redis_passwordS3-Compatible Storage
npm install @content-workers/plugin-s3# Add to .env
S3_ACCESS_KEY=your_access_key
S3_SECRET_KEY=your_secret_key
S3_BUCKET=your-bucket-name
S3_REGION=us-east-1
S3_ENDPOINT=https://s3.amazonaws.com🛠️ Development Commands
# 🚀 Development
npm run dev # Start development server
npm run dev:hot # Start with hot reload (watches all files)
npm run type-check # TypeScript type checking
# 🏗️ Building
npm run build # Build for production
npm run start # Start production server
npm run start:prod # Start with production environment
# 🗄️ Database
npm run migrate # Run database migrations
npm run migrate:rollback # Rollback last migration
npm run migrate:reset # Reset all migrations
npm run migrate:fresh # Reset and re-run all migrations
# 🔐 Security
npm run generate-keys # Generate security keys
npm run setup # Complete project setup
# 🧹 Maintenance
npm run clean # Clean build artifacts and logs
npm run backup # Create database and file backup
npm run restore # Restore from backup🚀 Deployment Options
🐳 Docker Deployment (Recommended)
Single Container
# Build and run
npm run docker:build
npm run docker:run
# Or use deployment script
npm run deploy:dockerDocker Compose (Full Stack)
# Start all services (app + postgres + redis + nginx)
npm run docker:compose
# Development mode
npm run docker:compose:dev⚡ PM2 Deployment (Traditional)
# Install PM2 globally
npm install -g pm2
# Deploy with PM2
npm run deploy
# Or manual PM2 commands
npm run pm2:start # Start application
npm run pm2:stop # Stop application
npm run pm2:restart # Restart application
npm run pm2:logs # View logs🌐 Manual Deployment
# 1. Build application
npm run build
# 2. Set production environment
export NODE_ENV=production
# 3. Run migrations
npm run migrate
# 4. Start server
npm start🔍 Advanced Features
📊 Monitoring & Logging
- Health Checks - Built-in health endpoints for load balancers
- Structured Logging - JSON logs with request tracing
- PM2 Monitoring - Process monitoring and automatic restarts
- Docker Health Checks - Container health monitoring
🔒 Security Features
- Automatic Key Generation - Cryptographically secure keys
- Environment Validation - Zod schema validation for all env vars
- Secure Defaults - Production-ready security configuration
- SSL Support - HTTPS configuration for production
📈 Performance Optimization
- Clustering - Multi-core CPU utilization with PM2
- Caching - Redis integration for session and data caching
- Database Optimization - Connection pooling and query optimization
- Static Asset Serving - Efficient file serving with proper headers
🔄 DevOps Integration
- CI/CD Ready - GitHub Actions, GitLab CI, Jenkins compatible
- Environment Management - Separate dev/staging/prod configurations
- Backup Automation - Scheduled database and file backups
- Zero-Downtime Deployment - Rolling updates with PM2
🆚 When to Choose This Starter
✅ Perfect For:
- Enterprise Applications - Need full Node.js ecosystem access
- Complex Business Logic - Server-side processing and integrations
- Traditional Infrastructure - VPS, dedicated servers, on-premise
- File System Operations - Local file processing and storage
- Maximum Flexibility - Custom plugins and extensive customization
🤔 Consider Alternatives If:
- Global Edge Deployment → Use Cloudflare Workers Starter
- Serverless Functions → Use Vercel Starter
- Simple Content Sites → Any starter works, this might be overkill
📚 Documentation & Resources
📖 Official Documentation
- Content Workers Docs - Complete documentation
- API Reference - REST API documentation
- Plugin Development - Create custom plugins
🎓 Learning Resources
- Getting Started Guide - Step-by-step tutorial
- Configuration Guide - Advanced configuration
- Deployment Guide - Production deployment
🤝 Community & Support
- GitHub Repository - Source code and issues
- Discord Community - Community chat and support
- Stack Overflow - Q&A
🏆 Production Checklist
Before deploying to production, ensure you have:
- [ ] Security Keys - Generated unique production keys (not development keys)
- [ ] Database - Configured PostgreSQL for production (not SQLite)
- [ ] Environment Variables - Set all required production environment variables
- [ ] SSL Certificate - Configured HTTPS with valid SSL certificate
- [ ] Reverse Proxy - Set up nginx or similar for load balancing
- [ ] Monitoring - Configured logging, metrics, and alerting
- [ ] Backups - Set up automated database and file backups
- [ ] Domain - Configured custom domain and DNS
- [ ] CDN - Set up CDN for static assets (optional but recommended)
- [ ] Error Tracking - Integrated error tracking service (Sentry, etc.)
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🚀 Ready to build something amazing?
Get Started • View Documentation • Join Community
Built with ❤️ by the Content Workers team
