# Manage preview blueprints

Preview blueprints create ephemeral environments for testing pull requests and branches. Manage active previews, manually create test environments, and configure automatic cleanup.

## View preview environments

1. Navigate to **Environments** in your project

2. Preview environments appear in the **Previews** section

3. Each preview shows:
  
  
  
  - Available metadata (e.g. pull request ID, branch name)
  
  - Status (running, building, failed)
  
  - Created date

Click on any preview to view its resources and access URLs.

## Create a preview environment manually

You can create a preview environment without waiting for a Git trigger:

1. Navigate to **Environments**

2. Click on a preview blueprint

3. Click **Run**

4. Select a commit or branch

5. Click **Create**

This is useful for testing branches before creating pull requests or setting up demo environments.

![Running a preview blueprint in the Northflank application](https://assets.northflank.com/documentation/v1/application/getting-started/set-up-environments/run-preview-blueprint.png)

## Access preview services

Each preview environment has unique URLs for accessing deployed services:

1. Click on a preview environment

2. View the **Services** section

3. Click on a service to see its URL

Preview URLs typically follow the pattern: `service-name-pr-123.project.northflank.app`

## Update a preview environment

Previews automatically update when new commits are pushed to the pull request branch or watched branch.

To manually trigger an update:

1. Click on the preview environment

2. Click **Run**

3. Select the new commit

4. Click **Create**

The preview will rebuild and redeploy with the latest code.

## Pause preview triggers

You can pause individual triggers without deleting the preview blueprint.

To pause one trigger:

1. Open the blueprint editor.

2. Open the trigger's form.

3. Turn off Enable trigger.

4. Save the trigger.

5. Save the blueprint.

Pausing a trigger does not delete environments or cancel runs. Manual preview runs remain available. Skipped trigger events are not replayed when you resume.

[Automatic cleanup](#configure-automatic-cleanup) still applies while triggers are paused.

## Delete a preview environment

Northflank can [delete previews automatically](#configure-automatic-cleanup). To delete a preview manually:

1. Click on the preview environment

2. Click **Delete**

3. Confirm the deletion

All resources created by the preview (services, databases, volumes) are permanently deleted.

## Configure automatic cleanup

Use [preview expiry](set-up-preview-blueprints#cleanup-policies) to delete previews automatically after a configured lifetime. The expiry timer can reset each time the preview runs again. This also applies to scheduled previews.

Git providers can also request preview deletion when a pull request closes or its branch is deleted. Pausing triggers does not stop preview expiry or deletion from Git events.

To remove a preview sooner, [delete it manually](#delete-a-preview-environment).

## Preview environment resources

Each preview environment can include:

- **Services**: Deployment services running your application code

- **Databases**: Addons like PostgreSQL, MongoDB, or Redis

- **Jobs**: Background tasks or one-time operations

- **Volumes**: Persistent storage

- **Secret groups**: Environment variables and configuration

All resources are isolated to the preview environment and deleted when the preview is deleted.

A default tag is automatically added to each preview environment. Secret groups scoped to this tag are made available only within the preview environment by default.

## Manage preview costs

Preview environments consume resources and incur costs. To manage costs:

- Use smaller resource plans for previews than production

- Enable automatic cleanup for closed pull requests

- Set maximum concurrent preview limits

- Delete unused previews manually

- Review preview resource usage regularly

## Troubleshoot preview environments

**Preview failed to create:**

Check the run logs for errors. Verify build configuration and resource availability.

**Preview URL not accessible:**

Check service port configuration, networking settings, and deployment status.

**Preview not updating on new commits:**

Verify Git trigger is configured correctly and webhook settings in your Git provider are active.

**Preview environment costs too high:**

Reduce resource plans, enable automatic cleanup, avoid running too many previews concurrently, or configure your Git triggers to watch fewer pull requests.

## Next steps

- [Configure a workflow: Learn how to use the visual editor or code to configure a workflow.](/v1/application/release/configure-workflows)
- [Run and manage workflows: Run and manage workflows for different environments.](/v1/application/release/run-and-manage-workflows)
- [Run migrations: Run database migrations and update your deployments simultaneously when you update your schema.](/v1/application/release/run-migrations)
