Skip to content
use-cases / preview-env-per-pr-cheap / hero
CONTAINERS · SNAPSHOTS · PR PREVIEWS

A preview environment per pull request, all month

Snapshot your staging container once. Each new PR clones the snapshot into its own container with its own URL. The container wakes when a reviewer opens the link, naps when no one is watching, and gets destroyed by a one-line cron when the PR closes. Sixty branches, sixty URLs, and a flat bill.

CRON · DESTROY MERGED PREVIEWSone line, every 5 minutes
# When a PR merges, the cron drops its container.*/5 * * * * curl -X DELETE https://api.hoody.com/api/v1/containers/$MERGED_PR_CID
SNAPSHOT LINEAGEone base · many clones
STAGING-BASEsnap-2026-05-01 · 4.2 GB
COPY-ON-WRITE PAGES SHARED30 / 30 containers
use-cases / preview-env-per-pr-cheap / mechanism

How a PR becomes a URL

Three calls. One cron line. The CI pipeline you already have triggers them in the order you'd write yourself if you had to.

    01
    STEP 01 · ONCE

    Snapshot the staging container

    Pick the container that runs your staging stack — app, database, queues, fixtures. POST a snapshot, name it staging-base. Files, processes, and memory get captured. The snapshot is a deltable starting point, not a tarball — clones share its pages instead of copying them.

    02
    STEP 02 · PER PR

    Clone the snapshot on push

    Your CI gets the GitHub push webhook and POSTs to the containers API with source_snapshot=staging-base. A new container boots in seconds with the seeded database and the PR's branch checked out. The URL goes back as a status check.

    03
    STEP 03 · ON MERGE

    Destroy when the PR closes

    A 5-minute cron entry walks merged PRs and DELETEs their containers — or your merge webhook does it inline. The container's disk delta is reclaimed, the URL is freed, and the container slot returns to the pool for the next PR.

Step 02 takes about as long as a yarn install. Step 03 is one HTTP call. Nothing else has to know that the PR's container existed.

use-cases / preview-env-per-pr-cheap / api

The exact endpoints your CI calls

Three real endpoints from the Hoody Containers and Snapshots APIs. Drop them into the GitHub Actions step you already have.

PREVIEW ENV · CALL TABLEcontainers + snapshots
  • POSTmethod · path
    /api/v1/containers/[staging_id]/snapshots

    Capture the staging-base snapshot

    Body: [ "alias": "staging-base", "expiry": 30 ]. Returns a snapshot name like snap-20260501-093000. Run this once per main-branch deploy — every PR clone descends from the most recent capture.

  • POSTmethod · path
    /api/v1/projects/[project_id]/containers

    Clone a fresh container per PR

    Body picks server_id and a container_image; pass environment_vars to inject the PR number, branch ref, and database name. The container boots from your snapshot's filesystem, not from scratch — caches and seed data are already there.

  • DELETEmethod · path
    /api/v1/containers/[pr_container_id]

    Retire the preview when the PR closes

    One call. The container shuts down and its disk delta is reclaimed; nothing else has to be torn down. A cron entry on a 5-minute cadence handles the PRs that closed while no one was watching.

Endpoints from the Hoody Container Snapshots API and Containers API. Snapshot expiry is in days; container creation accepts environment_vars, ssh_public_key, autostart, ramdisk, and realm_ids — see the docs for the full request schema.

use-cases / preview-env-per-pr-cheap / powers

What changes when previews are free

The math stops gating reviewer behaviour. Three habits that were too expensive at $40 a preview show up by themselves once the per-PR cost is rounding error.

REVIEW VELOCITY

Reviewers click, don't pull

Nobody checks out the branch locally to repro the bug. They open the URL, click the broken thing, leave a screenshot in the PR. The review loop runs on what the code actually does, not what the diff suggests it does.

BUDGET

Idle PRs cost nothing

The fifty PRs no one is currently reviewing cost zero CPU and zero RAM. They share the staging-base snapshot's pages on disk, so even their footprint is mostly the delta. The bill is bounded by the box, not by the count of open PRs.

DESIGN & PRODUCT

Stakeholders join the loop

Your designer, your support engineer, your sales lead — anyone with the URL can poke at the PR. They were never going to git checkout a branch. With a link, they actually look at the change before it lands.

use-cases / preview-env-per-pr-cheap / compare

The dollar math, plainly

A team opening 30 PRs a month. The before number is the standard preview-environment bill. The after number is one Hoody bare-metal box that fits all 30 plus your staging.

BEFORE · VERCEL PREVIEWS, PRO TEAM

$480/mo

Per-seat Pro pricing plus build minutes plus bandwidth on a 6-engineer team running 30 PR deploys a month. Most teams cap previews at the active 10 because the next 20 cost real money.

VS
AFTER · HOODY · ONE BARE METAL BOX

$30/mo

One mid-tier server from the Hoody marketplace runs staging plus 30 PR clones plus your CI cache. Add the next sixty for $0 — copy-on-write means each clone is the snapshot's pages plus a delta.

Vercel Pro list pricing is $20/seat/month plus usage; Hoody bare-metal entry pricing starts at $29/month and varies by spec, region, and rental duration. Container density depends on workload — typical web apps pack tens to hundreds; large stateful services need more headroom.

use-cases / preview-env-per-pr-cheap / punchline

Preview environments stop being a budget item. They become the default.

before · capped at the active 10after · one per pull request
WHAT THE OLD POLICY LOOKED LIKEpreview only the loudest 10 PRsthe other twenty get a screenshot in the comment
WHAT IT LOOKS LIKE NOWevery PR · every diff · every reviewerno policy doc, no ticket asking for a preview
use-cases / preview-env-per-pr-cheap / replaces

What this replaces

Preview-environment products price per seat, per minute, or per running container. Hoody prices per server — the 30th preview costs the same as the 1st.

  • Vercel preview environments (Pro / Enterprise)Per-seat plus build minutes plus bandwidth
  • GitHub Codespaces previewsPer-hour billing whether the reviewer is looking or not
  • AWS Fargate preview tasksvCPU + memory hours per task, plus data transfer
  • Render preview environmentsPer-environment pricing, idle is not free
  • Heroku review appsOne dyno per PR, dyno-hours per review
  • Netlify deploy previews + build minutesBuild minutes meter every push, not every review
use-cases / preview-env-per-pr-cheap / cta

Snapshot once. Clone per PR. Destroy on merge. The reviewer never feels the seam.

use-cases / preview-env-per-pr-cheap / related

Read the others