# Squidex CMS

> Open-source headless CMS with event sourcing and GraphQL.

- Category: CMS & Blogging
- Difficulty: intermediate
- Components: squidex, mongodb
- Tags: squidex, headless, event-sourcing, dotnet, graphql
- Source: https://docker.recipes/cms/squidex

## Overview

Squidex is an open-source headless CMS built on .NET that implements event sourcing architecture, making it unique among content management systems. Originally created by Sebastian Stehle in 2017, Squidex stores all changes as immutable events, providing complete audit trails and the ability to replay system state at any point in time. This event-driven approach, combined with automatic GraphQL and REST API generation, makes it particularly powerful for modern application architectures requiring content versioning and real-time synchronization. This stack pairs Squidex with MongoDB 7 to provide both event storage and content persistence in a single database solution. MongoDB's document-oriented structure aligns perfectly with Squidex's flexible schema system, while its change streams enable real-time content updates across connected applications. The combination leverages MongoDB's aggregation framework for complex content queries and its horizontal scaling capabilities for growing content volumes. This configuration is ideal for development teams building headless applications, content creators managing multi-channel publishing workflows, and enterprises requiring comprehensive content audit trails. The event sourcing architecture makes this stack particularly valuable for applications needing content versioning, collaborative editing, or compliance with data governance requirements.

## Features

- Event sourcing architecture with complete audit trail and time-travel debugging capabilities
- Auto-generated GraphQL and REST APIs from custom content schemas
- Real-time content synchronization using MongoDB change streams
- Flexible content modeling with dynamic field types and validation rules
- Built-in content versioning and draft/publish workflows
- Multi-language content support with field-level localization
- Advanced content querying using MongoDB aggregation pipelines
- Webhook system for triggering external integrations on content changes

## Use cases

- Multi-channel content publishing for websites, mobile apps, and IoT devices
- E-commerce platforms requiring product catalog management with price history
- News and media sites needing editorial workflows and content scheduling
- SaaS applications providing customizable user interfaces and content
- Enterprise content hubs managing documentation across multiple departments
- Digital agencies building headless websites for multiple clients
- Compliance-heavy industries requiring complete content change auditing

## Prerequisites

- Minimum 2GB RAM available (MongoDB requires 1GB+, Squidex needs 512MB+)
- Port 5000 available for Squidex web interface access
- Valid email address and strong password for admin account setup
- Basic understanding of headless CMS concepts and API consumption
- Docker and Docker Compose installed with network creation permissions
- Sufficient disk space for MongoDB data growth and event log storage

## docker-compose.yml

```yaml
services:
  squidex:
    image: squidex/squidex:latest
    container_name: squidex
    restart: unless-stopped
    environment:
      URLS__BASEURL: http://localhost:5000
      EVENTSTORE__TYPE: MongoDb
      EVENTSTORE__MONGODB__CONFIGURATION: mongodb://mongodb
      STORE__TYPE: MongoDb
      STORE__MONGODB__CONFIGURATION: mongodb://mongodb
      IDENTITY__ADMINEMAIL: ${ADMIN_EMAIL}
      IDENTITY__ADMINPASSWORD: ${ADMIN_PASSWORD}
    ports:
      - "5000:5000"
    depends_on:
      - mongodb
    networks:
      - squidex-network

  mongodb:
    image: mongo:7
    container_name: squidex-mongodb
    volumes:
      - mongodb_data:/data/db
    networks:
      - squidex-network

volumes:
  mongodb_data:

networks:
  squidex-network:
    driver: bridge
```

## .env

```bash
ADMIN_EMAIL=admin@example.com
ADMIN_PASSWORD=changeme123
```

## Usage notes

- Docs: https://docs.squidex.io/
- Access at http://localhost:5000 - login with ADMIN_EMAIL/ADMIN_PASSWORD
- Event sourcing: full audit trail, time travel debugging
- GraphQL and REST APIs auto-generated from schemas
- Built on .NET 8, MongoDB for storage
- Strong password required (min 8 chars, mixed case, numbers)

## Troubleshooting

- Identity validation failed error: Ensure ADMIN_PASSWORD meets complexity requirements (8+ characters, mixed case, numbers)
- MongoDB connection timeout: Check that mongodb container is fully started before squidex attempts connection
- Port 5000 already in use: Change the host port mapping from 5000:5000 to another port like 5001:5000
- Event store initialization failed: Clear mongodb_data volume and restart containers to reset database state
- GraphQL schema not updating: Clear browser cache and wait for Squidex schema compilation to complete
- High memory usage: Monitor MongoDB memory consumption and consider setting wiredTiger cache limits

