# 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 temporarily stop automatic preview creation without deleting the preview blueprint:

1. Navigate to **Environments**

2. Click on a preview blueprint

3. Click **Settings**

4. Disable triggers or remove them

5. Click **Save**

Existing preview environments will remain active, but new ones will not be created automatically.

## Delete a preview environment

Previews are automatically deleted when pull requests are closed or merged (if configured). To manually delete a preview:

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

Set policies for automatically deleting inactive previews:

1. Open a preview blueprint

2. Click **Settings**

3. Configure cleanup policies:
  
  
  
  - **Delete on pull request close**: Automatically delete when PR is closed
  
  - **Delete on pull request merge**: Automatically delete when PR is merged
  
  - **Inactivity period**: Delete previews after X days of no commits

4. Click **Save**

Automatic cleanup helps manage costs and keep your project organized.

## 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)
