Skip to main content
Run MDCMS on your own infrastructure. This guide walks you through setting up a self-hosted instance from scratch using Docker Compose.
Already have a server running? Skip to the Quick Start to install the CLI and start managing content.

Prerequisites

You need Docker and Docker Compose installed. No other runtime (Bun, Node.js) is required for running the server.
bash brew install --cask docker

Setup

1

Get the MDCMS source

2

Configure environment variables

Copy the example environment file and review it:
The defaults work for local evaluation. For production, you should change database credentials, S3 keys, and configure auth providers. See the environment variables section below.
3

Start all services

This starts:
  • MDCMS Server on port 4000 — the API backend
  • PostgreSQL 16 on port 5432 — primary database
  • Redis 7 on port 6379 — sessions and caching
  • MinIO on ports 9000/9001 — S3-compatible object storage
  • Mailhog on ports 1025/8025 — email capture (dev/staging)
Database migrations run automatically before the server starts.
4

Verify the server is healthy

You should get a 200 OK response. If the server is still starting, wait a few seconds and try again.

Service Endpoints

First Boot

After the server starts, you need to create your first user and connect the CLI.

Create an admin user

Open the Studio UI from your host app (see Embed the Studio UI below), or use the CLI to authenticate:
This opens your browser for authentication. The first user to authenticate becomes the instance owner.

Connect the CLI

Initialize a project against your server:
The init wizard walks you through project creation, environment selection, content directory scanning, and initial schema sync. See the CLI Installation guide for details.

Embed the Studio UI

Add the visual content editor to your application. Install @mdcms/studio and mount it on a catch-all route in your app. See the Integration Guide for full step-by-step instructions covering Studio embedding, MDX components, authentication, and CORS setup.

Environment Variables

Required

These must be set for the server to start. The Docker Compose defaults handle these automatically for local use.

Server

Email

The default email configuration uses Mailhog, which captures all outgoing email without delivering it. For production, configure a real SMTP provider.

Studio

Auth Providers (optional)

Configure SSO providers for your organization. Providers are enabled by presence — no feature flag is needed.

Production Considerations

Security

  • Set strong, unique values for S3_ACCESS_KEY, S3_SECRET_KEY, and database credentials
  • Configure MDCMS_STUDIO_ALLOWED_ORIGINS to restrict CORS to your actual Studio host domain
  • Set NODE_ENV=production to enable secure cookie defaults and disable development features
  • Remove MDCMS_AUTH_INSECURE_COOKIES (or set to false) when running behind HTTPS
  • Replace Mailhog with a production SMTP provider

Persistence

The Docker Compose configuration uses named volumes (pgdata, miniodata) for PostgreSQL and MinIO. These persist across container restarts. To back up your data:

Upgrading

To upgrade to a newer version of MDCMS:
Migrations run automatically on server startup. The migration runner completes before the server accepts traffic, so there is no window where the server runs against an outdated schema.

Using an External Database

To use an existing PostgreSQL instance instead of the bundled container, set DATABASE_URL to your external connection string and remove the postgres service from docker-compose.yml. The same applies to Redis (REDIS_URL) and S3-compatible storage (S3_ENDPOINT, S3_ACCESS_KEY, S3_SECRET_KEY).

Stopping and Resetting

Next Steps

Quick Start

Install the CLI, define your schema, and start managing content

CLI Commands

Push, pull, login, schema sync, and all CLI flags

Studio Guide

Embed the visual content editor in your application

API Reference

REST API endpoints, authentication, and the TypeScript SDK