Cockpit CMS
Self-hosted headless CMS with a simple API.
Overview
Cockpit is a self-hosted headless Content Management System developed by Agentejo that focuses on simplicity and API-first architecture. Unlike traditional CMS platforms, Cockpit separates content management from presentation, storing content in flexible Collections and Singletons while providing a clean REST API for frontend consumption. It emerged as a lightweight alternative to complex enterprise CMS solutions, offering developers the freedom to build custom frontends while content creators work within an intuitive admin interface.
This stack combines Cockpit with MongoDB as the primary database engine, leveraging MongoDB's document-based storage model that naturally aligns with Cockpit's JSON-centric content structure. MongoDB's flexible schema design allows Cockpit to store diverse content types without rigid table structures, while its aggregation framework enables complex content queries through Cockpit's API layer. The document database approach eliminates the object-relational mapping overhead common in traditional SQL-based CMS systems.
This combination serves developers building modern web applications, mobile apps, or multi-channel content distribution systems who need editorial workflows without frontend constraints. Startups and agencies benefit from rapid prototyping capabilities, while the headless architecture supports progressive web apps, static site generators, and custom React or Vue.js applications that require dynamic content management.
Key Features
- JSON-based Collections system for structured content with custom field types and validation rules
- Singletons for global configuration data like site settings, SEO metadata, and application constants
- MongoDB aggregation pipeline integration for complex content queries and analytics
- Token-based REST API authentication with granular permission controls per collection
- Asset management with automatic image resizing and WebP conversion capabilities
- Real-time content preview with webhook support for triggering builds in static site generators
- Custom field components including repeaters, galleries, and markdown editors with live preview
- MongoDB Change Streams integration for real-time content synchronization across multiple frontends
Common Use Cases
- 1Headless blog or magazine platform feeding content to React, Vue.js, or Next.js frontends
- 2Mobile app content management where iOS and Android apps consume the same content API
- 3Multi-site content distribution serving different brands or regions from centralized content
- 4E-commerce product catalog management for custom shopping experiences built with modern frameworks
- 5Documentation systems where technical writers manage content consumed by developer portals
- 6Digital agency client projects requiring custom designs without CMS theme limitations
- 7Static site generator content source for Gatsby, Nuxt, or Eleventy build processes
Prerequisites
- Minimum 1GB RAM for combined Cockpit and MongoDB operations with small datasets
- Port 8080 available for Cockpit admin interface and API endpoints
- Understanding of REST API concepts for frontend integration and token management
- Basic JSON knowledge for content structure design and API response handling
- MongoDB query familiarity for advanced content filtering and aggregation operations
- Frontend development skills in JavaScript frameworks for headless implementation
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 cockpit: 3 image: agentejo/cockpit:latest4 container_name: cockpit5 restart: unless-stopped6 volumes: 7 - cockpit_data:/var/www/html/storage8 ports: 9 - "8080:80"10 networks: 11 - cockpit-network1213 mongodb: 14 image: mongo:715 container_name: cockpit-mongodb16 volumes: 17 - mongodb_data:/data/db18 networks: 19 - cockpit-network2021volumes: 22 cockpit_data: 23 mongodb_data: 2425networks: 26 cockpit-network: 27 driver: bridge.env Template
.env
1# Default credentials: admin / adminUsage Notes
- 1Docs: https://getcockpit.com/documentation
- 2Access at http://localhost:8080 - default login: admin / admin
- 3Change default password immediately after first login
- 4Create Collections for structured content, Singletons for config
- 5REST API: /api/collections/get/[name]?token=YOUR_TOKEN
- 6Lightweight alternative to larger headless CMS options
Individual Services(2 services)
Copy individual services to mix and match with your existing compose files.
cockpit
cockpit:
image: agentejo/cockpit:latest
container_name: cockpit
restart: unless-stopped
volumes:
- cockpit_data:/var/www/html/storage
ports:
- "8080:80"
networks:
- cockpit-network
mongodb
mongodb:
image: mongo:7
container_name: cockpit-mongodb
volumes:
- mongodb_data:/data/db
networks:
- cockpit-network
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 cockpit:5 image: agentejo/cockpit:latest6 container_name: cockpit7 restart: unless-stopped8 volumes:9 - cockpit_data:/var/www/html/storage10 ports:11 - "8080:80"12 networks:13 - cockpit-network1415 mongodb:16 image: mongo:717 container_name: cockpit-mongodb18 volumes:19 - mongodb_data:/data/db20 networks:21 - cockpit-network2223volumes:24 cockpit_data:25 mongodb_data:2627networks:28 cockpit-network:29 driver: bridge30EOF3132# 2. Create the .env file33cat > .env << 'EOF'34# Default credentials: admin / admin35EOF3637# 3. Start the services38docker compose up -d3940# 4. View logs41docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/cockpit-cms/run | bashTroubleshooting
- Admin interface shows 'Database connection failed': Verify MongoDB container is running and cockpit-network connectivity exists
- API returns empty collections after content creation: Check MongoDB data persistence and ensure mongodb_data volume is properly mounted
- Image uploads fail with permission errors: Verify cockpit_data volume permissions allow write access to /var/www/html/storage
- Token authentication returns 401 errors: Generate new API tokens from Cockpit settings and verify token format in request headers
- MongoDB container exits with 'insufficient memory': Increase Docker memory limits or reduce MongoDB cache size configuration
- Collections return stale data after updates: Clear Cockpit cache from admin panel or restart cockpit container to refresh MongoDB connections
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Ad Space
Shortcuts: C CopyF FavoriteD Download