Set Up Preview Deployments

Preview deployments give every branch its own URL. When a developer pushes to a feature branch, Temps automatically deploys it to a unique subdomain so the team can test changes before merging.


What you will achieve

  • Automatic deployments for every branch
  • A unique URL per branch (e.g. myproject-feature-login.your-server.com)
  • Environment variables scoped to previews
  • Automatic cleanup when branches are deleted

Time required: 5 minutes.

Prerequisites:

  • A project deployed on Temps with a Git provider connected
  • A production environment already working

How preview environments work

Temps creates a preview environment for each branch that receives a push. Each preview environment:

  • Has its own deployment — independent from production
  • Gets a unique subdomain: {project-slug}-{branch-slug}.{your-temps-domain}
  • Inherits environment variables marked with "Include in preview"
  • Runs its own container (for server deployments) or serves its own static files

When you push to a branch, Temps checks if a preview environment exists for that branch. If not, it creates one. Then it deploys the latest commit.

main branch       → production environment → app.example.com
feature/login     → preview environment    → myproject-feature-login.temps.example.com
fix/header-bug    → preview environment    → myproject-fix-header-bug.temps.example.com

Step 1: Enable preview deployments

  1. Open your project in the Temps dashboard
  2. Go to Settings
  3. Find Preview Deployments and enable the toggle

That is the only configuration needed. Temps now creates preview environments automatically when you push to any branch other than the main production branch.


Step 2: Push to a branch

Create a feature branch and push it:

git checkout -b feature/new-dashboard
# Make your changes
git add .
git commit -m "Add new dashboard layout"
git push origin feature/new-dashboard

Temps receives the push webhook from your Git provider, creates a preview environment for the feature/new-dashboard branch, copies eligible environment variables, and starts a deployment.


Step 3: Access the preview

The preview URL follows this pattern:

{project-slug}-{branch-slug}.{your-temps-domain}

For example, if your project slug is myapp and the branch is feature/new-dashboard, the preview is accessible at:

https://myapp-feature-new-dashboard.temps.example.com

Find the exact URL in the Temps dashboard under your project's Environments tab. Each preview environment is listed with its URL and deployment status.


Environment variables in previews

When a preview environment is created, Temps copies variables from your project that have Include in preview enabled (this is the default for new variables).

What to include

VariableInclude in preview?Why
VITE_API_URLYesFrontend needs API access
DATABASE_URLDependsUse a staging database, not production
STRIPE_SECRET_KEYNoNever use production payment keys in previews
LOG_LEVELYesSafe to share
SENTRY_DSNYesErrors from previews are useful to track

Using a different database for previews

If your preview environments should use a separate database, create the variable scoped only to preview environments (or create a separate staging database and assign it to preview environments):

  1. Set DATABASE_URL with Include in preview disabled for production
  2. Create a separate DATABASE_URL scoped to your preview/staging environments pointing to a staging database

Creating environments manually

You can also create environments manually for long-lived branches like staging or develop:

  1. Go to your project > Environments
  2. Click New Environment
  3. Enter a name (e.g. staging)
  4. Select the branch (e.g. develop)
  5. Configure replicas and resource limits (optional)

Manual environments work identically to auto-created preview environments but are not deleted when the branch is removed.

Per-environment overrides

Each environment can override these project-level settings:

  • Name
    branch
    Type
    string
    Description

    The Git branch this environment tracks.

  • Name
    replicas
    Type
    integer
    Description

    Number of container instances. Default: 1.

  • Name
    exposed_port
    Type
    integer
    Description

    Override the container port. Default: auto-detected from EXPOSE directive.

  • Name
    automatic_deploy
    Type
    boolean
    Description

    Whether pushes to the branch trigger automatic deployments. Default: true.

  • Name
    cpu_limit
    Type
    string
    Description

    CPU limit for containers (e.g. 500m, 1000m).

  • Name
    memory_limit
    Type
    string
    Description

    Memory limit for containers (e.g. 256Mi, 512Mi).


Team workflow

A typical workflow with preview deployments:

  1. Developer creates a feature branch and pushes changes
  2. Temps deploys the branch to a preview URL
  3. Developer shares the URL in the pull request or team chat
  4. Reviewers test the feature on the preview deployment
  5. If changes are needed, the developer pushes again — Temps redeploys the preview automatically
  6. Once approved, the PR is merged to main
  7. Production deploys the merged changes
  8. The preview environment can be cleaned up (manually or when the branch is deleted)

Webhooks for preview events

Temps can notify external systems when deployments happen. Set up outbound webhooks to notify Slack, Discord, or any URL when a preview deployment succeeds or fails:

  1. Go to Settings > Webhooks
  2. Add a webhook URL
  3. Select events: deployment.succeeded, deployment.failed, deployment.ready

Webhook payloads include the project name, branch, commit SHA, commit message, and deployment status — enough information to post a meaningful notification.

Available deployment events:

  • deployment.created — A deployment was queued
  • deployment.succeeded — The deployment completed and is healthy
  • deployment.failed — The deployment failed (build error, health check timeout, etc.)
  • deployment.cancelled — The deployment was manually cancelled
  • deployment.ready — The deployment is live and receiving traffic

Troubleshooting

Preview not created after push

  • Verify that Preview Deployments is enabled in project settings
  • Check that the push is to a branch other than the main production branch
  • Verify the Git webhook is configured correctly — check your Git provider's webhook delivery logs

Preview URL shows 404

  • The deployment may still be in progress — check the Environments tab for deployment status
  • DNS may not be configured for the preview subdomain pattern. If you use a custom domain, ensure a wildcard DNS record (*.temps.example.com) points to your Temps server

Variables missing in preview

  • Check that the variable has Include in preview enabled
  • Variables are copied when the preview environment is first created. If you add a new variable later, it is not automatically added to existing preview environments — add it manually to the preview environment or recreate it

What to explore next

Set up CI/CD Manage environment variables Add a custom domain Add analytics

Was this page helpful?