DEV Community

Alex Spinov
Alex Spinov

Posted on

CapRover Has a Free API That Gives You Your Own Heroku on Any VPS

CapRover is the open-source PaaS that turns any VPS into a Heroku-like platform. One-click apps, automatic HTTPS, Docker support, and a REST API for automation.

What Is CapRover?

CapRover is a self-hosted PaaS (Platform as a Service). Install it on a $5 VPS and get unlimited app deployments with automatic SSL, Docker, and a web dashboard.

Quick Start

# Install on any Ubuntu VPS
docker run -p 80:80 -p 443:443 -p 3000:3000 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /captain:/captain \
  caprover/caprover
Enter fullscreen mode Exit fullscreen mode

The API

Authentication

# Login and get token
export CAPROVER_URL="https://captain.your-domain.com"

TOKEN=$(curl -s -X POST "$CAPROVER_URL/api/v2/login" \
  -H 'Content-Type: application/json' \
  -d '{"password": "captain42"}' | jq -r '.data.token')
Enter fullscreen mode Exit fullscreen mode

Create an App

curl -s -X POST "$CAPROVER_URL/api/v2/user/apps/appDefinitions/register" \
  -H "x-captain-auth: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"appName": "my-api", "hasPersistentData": false}'
Enter fullscreen mode Exit fullscreen mode

Deploy from Docker Image

curl -s -X POST "$CAPROVER_URL/api/v2/user/apps/appData/my-api" \
  -H "x-captain-auth: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"captainDefinitionContent": "{\"schemaVersion\":2,\"imageName\":\"myuser/myapp:latest\"}"}'
Enter fullscreen mode Exit fullscreen mode

Set Environment Variables

curl -s -X POST "$CAPROVER_URL/api/v2/user/apps/appDefinitions/update" \
  -H "x-captain-auth: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "appName": "my-api",
    "envVars": [
      {"key": "DATABASE_URL", "value": "postgresql://..."},
      {"key": "NODE_ENV", "value": "production"}
    ]
  }'
Enter fullscreen mode Exit fullscreen mode

Enable HTTPS

curl -s -X POST "$CAPROVER_URL/api/v2/user/apps/appDefinitions/enablessl" \
  -H "x-captain-auth: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"appName": "my-api"}'
Enter fullscreen mode Exit fullscreen mode

One-Click Apps

CapRover has 100+ one-click apps:

  • WordPress, Ghost, Strapi, Directus
  • PostgreSQL, MySQL, MongoDB, Redis
  • n8n, Gitea, Plausible, Umami
  • MinIO, RabbitMQ, Prometheus, Grafana
# Deploy one-click app
curl -s -X POST "$CAPROVER_URL/api/v2/user/oneclick/template" \
  -H "x-captain-auth: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"appName": "my-postgres", "templateId": "postgres"}'
Enter fullscreen mode Exit fullscreen mode

CLI Deployment

# Install CLI
npm install -g caprover

# Deploy
caprover deploy -h captain.your-domain.com -a my-api -p captain42 -b main
Enter fullscreen mode Exit fullscreen mode

Cost Comparison

Setup Cost Apps
Heroku $7-25/app 1 per dyno
Railway $5-20/service Per service
Vercel $20/user Frontend only
CapRover + $5 VPS $5 total Unlimited

Self-hosting scraping infrastructure? Scrapfly handles it all in the cloud. Email spinov001@gmail.com for managed scraping.

Top comments (0)