Skip to content

Standard setup: web, internal API and worker ​

Updated: 13 November 2026

This template is the recommended setup for an app with a user interface, a backend and background jobs. An agent can take it over 1:1 and only replaces the marked places. It follows all of the platform's rules: only web is public, the API is internal, the worker has no port, credentials live in secrets.

text
        Internet (HTTPS)
               │
               ▼
   web-<project>.apps.helfinity.cloud
        ┌───────────┐  forward /api/*       ┌───────────┐
        │ web       │ ────────────────────► │ api       │  public: false
        │ (BFF)     │  http://api:8080      │           │
        └───────────┘                       └─────┬─────┘
                                                  │
        ┌───────────┐                             │
        │ worker    │ ─── database, e-mail, … ────┤
        │ no port   │                             ▼
        └───────────┘                   external database (TLS)

The contract ​

Replace <project>, the images and the sizes. Everything else stays as it is.

json
{
  "api_version": "v1alpha1",
  "services": [
    {
      "name": "web",
      "source": { "type": "image", "image": "ghcr.io/<owner>/<app>-web:1.0.0" },
      "port": 3000,
      "resources": { "memory_mb": 256 },
      "health": { "path": "/" },
      "connects_to": ["api"],
      "env": { "API_URL": "http://api.<project>.internal:8080" }
    },
    {
      "name": "api",
      "source": { "type": "image", "image": "ghcr.io/<owner>/<app>-api:1.0.0" },
      "port": 8080,
      "public": false,
      "resources": { "memory_mb": 256 },
      "health": { "path": "/healthz" },
      "secrets": ["DATABASE_URL"]
    },
    {
      "name": "worker",
      "source": { "type": "image", "image": "ghcr.io/<owner>/<app>-api:1.0.0" },
      "start_command": ["node", "worker.js"],
      "resources": { "memory_mb": 256 },
      "health": { "type": "process" },
      "connects_to": ["api"],
      "secrets": ["DATABASE_URL"]
    }
  ]
}

From source code instead of ready-made images: create_upload with the repository as an archive, then per service "source": { "type": "upload", "artifact_id": "art_…", "context_dir": "apps/web" } (build from source). One archive is enough for all three services.

The rules behind it ​

  1. The browser talks only to web. JavaScript in the browser cannot reach api because it has no public URL. web forwards calls on the server side, for example /api/* to $API_URL (Next.js: route handler or rewrites, Nuxt: nitro.routeRules with proxy, Express: http-proxy-middleware). That saves CORS and keeps the API off the internet. The plan reminds you of this with the notice INTERNAL_TARGET_NOT_FROM_BROWSER; with this setup it is not an error.
  2. The API listens on $PORT (here 8080) and on all addresses (0.0.0.0), not only on 127.0.0.1.
  3. The worker has no port. health.type: "process" means: healthy as long as the process runs. If it exits, the platform restarts it. Jobs that may only run once are secured by a lock in the database (for example pg_try_advisory_lock).
  4. State lives in the database. The containers' file system is lost on every deployment. The database is external here (managed PostgreSQL from an EU provider, connection with TLS); how to run it as a service of its own with a volume instead is described below.
  5. Credentials only as secrets. DATABASE_URL is in secrets, never in env. Secrets apply per service.

The agent's steps ​

#ToolWhat
1get_platform_infoCheck capabilities and limits (builds.available, volumes.available)
2create_projectCreate project <project> with budget_eur_month: 10 (that is also the default; the template costs €6.57, with a database €8.91)
3set_secretsDATABASE_URL for api, then for worker
4plan_deploymentCheck the contract, read cost and warnings
5apply_deploymentRoll out the plan
6get_deploymentPoll with wait_s: 25 until healthy or failed; on errors follow next_actions
7get_projectconnections shows whether web reaches api and the worker reaches api (reachable); dns_ok shows whether the URL of web resolves
8get_logsOn problems read the logs of the affected service

On errors the platform rolls back automatically; the old version stays live until the new one is healthy (rollback, stop and restart).

Variant: database as a service of its own ​

At trust level 1 an account has at most three services. If you want to run the database yourself, swap web for db and make the API public (or leave out the worker):

json
{
  "api_version": "v1alpha1",
  "services": [
    {
      "name": "api",
      "source": { "type": "image", "image": "ghcr.io/<owner>/<app>-api:1.0.0" },
      "port": 8080,
      "resources": { "memory_mb": 256 },
      "health": { "path": "/healthz" },
      "connects_to": ["db"],
      "secrets": ["DATABASE_URL"]
    },
    {
      "name": "db",
      "source": { "type": "image", "image": "public.ecr.aws/docker/library/postgres:17-alpine" },
      "port": 5432,
      "public": false,
      "resources": { "memory_mb": 512 },
      "health": { "type": "tcp" },
      "secrets": ["POSTGRES_PASSWORD"],
      "storage": { "volumes": [{ "name": "pgdata", "mount_path": "/var/lib/postgresql/data", "size_gb": 1 }] }
    },
    {
      "name": "worker",
      "source": { "type": "image", "image": "ghcr.io/<owner>/<app>-api:1.0.0" },
      "start_command": ["node", "worker.js"],
      "resources": { "memory_mb": 256 },
      "health": { "type": "process" },
      "connects_to": ["db"],
      "secrets": ["DATABASE_URL"]
    }
  ]
}

DATABASE_URL is then postgres://postgres:<password>@db.<project>.internal:5432/postgres. The volume keeps the data across deployments, restarts and rollbacks; it is backed up daily and can be brought back with restore_volume (data and storage). A service with a volume is replaced on deployment: the old instance stops before the new one starts, so the database is briefly gone.

What it costs ​

At 24/7 operation: three services with 256 MB cost €6.57/month together; there is no base fee. In the variant with a database: 2.19 + 4.38 + 2.19 = €8.76/month plus €0.15 for the volume with 1 GB. More under pricing.