HedgeDoc
Real-time collaborative markdown editor.
Overview
HedgeDoc is a real-time collaborative markdown editor that emerged from the CodiMD project, itself a fork of the original HackMD. It enables multiple users to simultaneously edit markdown documents with live preview, real-time synchronization, and rich formatting capabilities including diagrams, mathematical equations, and embedded media. Unlike simple text editors, HedgeDoc provides a web-based platform where teams can collaborate on documentation, meeting notes, and technical specifications with the power of markdown syntax.
This Docker stack pairs HedgeDoc with PostgreSQL to create a robust, self-hosted documentation platform. PostgreSQL serves as the backend database, storing document content, user sessions, revision history, and metadata with ACID compliance and reliability. The combination provides enterprise-grade data integrity for collaborative editing scenarios where document consistency and user management are critical.
This setup is ideal for development teams, technical writers, and organizations requiring a private, feature-rich alternative to cloud-based collaborative editors. The PostgreSQL backend ensures data sovereignty while supporting complex queries for document search and user management, making it suitable for environments with compliance requirements or teams handling sensitive documentation that cannot be stored on third-party platforms.
Key Features
- Real-time collaborative editing with live cursor tracking and user presence indicators
- Comprehensive markdown support including Mermaid diagrams, MathJax equations, and syntax highlighting
- PostgreSQL-backed revision history with full document versioning and rollback capabilities
- User authentication and permission management with document sharing controls
- Export functionality to PDF, HTML, and various document formats
- Plugin architecture supporting custom renderers and extensions
- Presentation mode for creating slideshow presentations from markdown content
- Full-text search across documents powered by PostgreSQL's advanced search capabilities
Common Use Cases
- 1Software development teams creating and maintaining technical documentation and API specifications
- 2Academic institutions hosting collaborative research papers and course materials
- 3Engineering teams managing meeting notes, project specifications, and knowledge bases
- 4Startups building internal wikis and documentation systems with version control
- 5Technical writing teams collaborating on user manuals and help documentation
- 6Open source projects providing contributor-friendly documentation platforms
- 7Organizations migrating from proprietary collaboration tools to self-hosted solutions
Prerequisites
- Docker Engine 20.10+ and Docker Compose V2 for container orchestration
- Minimum 1GB RAM for PostgreSQL optimal performance with concurrent users
- Port 3000 available for HedgeDoc web interface access
- DB_PASSWORD environment variable configured for PostgreSQL authentication
- Basic understanding of markdown syntax and collaborative editing workflows
- SSL certificate and reverse proxy setup for production deployments
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 hedgedoc: 3 image: quay.io/hedgedoc/hedgedoc:latest4 container_name: hedgedoc5 restart: unless-stopped6 environment: 7 CMD_DB_URL: postgres://hedgedoc:${DB_PASSWORD}@postgres:5432/hedgedoc8 CMD_DOMAIN: localhost9 CMD_URL_ADDPORT: "true"10 volumes: 11 - hedgedoc_uploads:/hedgedoc/public/uploads12 ports: 13 - "3000:3000"14 depends_on: 15 - postgres16 networks: 17 - hedgedoc1819 postgres: 20 image: postgres:15-alpine21 container_name: hedgedoc-postgres22 restart: unless-stopped23 environment: 24 POSTGRES_USER: hedgedoc25 POSTGRES_PASSWORD: ${DB_PASSWORD}26 POSTGRES_DB: hedgedoc27 volumes: 28 - postgres_data:/var/lib/postgresql/data29 networks: 30 - hedgedoc3132volumes: 33 hedgedoc_uploads: 34 postgres_data: 3536networks: 37 hedgedoc: 38 driver: bridge.env Template
.env
1DB_PASSWORD=changemeUsage Notes
- 1Access at http://localhost:3000
- 2Real-time markdown editing
- 3HackMD/CodiMD fork
Individual Services(2 services)
Copy individual services to mix and match with your existing compose files.
hedgedoc
hedgedoc:
image: quay.io/hedgedoc/hedgedoc:latest
container_name: hedgedoc
restart: unless-stopped
environment:
CMD_DB_URL: postgres://hedgedoc:${DB_PASSWORD}@postgres:5432/hedgedoc
CMD_DOMAIN: localhost
CMD_URL_ADDPORT: "true"
volumes:
- hedgedoc_uploads:/hedgedoc/public/uploads
ports:
- "3000:3000"
depends_on:
- postgres
networks:
- hedgedoc
postgres
postgres:
image: postgres:15-alpine
container_name: hedgedoc-postgres
restart: unless-stopped
environment:
POSTGRES_USER: hedgedoc
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: hedgedoc
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- hedgedoc
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 hedgedoc:5 image: quay.io/hedgedoc/hedgedoc:latest6 container_name: hedgedoc7 restart: unless-stopped8 environment:9 CMD_DB_URL: postgres://hedgedoc:${DB_PASSWORD}@postgres:5432/hedgedoc10 CMD_DOMAIN: localhost11 CMD_URL_ADDPORT: "true"12 volumes:13 - hedgedoc_uploads:/hedgedoc/public/uploads14 ports:15 - "3000:3000"16 depends_on:17 - postgres18 networks:19 - hedgedoc2021 postgres:22 image: postgres:15-alpine23 container_name: hedgedoc-postgres24 restart: unless-stopped25 environment:26 POSTGRES_USER: hedgedoc27 POSTGRES_PASSWORD: ${DB_PASSWORD}28 POSTGRES_DB: hedgedoc29 volumes:30 - postgres_data:/var/lib/postgresql/data31 networks:32 - hedgedoc3334volumes:35 hedgedoc_uploads:36 postgres_data:3738networks:39 hedgedoc:40 driver: bridge41EOF4243# 2. Create the .env file44cat > .env << 'EOF'45DB_PASSWORD=changeme46EOF4748# 3. Start the services49docker compose up -d5051# 4. View logs52docker 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/hedgedoc/run | bashTroubleshooting
- Database connection failed: Ensure DB_PASSWORD environment variable matches between HedgeDoc and PostgreSQL containers
- HedgeDoc shows 'Cannot connect to database': Verify postgres container is running and network connectivity using docker logs hedgedoc-postgres
- Upload functionality not working: Check hedgedoc_uploads volume permissions and ensure sufficient disk space
- Real-time collaboration not syncing: Verify WebSocket connections aren't blocked by firewalls or reverse proxies
- PostgreSQL container fails to start: Check postgres_data volume permissions and ensure no conflicting database processes on host
- HedgeDoc interface loads but documents won't save: Examine PostgreSQL logs for constraint violations or disk space issues
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
hedgedocpostgres
Tags
#hedgedoc#markdown#collaboration#notes
Category
Productivity & CollaborationAd Space
Shortcuts: C CopyF FavoriteD Download