Get started

Deploy to production

The recommended setup is Docker Compose: PostgreSQL, the API, the Admin Studio and Caddy for automatic HTTPS, on one server.

Requirements

  • A Linux server with Docker Engine 24+ and Docker Compose v2 (2 vCPU and 2 GB RAM are enough to start).
  • A domain name pointing to the server, for example cms.example.com.
  • Ports 80 and 443 open.

Install with Docker Compose

  1. Get the code and create the settings file:

    bash
    git clone https://github.com/byterings/bytecontent.git
    cd bytecontent
    cp .env.production.example .env.production
  2. Edit .env.production. Set DOMAIN and replace every password and token. Generate secrets with openssl rand -base64 32.

  3. Start everything:

    bash
    docker compose --env-file .env.production -f docker-compose.prod.yml up -d --build
  4. Complete first-run setup (the SETUP_TOKEN protects it):

    bash
    curl -X POST https://cms.example.com/api/v1/setup \
      -H 'content-type: application/json' -H "x-setup-token: $SETUP_TOKEN" \
      -d '{"tenantName":"Acme","tenantSlug":"acme","name":"Ada","email":"[email protected]","password":"a long password"}'
  5. Sign in at https://cms.example.com/login.

What runs

ServicePurposeExposed
caddyHTTPS with automatic certificates, forwards to the Admin Studio80, 443
adminAdmin Studio and the same-origin /api proxyinternal
apiREST API. Applies database migrations on startinternal
postgresPostgreSQL 17 with a restricted application roleinternal
maintenanceHousekeeping job (run on a schedule)job

Both the Admin Studio and the API (including the public API) are served from your domain: https://cms.example.com/api/v1/....

First-run setup from the server

Alternatively, run setup inside the API container without HTTP:

bash
docker compose --env-file .env.production -f docker-compose.prod.yml exec \
  -e SETUP_PASSWORD='a long password' api node dist/cli/setup.js \
  --tenant-name Acme --tenant-slug acme --name Ada --email [email protected]

Schedule maintenance

Run daily, for example from cron at 03:00:

bash
0 3 * * * cd /srv/bytecontent && docker compose --env-file .env.production -f docker-compose.prod.yml run --rm maintenance

It removes expired sessions, prunes old audit events and purges the trash. See Maintenance & monitoring.

Media storage

By default, uploads are stored in the media Docker volume. To use S3, Cloudflare R2 or MinIO instead, set in .env.production:

bash
STORAGE_DRIVER=s3
S3_BUCKET=my-cms-media
S3_REGION=auto
S3_ENDPOINT=https://<account>.r2.cloudflarestorage.com
S3_ACCESS_KEY_ID=...
S3_SECRET_ACCESS_KEY=...

Native install (without Docker)

  1. Install Node.js 22+ (24 LTS recommended), pnpm 10 and PostgreSQL 16+.
  2. Create the application role and database, build and migrate:

    bash
    pnpm install
    ADMIN_DATABASE_URL=postgresql://postgres:<pw>@localhost:5432/postgres \
    APP_DB_PASSWORD='<strong password>' pnpm db:setup-local
    cp apps/api/.env.example apps/api/.env      # set DATABASE_URL, NODE_ENV=production, SETUP_TOKEN …
    pnpm build && pnpm db:deploy
  3. Run the two processes (use systemd or pm2 to keep them running):

    bash
    node apps/api/dist/main.js                                              # :4000
    API_URL=http://localhost:4000 pnpm --filter @bytecontent/admin start   # :3000
  4. Put a TLS reverse proxy (Caddy or nginx) in front of port 3000 and set TRUST_PROXY=true on the API.
Before going live
  • Serve only over HTTPS and keep COOKIE_SECURE=true.
  • Expose only the reverse proxy. Keep the API and PostgreSQL private.
  • Set up backups and test a restore.
  • Read the security checklist.

Updating

  1. Take a backup.
  2. git pull, then run docker compose --env-file .env.production -f docker-compose.prod.yml up -d --build. Migrations run automatically when the API starts.
  3. Check https://cms.example.com/api/v1/health/ready.

Migrations are forward-only. To roll back, restore the backup into a new database and deploy the previous version.

ByteContent by ByteRings is open source under the MIT License. Edit on GitHub