docker.recipes

HedgeDoc Collaborative Markdown

beginner

HedgeDoc for collaborative markdown editing with PostgreSQL.

Overview

HedgeDoc is a modern, open-source collaborative markdown editor that evolved from HackMD, designed to enable real-time collaborative document creation and editing. It transforms markdown editing from a solitary activity into a dynamic team experience, supporting simultaneous editing by multiple users with live cursor tracking, change highlighting, and instant synchronization. HedgeDoc excels at technical documentation, meeting notes, project planning, and any scenario where teams need to collaborate on structured text content in real-time. This stack combines HedgeDoc with PostgreSQL to create a robust, production-ready collaborative writing platform. PostgreSQL provides enterprise-grade data integrity and ACID compliance for storing document content, revision history, and user data - crucial for collaborative environments where document consistency and data reliability are paramount. The relational structure of PostgreSQL efficiently handles HedgeDoc's complex relationships between users, documents, permissions, and collaborative sessions, while its advanced indexing capabilities ensure fast document retrieval even with large document repositories. This combination serves development teams, technical writers, educators, and organizations that need reliable collaborative documentation tools with professional-grade data persistence. The PostgreSQL backend ensures that collaborative sessions remain consistent even under heavy concurrent editing loads, while HedgeDoc's real-time synchronization engine provides the responsive editing experience users expect from modern collaborative platforms.

Key Features

  • Real-time collaborative editing with live cursor tracking and user presence indicators
  • Comprehensive markdown support including tables, code blocks, math equations, and diagrams
  • Built-in presentation mode for converting markdown documents into slideshow presentations
  • Document permission system with view, edit, and share controls for team collaboration
  • PostgreSQL-backed revision history with full document versioning and change tracking
  • Anonymous editing support for public collaboration without account requirements
  • File upload system with persistent storage for images and attachments
  • Multi-user concurrent editing with conflict resolution and operational transformation

Common Use Cases

  • 1Software development teams creating and maintaining technical documentation collaboratively
  • 2Educational institutions enabling students and faculty to work together on research papers and course materials
  • 3Remote teams conducting real-time meeting notes and project planning sessions
  • 4Open source projects managing community-driven documentation and contribution guidelines
  • 5Technical writing teams creating API documentation, user guides, and knowledge bases
  • 6Startups and small businesses maintaining internal wikis and process documentation
  • 7Conference organizers collaborating on speaker notes, schedules, and presentation materials

Prerequisites

  • Docker and Docker Compose installed with at least 2GB available RAM for optimal performance
  • Port 3000 available for HedgeDoc web interface access
  • Basic understanding of markdown syntax for effective document creation
  • Network access configuration if deploying for team access beyond localhost
  • SSL certificate and reverse proxy setup for production deployments with external access
  • Backup strategy for PostgreSQL data volume to prevent document loss

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 postgres:
3 image: postgres:16-alpine
4 container_name: hedgedoc-postgres
5 restart: unless-stopped
6 environment:
7 POSTGRES_USER: ${POSTGRES_USER:-hedgedoc}
8 POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-hedgedoc}
9 POSTGRES_DB: ${POSTGRES_DB:-hedgedoc}
10 volumes:
11 - postgres_data:/var/lib/postgresql/data
12 networks:
13 - hedgedoc-network
14
15 hedgedoc:
16 image: quay.io/hedgedoc/hedgedoc:latest
17 container_name: hedgedoc
18 restart: unless-stopped
19 ports:
20 - "${HEDGEDOC_PORT:-3000}:3000"
21 environment:
22 - CMD_DB_URL=postgres://${POSTGRES_USER:-hedgedoc}:${POSTGRES_PASSWORD:-hedgedoc}@postgres:5432/${POSTGRES_DB:-hedgedoc}
23 - CMD_DOMAIN=${DOMAIN:-localhost}
24 - CMD_URL_ADDPORT=${ADD_PORT:-true}
25 - CMD_PROTOCOL_USESSL=false
26 - CMD_ALLOW_ANONYMOUS=${ALLOW_ANON:-true}
27 - CMD_ALLOW_ANONYMOUS_EDITS=${ALLOW_ANON_EDIT:-true}
28 volumes:
29 - hedgedoc_uploads:/hedgedoc/public/uploads
30 depends_on:
31 - postgres
32 networks:
33 - hedgedoc-network
34
35volumes:
36 postgres_data:
37 hedgedoc_uploads:
38
39networks:
40 hedgedoc-network:
41 driver: bridge

.env Template

.env
1# HedgeDoc
2HEDGEDOC_PORT=3000
3DOMAIN=localhost
4ADD_PORT=true
5POSTGRES_USER=hedgedoc
6POSTGRES_PASSWORD=hedgedoc
7POSTGRES_DB=hedgedoc
8ALLOW_ANON=true
9ALLOW_ANON_EDIT=true

