Deployment
Deploy your own instance of Hardcaml Web IDE.
Prerequisites
Section titled βPrerequisitesβ- Docker with buildx
- GitHub account (for container registry)
- Railway account (or similar hosting)
Architecture
Section titled βArchitectureβββββββββββββββββββββββββββββββββββββββββ Railway / Cloud Host ββ βββββββββββββββββββββββββββββββ ββ β Docker Container β ββ β βββββββββββββββββββββββββ β ββ β β FastAPI Backend β β ββ β β - /compile endpoint β β ββ β β - Static React SPA β β ββ β βββββββββββββββββββββββββ β ββ β βββββββββββββββββββββββββ β ββ β β OCaml Toolchain β β ββ β β - OxCaml 5.2 β β ββ β β - Hardcaml libs β β ββ β βββββββββββββββββββββββββ β ββ βββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββQuick Start
Section titled βQuick StartβThe easiest way is to use the pre-built public images:
docker pull ghcr.io/treygilliland/hardcaml-web-ide:latestdocker run -p 8000:8000 ghcr.io/treygilliland/hardcaml-web-ide:latestBuilding Your Own Images
Section titled βBuilding Your Own Imagesβ1. Clone the Repository
Section titled β1. Clone the Repositoryβgit clone https://github.com/treygilliland/hardcaml-web-idecd hardcaml-web-ide2. Build Images
Section titled β2. Build Imagesβ# Build base image (OCaml toolchain)make build-base
# Build production imagemake build-prod3. Push to Registry
Section titled β3. Push to Registryβ# Login to GHCRecho $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdin
# Push imagesmake push-allRailway Deployment
Section titled βRailway Deploymentβ- Create
railway.json:
{ "deploy": { "image": "ghcr.io/YOUR-USERNAME/hardcaml-web-ide:latest" }}- Deploy:
railway upEnvironment Variables
Section titled βEnvironment Variablesβ| Variable | Description | Default |
|---|---|---|
RATE_LIMIT_PER_MINUTE | API rate limit per IP | 10 |
VITE_PUBLIC_POSTHOG_KEY | PostHog analytics key | - |
VITE_PUBLIC_POSTHOG_HOST | PostHog host | us.i.posthog.com |
Rate Limiting
Section titled βRate LimitingβThe API includes built-in rate limiting. For production, also configure Cloudflare:
| Rule | Path | Rate | Action |
|---|---|---|---|
| Compile | /compile | 60/min | Block |
| Global | /* | 300/min | Challenge |
Custom Domain
Section titled βCustom Domainβ- Add domain in Railway dashboard
- Configure DNS (CNAME to Railway)
- Enable SSL (automatic with Cloudflare proxy)
GitHub Actions
Section titled βGitHub ActionsβAutomated builds via .github/workflows/build-base-image.yml:
- Triggered manually or on release
- Builds both base and production images
- Pushes to GHCR
Note: Requires 8GB+ RAM for image builds.