Imagine: you open a Pull Request, the tester writes "cannot reproduce locally", and you spend an hour syncing environments. Preview Deployments solve this — an isolated environment with a unique URL is automatically created, and changes are visible immediately. We set up such environments for every PR — on Vercel, Netlify, or a server with Docker. Experience: over 5 years, dozens of projects with CI/CD for teams from 2 to 50 developers. Average time savings on reviews — 70%, number of iterations cut in half, and infrastructure costs reduced by 30% by eliminating permanent test benches.
According to Vercel, teams using Preview Deployments cut review time by 70% on average.
Benefits of Preview Deployments
Reviewers see the real interface, not screenshots. Check integrations with external services without local emulation. PMs and designers can evaluate a feature without access to code. No need to set up a local environment for each developer. For example, in a project with 10 developers, preview environments save up to 50 man-hours per month, which at an average rate of $25/hour gives $1,250 monthly savings.
Which Platform to Choose?
| Platform | Best for | Features |
|---|---|---|
| Vercel | Next.js, static sites | Preview out of the box, automatic PR comment |
| Netlify | JAMstack, Hugo | Deploy Previews by default, split testing |
| Railway / Render | Full-stack with DB | Isolated environment with separate database |
| Custom (VPS) | Docker, specific requirements | Full control, Traefik for routing |
Additional selection criteria
When choosing a platform, consider traffic costs, limits on concurrent previews, WebSockets support, and cold start time. Vercel is ideal for Next.js, Netlify for static sites, and a custom solution provides maximum flexibility.Why Preview Deployments Speed Up Reviews
The main reason is instant availability of changes. Reviewers don't need to set up the project locally, configure dependencies, or databases. They just open the URL. This is especially critical for microservice architectures where a local environment can weigh gigabytes. In one project with 20 microservices, review time dropped from 2 hours to 15 minutes — an 8x improvement.
How to Implement a Custom Solution on VPS
Step-by-step process:
-
Server setup: Install Docker, Traefik, and create a wildcard DNS record
*.preview.example.com. - GitHub Actions workflow: On PR open, build Docker image, push to registry, deploy via SSH.
-
Traefik labels: Each container gets a label for routing by subdomain
pr-123.preview.example.com. - PR comment: Workflow automatically posts the preview link.
Example workflow:
# .github/workflows/preview.yml
name: Preview Deployment
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: |
docker build -t app:pr-${{ github.event.pull_request.number }} .
- name: Deploy to preview server
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.PREVIEW_SERVER_HOST }}
username: deploy
key: ${{ secrets.PREVIEW_SSH_KEY }}
script: |
docker pull registry.example.com/app:pr-${{ github.event.pull_request.number }}
docker stop app-pr-${{ github.event.pull_request.number }} || true
docker run -d --name app-pr-${{ github.event.pull_request.number }} \
-p 0:3000 \
--label traefik.enable=true \
--label "traefik.http.routers.pr-${{ github.event.pull_request.number }}.rule=Host(\`pr-${{ github.event.pull_request.number }}.preview.example.com\`)" \
registry.example.com/app:pr-${{ github.event.pull_request.number }}
- name: Comment PR with preview URL
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Preview: https://pr-${context.issue.number}.preview.example.com`
})
Traefik automatically routes traffic to the correct container by subdomain. The entire process from push to ready link takes no more than 5 minutes.
Managing Databases for Preview Environments
- Shared read-only database — fast, but cannot test writes.
- Separate database per PR — full isolation, requires resources. Neon (PostgreSQL) supports database branching: creates a DB branch instantly via copy-on-write.
- Seeded in-memory database — SQLite or PostgreSQL with fixed test data.
For a team of 10 developers, we recommend Neon: a DB branch is created in seconds, and cost is lower than spinning up a separate instance per PR. Inactive branches are not billed. This saves up to 40% of the test database budget.
Cleaning Up Outdated Environments
When a PR is closed, a workflow runs to stop and remove the container:
on:
pull_request:
types: [closed]
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Remove preview deployment
uses: appleboy/ssh-action@v1
with:
script: |
docker stop app-pr-${{ github.event.pull_request.number }}
docker rm app-pr-${{ github.event.pull_request.number }}
You can also set up a cron job to clean up stale environments older than N days. This prevents server clutter and saves resources.
What's Included in the Work
- Audit of your current CI/CD and stack.
- Designing the architecture of preview environments (routing, DB, isolation).
- Implementation of CI/CD workflows (GitHub Actions, GitLab CI, or equivalent).
- Configuration of Traefik or an alternative reverse proxy.
- Integration of database branching (Neon) if needed.
- Documentation of the process and team training.
- 1 month of technical support after deployment.
Process of Work
- Analysis — study your stack and CI/CD, determine the optimal platform.
- Design — prepare environment architecture, routing scheme, database strategy.
- Implementation — configure CI/CD, write workflows, set up Traefik.
- Testing — verify creation and cleanup of previews, load testing with concurrent PRs.
- Deployment — roll out to production, hand over documentation, and conduct team training.
How Long Does It Take?
| Type | Timeline |
|---|---|
| Vercel / Netlify (out of the box) | 0.5 days |
| Custom solution (Docker + Traefik) | 2–3 days |
| Adding database branching (Neon) | +1 day |
Exact timelines are calculated after auditing your repository. The cost is fixed in the contract and does not change during the process. Get a consultation — we'll discuss your project and choose the optimal solution. Contact us to start saving your team's time on reviews.
Learn more about Continuous deployment on Wikipedia.







