docker.recipes

Apostrophe CMS

intermediate

Node.js CMS with in-context editing and rich media management.

Overview

Apostrophe CMS is a modern Node.js content management system built with in-context editing at its core, allowing content creators to edit pages directly on the front-end without switching between admin panels and preview modes. Originally developed by P'unk Avenue and now maintained as an open-source project, Apostrophe distinguishes itself from traditional CMSes by treating content as composable widgets within flexible page areas, enabling non-technical users to build sophisticated layouts while maintaining developer control over functionality and design. This Docker stack combines Apostrophe with MongoDB 7, leveraging MongoDB's flexible document structure to store Apostrophe's widget-based content architecture, page trees, and media assets efficiently. The pairing is particularly powerful because Apostrophe's schema-driven approach to content types maps naturally to MongoDB's document collections, while MongoDB's aggregation framework supports Apostrophe's advanced querying needs for content relationships and site navigation. This configuration is ideal for agencies, marketing teams, and organizations that need a CMS where content creators can build complex pages visually while developers maintain full control over the underlying code structure, offering a middle ground between inflexible traditional CMSes and overly complex headless solutions.

Key Features

  • In-context editing with live preview - edit text, images, and widgets directly on the page without admin panel switching
  • Widget-based content composition using areas and singletons for flexible page layouts
  • Rich media management with automatic image resizing, cropping, and optimization
  • Schema-driven content types with automatic admin UI generation for custom post types
  • Built-in user management with role-based permissions and workflow controls
  • Page tree management with drag-and-drop organization and URL routing
  • MongoDB aggregation pipeline integration for complex content queries and relationships
  • Express.js foundation allowing custom routes, middleware, and API endpoints

Common Use Cases

  • 1Marketing websites where non-technical teams need to create landing pages with complex layouts
  • 2Corporate websites requiring frequent content updates with approval workflows
  • 3Event and conference sites needing dynamic speaker, session, and venue management
  • 4Portfolio and agency websites showcasing projects with rich media galleries
  • 5Educational institutions managing course catalogs, faculty profiles, and program information
  • 6Non-profit organizations managing donor campaigns, event listings, and volunteer coordination
  • 7Small to medium e-commerce sites needing custom product presentation beyond standard templates

Prerequisites

  • Docker and Docker Compose installed with at least 2GB RAM available for MongoDB operations
  • Port 3000 available for Apostrophe web interface access
  • Basic understanding of Node.js project structure and npm package management
  • Familiarity with MongoDB concepts like collections and documents for content modeling
  • Knowledge of Express.js routing and middleware for custom functionality development
  • Understanding of widget-based CMS concepts and area/singleton content organization

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 apostrophe:
3 image: apostrophecms/apostrophe:latest
4 container_name: apostrophe
5 restart: unless-stopped
6 environment:
7 APOS_MONGODB_URI: mongodb://mongodb:27017/apostrophe
8 volumes:
9 - ./app:/app
10 - uploads_data:/app/public/uploads
11 ports:
12 - "3000:3000"
13 depends_on:
14 - mongodb
15 networks:
16 - apostrophe-network
17
18 mongodb:
19 image: mongo:7
20 container_name: apostrophe-mongodb
21 volumes:
22 - mongodb_data:/data/db
23 networks:
24 - apostrophe-network
25
26volumes:
27 uploads_data:
28 mongodb_data:
29
30networks:
31 apostrophe-network:
32 driver: bridge

.env Template

.env
1# Apostrophe requires project setup

Usage Notes

  1. 1Docs: https://docs.apostrophecms.org/
  2. 2Access at http://localhost:3000
  3. 3In-context editing: click to edit directly on page
  4. 4Widgets and areas for page composition
  5. 5Built on Express.js and MongoDB
  6. 6Project setup: npx create-apostrophe-app

Individual Services(2 services)

Copy individual services to mix and match with your existing compose files.

apostrophe
apostrophe:
  image: apostrophecms/apostrophe:latest
  container_name: apostrophe
  restart: unless-stopped
  environment:
    APOS_MONGODB_URI: mongodb://mongodb:27017/apostrophe
  volumes:
    - ./app:/app
    - uploads_data:/app/public/uploads
  ports:
    - "3000:3000"
  depends_on:
    - mongodb
  networks:
    - apostrophe-network
mongodb
mongodb:
  image: mongo:7
  container_name: apostrophe-mongodb
  volumes:
    - mongodb_data:/data/db
  networks:
    - apostrophe-network

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 apostrophe:
5 image: apostrophecms/apostrophe:latest
6 container_name: apostrophe
7 restart: unless-stopped
8 environment:
9 APOS_MONGODB_URI: mongodb://mongodb:27017/apostrophe
10 volumes:
11 - ./app:/app
12 - uploads_data:/app/public/uploads
13 ports:
14 - "3000:3000"
15 depends_on:
16 - mongodb
17 networks:
18 - apostrophe-network
19
20 mongodb:
21 image: mongo:7
22 container_name: apostrophe-mongodb
23 volumes:
24 - mongodb_data:/data/db
25 networks:
26 - apostrophe-network
27
28volumes:
29 uploads_data:
30 mongodb_data:
31
32networks:
33 apostrophe-network:
34 driver: bridge
35EOF
36
37# 2. Create the .env file
38cat > .env << 'EOF'
39# Apostrophe requires project setup
40EOF
41
42# 3. Start the services
43docker compose up -d
44
45# 4. View logs
46docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/apostrophe-cms/run | bash

Troubleshooting

  • Error: 'Cannot connect to MongoDB': Ensure MongoDB container is fully started before Apostrophe by adding healthcheck or increasing startup delay
  • Apostrophe admin interface not loading: Check that uploads_data volume has proper permissions and disk space for media storage
  • Session errors or login issues: Verify APOS_MONGODB_URI environment variable matches the exact MongoDB service name and database
  • Widget rendering errors: Ensure custom widget templates are properly mounted in the app volume and restart the container
  • Performance issues with large media uploads: Increase MongoDB container memory allocation beyond the 512MB minimum
  • Build errors when extending Apostrophe: Verify Node.js version compatibility between your custom modules and the apostrophecms/apostrophe base image

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

Components

apostrophemongodb

Tags

#apostrophe#nodejs#in-context-editing#media

Category

CMS & Blogging
Ad Space