Skip to content

Deploying a Parse App

Introduction

Parse Server is an open-source backend-as-a-service framework built on Node.js and MongoDB. Deploying Parse with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage for uploads and logs—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 Parse Dockerfile (GitHub is the only supported git source)
  • MongoDB database (deploy as a Klutch.sh TCP app on port 8000 and connect on 27017)
  • Optional file adapter settings (S3-compatible storage) for uploads
  • Domain and TLS for secure access

For onboarding, see the Quick Start.


Architecture and ports

  • Parse Server serves HTTP on internal port 1337; choose HTTP traffic.
  • Persistent storage is recommended for logs and file adapters if using local storage.

Repository layout

parse/
├── Dockerfile # Must be at repo root for auto-detection
├── package.json
├── pnpm-lock.yaml # or yarn.lock / package-lock.json
└── server.js # Parse Server entry

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
pnpm install
pnpm start

Dockerfile for Parse (production-ready)

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

FROM node:18-alpine AS build
WORKDIR /app
COPY package.json pnpm-lock.yaml* yarn.lock* package-lock.json* ./
RUN corepack enable
RUN pnpm install --frozen-lockfile
COPY . .
FROM node:18-alpine
WORKDIR /app
ENV NODE_ENV=production PORT=1337
COPY --from=build /app /app
RUN corepack enable && pnpm install --prod --frozen-lockfile
EXPOSE 1337
CMD ["pnpm", "start"]

Notes:

  • Add build tools (apk add --no-cache python3 make g++) if native modules are required.
  • Ensure server.js reads env vars for DB and app keys.

Environment variables (Klutch.sh)

Set these in Klutch.sh before deploying:

  • PORT=1337
  • PARSE_SERVER_APPLICATION_ID=<app-id>
  • PARSE_SERVER_MASTER_KEY=<master-key>
  • PARSE_SERVER_DATABASE_URI=mongodb://<user>:<password>@<host>:27017/<db>
  • PARSE_SERVER_URL=https://example-app.klutch.sh/parse
  • Optional file storage: PARSE_SERVER_FILES_ADAPTER=<adapter>, S3 credentials if used
  • Optional email/SMS adapters as needed

If you deploy without the Dockerfile and need Nixpacks overrides:

  • NIXPACKS_BUILD_CMD=pnpm install --frozen-lockfile
  • NIXPACKS_START_CMD=pnpm start
  • NIXPACKS_NODE_VERSION=18

Attach persistent volumes

In Klutch.sh storage settings, add mount paths and sizes (no names required) if you store files locally:

  • /app/files — local file storage (if not using S3).
  • /app/logs — optional logs if stored on disk.

Ensure these paths are writable inside the container.


Deploy Parse 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 1337.
  4. Add the environment variables above, including DB URI, app ID, and master key.
  5. Attach persistent volumes for /app/files (if used) and /app/logs sized for your storage and retention needs.
  6. Deploy. Your Parse endpoint will be reachable at https://example-app.klutch.sh/parse; configure your clients to use this URL.

Sample API usage

Create a class object:

Terminal window
curl -X POST "https://example-app.klutch.sh/parse/classes/TestObject" \
-H "X-Parse-Application-Id: <app-id>" \
-H "X-Parse-REST-API-Key: <master-key>" \
-H "Content-Type: application/json" \
-d '{"message":"Hello from Parse on Klutch.sh"}'

Query objects:

Terminal window
curl -X GET "https://example-app.klutch.sh/parse/classes/TestObject" \
-H "X-Parse-Application-Id: <app-id>" \
-H "X-Parse-REST-API-Key: <master-key>"

Health checks and production tips

  • Add an HTTP probe to /parse/health or /health if you expose one.
  • Enforce HTTPS at the edge; forward internally to port 1337.
  • Keep master keys and DB credentials in Klutch.sh secrets; rotate them regularly.
  • Monitor storage usage on /app/files (if local files) and resize before it fills.
  • Pin image versions and test upgrades in staging; back up DB and files before updates.

Parse 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 1337 configured, and MongoDB connected, you can deliver BaaS capabilities without extra YAML or workflow overhead.