Self-Hosting

Deploy MindMatrix on your own infrastructure.

Requirements

  • Node.js 22+
  • PostgreSQL 17
  • 2GB RAM minimum

Docker Compose

git clone git@github.com:mojoaar/mindmatrix.git
cd mindmatrix
cp .env.example .env
openssl rand -base64 48  # Generate BETTER_AUTH_SECRET
docker compose -f deploy/docker-compose.yml up -d

Node.js (systemd)

cp deploy/mindmatrix.service /etc/systemd/system/
sudo useradd -r -s /bin/false mindmatrix
sudo mkdir -p /opt/mindmatrix
sudo chown -R mindmatrix:mindmatrix /opt/mindmatrix
sudo systemctl daemon-reload
sudo systemctl enable mindmatrix
sudo systemctl start mindmatrix

Environment Variables

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string
BETTER_AUTH_SECRETYes32+ char random secret
BETTER_AUTH_URLYesBase URL of the app
NEXT_PUBLIC_APP_URLYesPublic URL for client
DB_MAX_CONNECTIONSNoMax DB connections (default 10)
NODE_ENVNoproduction or development
SMTP_HOSTNoSMTP server hostname for emails
SMTP_PORTNoSMTP port (e.g. 587)
SMTP_USERNoSMTP username
SMTP_PASSNoSMTP password
EMAIL_FROMNoSender email address
ENCRYPTION_KEYNoAES-256-GCM key for plugin credentials (generate with openssl rand -hex 32)

System Configuration

Dynamic admin settings are stored in the system_config PostgreSQL table and can be managed from the Admin Dashboard under the Settings tab. Configurable options include:

  • Upload file types and max upload size
  • SMTP host, port, user, password, and sender email
  • Markdown email templates (verification, password reset)
  • Landing page enable/disable

SMTP and ENCRYPTION_KEY can also be set as environment variables, which take priority over the database-stored values.