Usage Notes

  1. 1HedgeDoc at http://localhost:3000
  2. 2Create notes with /new
  3. 3Real-time collaboration
  4. 4Supports presentations

Individual Services(2 services)

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

postgres
postgres:
  image: postgres:16-alpine
  container_name: hedgedoc-postgres
  restart: unless-stopped
  environment:
    POSTGRES_USER: ${POSTGRES_USER:-hedgedoc}
    POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-hedgedoc}
    POSTGRES_DB: ${POSTGRES_DB:-hedgedoc}
  volumes:
    - postgres_data:/var/lib/postgresql/data
  networks:
    - hedgedoc-network
hedgedoc
hedgedoc:
  image: quay.io/hedgedoc/hedgedoc:latest
  container_name: hedgedoc
  restart: unless-stopped
  ports:
    - ${HEDGEDOC_PORT:-3000}:3000
  environment:
    - CMD_DB_URL=postgres://${POSTGRES_USER:-hedgedoc}:${POSTGRES_PASSWORD:-hedgedoc}@postgres:5432/${POSTGRES_DB:-hedgedoc}
    - CMD_DOMAIN=${DOMAIN:-localhost}
    - CMD_URL_ADDPORT=${ADD_PORT:-true}
    - CMD_PROTOCOL_USESSL=false
    - CMD_ALLOW_ANONYMOUS=${ALLOW_ANON:-true}
    - CMD_ALLOW_ANONYMOUS_EDITS=${ALLOW_ANON_EDIT:-true}
  volumes:
    - hedgedoc_uploads:/hedgedoc/public/uploads
  depends_on:
    - postgres
  networks:
    - hedgedoc-network

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 postgres:
5 image: postgres:16-alpine
6 container_name: hedgedoc-postgres
7 restart: unless-stopped
8 environment:
9 POSTGRES_USER: ${POSTGRES_USER:-hedgedoc}
10 POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-hedgedoc}
11 POSTGRES_DB: ${POSTGRES_DB:-hedgedoc}
12 volumes:
13 - postgres_data:/var/lib/postgresql/data
14 networks:
15 - hedgedoc-network
16
17 hedgedoc:
18 image: quay.io/hedgedoc/hedgedoc:latest
19 container_name: hedgedoc
20 restart: unless-stopped
21 ports:
22 - "${HEDGEDOC_PORT:-3000}:3000"
23 environment:
24 - CMD_DB_URL=postgres://${POSTGRES_USER:-hedgedoc}:${POSTGRES_PASSWORD:-hedgedoc}@postgres:5432/${POSTGRES_DB:-hedgedoc}
25 - CMD_DOMAIN=${DOMAIN:-localhost}
26 - CMD_URL_ADDPORT=${ADD_PORT:-true}
27 - CMD_PROTOCOL_USESSL=false
28 - CMD_ALLOW_ANONYMOUS=${ALLOW_ANON:-true}
29 - CMD_ALLOW_ANONYMOUS_EDITS=${ALLOW_ANON_EDIT:-true}
30 volumes:
31 - hedgedoc_uploads:/hedgedoc/public/uploads
32 depends_on:
33 - postgres
34 networks:
35 - hedgedoc-network
36
37volumes:
38 postgres_data:
39 hedgedoc_uploads:
40
41networks:
42 hedgedoc-network:
43 driver: bridge
44EOF
45
46# 2. Create the .env file
47cat > .env << 'EOF'
48# HedgeDoc
49HEDGEDOC_PORT=3000
50DOMAIN=localhost
51ADD_PORT=true
52POSTGRES_USER=hedgedoc
53POSTGRES_PASSWORD=hedgedoc
54POSTGRES_DB=hedgedoc
55ALLOW_ANON=true
56ALLOW_ANON_EDIT=true
57EOF
58
59# 3. Start the services
60docker compose up -d
61
62# 4. View logs
63docker 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/hedgedoc-markdown/run | bash

Troubleshooting

  • HedgeDoc shows database connection errors: Verify PostgreSQL container is running and environment variables match between services
  • Real-time collaboration not working properly: Check that WebSocket connections aren't blocked by firewall or proxy settings
  • File uploads failing or images not displaying: Ensure hedgedoc_uploads volume has proper write permissions and sufficient disk space
  • Anonymous editing disabled unexpectedly: Verify CMD_ALLOW_ANONYMOUS and CMD_ALLOW_ANONYMOUS_EDITS environment variables are set to true
  • PostgreSQL container fails to start with data corruption: Stop containers, remove postgres_data volume, and restart to reinitialize database
  • HedgeDoc performance degrading with many concurrent users: Increase PostgreSQL shared_buffers and work_mem settings, monitor connection pool limits

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