Skip to content

Deploying a NocoBase App

Introduction

NocoBase is an open-source low-code platform built on Node.js for building internal tools and data apps. Deploying NocoBase with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage for database files and uploads—all configured from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample API usage, and production tips.


Prerequisites

  • A Klutch.sh account (sign up)
  • A GitHub repository containing your NocoBase Dockerfile (GitHub is the only supported git source)
  • Database choice: SQLite (built-in) or PostgreSQL/MySQL (deploy as Klutch.sh TCP apps on port 8000; connect on native ports)
  • Domain and TLS for secure access

For onboarding, see the Quick Start.


Architecture and ports

  • NocoBase serves HTTP on internal port 13000; choose HTTP traffic.
  • Persistent storage is required for SQLite (if used) and uploaded assets.
  • External DB (Postgres/MySQL) is recommended for production; connect via TCP on the database’s native port.

Repository layout

nocobase/
├── Dockerfile # Must be at repo root for auto-detection
└── README.md

Keep secrets out of Git; store them in Klutch.sh environment variables.


Installation (local) and starter commands

Validate locally before pushing to GitHub:

Terminal window
docker build -t nocobase-local .
docker run -p 13000:13000 \
-e APP_PORT=13000 \
-e APP_HOST=0.0.0.0 \
nocobase-local

Dockerfile for NocoBase (production-ready)

Place this Dockerfile at the repo root; Klutch.sh auto-detects it (no Docker selection in the UI):

FROM nocobase/nocobase:latest
ENV APP_PORT=13000 \
APP_HOST=0.0.0.0
EXPOSE 13000
CMD ["sh", "-c", "yarn nocobase start --port ${APP_PORT} --host ${APP_HOST}"]

Notes:

  • Pin the image tag (e.g., nocobase/nocobase:1.2.x) for stability and upgrade intentionally.
  • For custom plugins/themes, COPY them into the image and ensure dependencies are installed.

Environment variables (Klutch.sh)

Set these in Klutch.sh before deploying:

  • APP_PORT=13000
  • APP_HOST=0.0.0.0
  • For Postgres: DB_TYPE=postgres, DB_HOST=<db-host>, DB_PORT=5432, DB_NAME=<db-name>, DB_USER=<db-user>, DB_PASSWORD=<db-password>
  • For MySQL: DB_TYPE=mysql, DB_PORT=3306, plus host/db/user/password
  • For SQLite (default): DB_TYPE=sqlite, DB_STORAGE=/app/nocobase/storage/db.sqlite
  • APP_SECRET=<secure-random> (session/signing)
  • Optional: STORAGE_DIR=/app/nocobase/storage/uploads, SMTP settings for notifications

If you deploy without the Dockerfile and need Nixpacks overrides:

  • NIXPACKS_BUILD_CMD=yarn install --frozen-lockfile && yarn build
  • NIXPACKS_START_CMD=yarn nocobase start --port 13000 --host 0.0.0.0
  • NIXPACKS_NODE_VERSION=18

Attach persistent volumes

In Klutch.sh storage settings, add mount paths and sizes (no names required):

  • /app/nocobase/storage — database file (if SQLite), uploads, and local assets.
  • /app/nocobase/logs — optional logs if stored on disk.

Ensure these paths are writable inside the container.


Deploy NocoBase on Klutch.sh (Dockerfile workflow)

  1. Push your repository—with the Dockerfile at the root—to GitHub.
  2. Open klutch.sh/app, create a project, and add an app.
  3. Select HTTP traffic and set the internal port to 13000.
  4. Add the environment variables above, including database settings, APP_SECRET, and storage paths.
  5. Attach persistent volumes for /app/nocobase/storage (and /app/nocobase/logs if used), sizing for your data and uploads.
  6. Deploy. Your NocoBase instance will be reachable at https://example-app.klutch.sh; attach a custom domain if desired.

Sample API usage

Fetch collections:

Terminal window
curl -X GET "https://example-app.klutch.sh/api/collections" \
-H "Authorization: Bearer <token>"

Create a record (example):

Terminal window
curl -X POST "https://example-app.klutch.sh/api/sample_collection" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"title":"Hello from NocoBase","status":"active"}'

Health checks and production tips

  • Add an HTTP probe to /api/health or / for readiness.
  • Enforce HTTPS at the edge; forward internally to port 13000.
  • Use Postgres/MySQL for production; keep credentials and APP_SECRET in Klutch.sh secrets and rotate regularly.
  • Monitor storage usage on /app/nocobase/storage; resize before it fills.
  • Pin image versions and test upgrades in staging before production.

NocoBase on Klutch.sh combines reproducible Docker builds with managed secrets, persistent storage, and flexible HTTP/TCP routing. With the Dockerfile at the repo root, port 13000 configured, and a solid database backend, you can deliver low-code experiences without extra YAML or workflow overhead.