Skip to content

Deployment

Deploy your own instance of Hardcaml Web IDE.

  • Docker with buildx
  • GitHub account (for container registry)
  • Railway account (or similar hosting)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Railway / Cloud Host β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Docker Container β”‚ β”‚
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
β”‚ β”‚ β”‚ FastAPI Backend β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ - /compile endpoint β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ - Static React SPA β”‚ β”‚ β”‚
β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
β”‚ β”‚ β”‚ OCaml Toolchain β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ - OxCaml 5.2 β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ - Hardcaml libs β”‚ β”‚ β”‚
β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The easiest way is to use the pre-built public images:

Terminal window
docker pull ghcr.io/treygilliland/hardcaml-web-ide:latest
docker run -p 8000:8000 ghcr.io/treygilliland/hardcaml-web-ide:latest
Terminal window
git clone https://github.com/treygilliland/hardcaml-web-ide
cd hardcaml-web-ide
Terminal window
# Build base image (OCaml toolchain)
make build-base
# Build production image
make build-prod
Terminal window
# Login to GHCR
echo $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdin
# Push images
make push-all
  1. Create railway.json:
{
"deploy": {
"image": "ghcr.io/YOUR-USERNAME/hardcaml-web-ide:latest"
}
}
  1. Deploy:
Terminal window
railway up
VariableDescriptionDefault
RATE_LIMIT_PER_MINUTEAPI rate limit per IP10
VITE_PUBLIC_POSTHOG_KEYPostHog analytics key-
VITE_PUBLIC_POSTHOG_HOSTPostHog hostus.i.posthog.com

The API includes built-in rate limiting. For production, also configure Cloudflare:

RulePathRateAction
Compile/compile60/minBlock
Global/*300/minChallenge
  1. Add domain in Railway dashboard
  2. Configure DNS (CNAME to Railway)
  3. Enable SSL (automatic with Cloudflare proxy)

Automated builds via .github/workflows/build-base-image.yml:

  1. Triggered manually or on release
  2. Builds both base and production images
  3. Pushes to GHCR

Note: Requires 8GB+ RAM for image builds.