← Back to Blog
Header image for blog post: How to set up preview environments for apps built with Codex
Daniel Adeboye
Published 28th July 2026

How to set up preview environments for apps built with Codex

TL;DR: how to set up preview environments for apps built with Codex

Every production-ready preview environment should include:

  • Automatic preview environments for every pull request
  • Isolated infrastructure for safe testing
  • Unique preview URLs for review and QA
  • Automatic cleanup after pull requests are merged or closed

There are two ways to set this up on Northflank:

  1. Using Codex with Northflank Skills (recommended): Install Northflank Skills and let Codex configure preview environments automatically.
  2. Configuring manually: Connect your Git repository in the Northflank dashboard and create a Preview Blueprint yourself.

What is Northflank?  Northflank is a full-stack cloud platform that deploys vibe-coded apps with production-grade infrastructure: managed databases, secrets management, TLS, CI/CD pipelines, preview environments per pull request, and BYOC into your own cloud. No infrastructure code. No DevOps background required.  Sign up to get started or book a demo.

Codex can generate production-ready applications remarkably quickly, but generating code is only one part of shipping software. Every change still needs to be tested before it reaches users.

Preview environments solve this by automatically deploying every pull request into its own isolated environment. Instead of reviewing code in GitHub alone, developers, QA engineers, designers, and stakeholders can review a live application before changes are merged.

This guide shows two ways to create preview environments for Codex-built applications on Northflank: configure everything using Northflank Skills, or build the same workflow manually through the dashboard.

Why preview environments matter for Codex projects

Codex makes it easy to build features, fix bugs, and refactor applications at high speed. As development accelerates, it's even more important to validate every change before it reaches production.

Preview environments automatically create a production-like deployment for every pull request, complete with its own infrastructure and unique URL. Teams can test features safely without affecting production or other developers' work.

What every preview environment should include

Whether you use Northflank or another deployment platform, every production-ready preview environment should provide the same core capabilities.

  1. Automatic creation for every pull request: Opening a pull request should automatically create a new environment without requiring manual deployment.
  2. Isolated infrastructure: Every preview should run independently from production and other pull requests. Databases, services, and environment variables should not interfere with one another.
  3. Production-like configuration: Preview environments should use the same runtime, networking, dependencies, and infrastructure as production so reviewers test realistic conditions.
  4. Shareable URLs: Every preview deployment should generate a unique URL that developers, designers, QA engineers, and stakeholders can access without local setup.
  5. Automatic cleanup: Once a pull request is merged or closed, the preview environment should be removed automatically to avoid unnecessary infrastructure costs.

Northflank provides these capabilities out of the box using Preview Blueprints. The only difference is how you configure them: either by asking Codex through Northflank Skills or by creating the blueprint yourself from the dashboard.

Step 1: Create a Northflank account

Sign up for Northflank. The free tier includes two services, one database, and two cron jobs with always-on compute.

Once you’re in the team dashboard, go to Integrations and connect your GitHub, GitLab, or Bitbucket account. Northflank uses this connection to pull your repository code and trigger automatic builds every time you push a change.

Step 2: Choose how you want to configure preview environments

There are two ways to set up preview environments.

  • Using Codex with Northflank Skills (recommended): Describe your infrastructure in natural language and let Codex configure it.
  • Manual configuration: Create the Preview Blueprint yourself through the Northflank dashboard.

Both approaches create the same production-ready result. The only difference is whether Codex performs the infrastructure configuration for you or you configure it manually.

Step 3A: Configure preview environments using Codex

If you're already building with Codex, Northflank Skills lets you configure preview environments without leaving your coding workflow. Instead of navigating infrastructure settings manually, you simply describe the deployment you want and review the proposed changes before they're applied.

Install Northflank Skills

From inside your Codex session, install Northflank skills:

$skill-installer https://github.com/northflank/skills/tree/master/skills/northflank

image.png

Or install it from your terminal:

npx skills add northflank/skills

Before you continue: Install the Northflank CLI and log in. Northflank Skills uses the CLI to authenticate and manage infrastructure on your behalf.

Ask Codex to create preview environments

Once Northflank Skills is installed, simply describe the workflow you want.

For example:

Create preview environments for this application on Northflank that automatically provision an isolated environment for every pull request. Generate a unique preview URL and automatically clean up each preview environment when its pull request is merged or closed. Then create a test branch and pull request so I can verify that the preview environment is working correctly.

If your application also requires databases, caches, object storage, message queues, secrets, or custom domains, include those requirements in your prompt. Codex incorporates them into the deployment plan before asking for approval.

What Codex sets up

Here's what happens after you approve the deployment plan.

1. Creates a project, build service, and connects it to your repository

Codex creates a project, provisions a build service for your repository, and connects it to your Git provider to enable automatic builds and deployments.

2. Creates a Preview Blueprint

What is a Preview Blueprint? A Preview Blueprint is a reusable infrastructure template that tells Northflank what resources should be created whenever a pull request is opened.

Codex configures the Preview Blueprint, so every pull request automatically receives its own isolated environment.

3. Opens a test pull request

To verify the workflow, Codex creates a temporary branch and opens a pull request, triggering the Preview Blueprint immediately.

4. Confirms the deployment

Once provisioning finishes, Codex verifies that the preview deployment is healthy and ready for review.

image 1.png

After the workflow completes, your Northflank dashboard and pull request will look similar to this.

image 2.png

image 3.png

Step 3B: Configure preview environments manually

If you choose to configure preview environments manually, you can create the same workflow directly from the Northflank dashboard by following this guide:

What happens after a pull request is opened

Once Preview Blueprints are configured, every pull request follows the same workflow:

  1. A developer or Codex opens a pull request.
  2. Northflank detects the new pull request.
  3. The Preview Blueprint provisions an isolated environment.
  4. The application and supporting infrastructure are deployed.
  5. A unique preview URL is generated.
  6. Reviewers validate the running application.
  7. The pull request is merged or closed.
  8. Northflank automatically removes the preview environment.

Because every pull request has its own isolated deployment, developers and AI coding agents can work on multiple features simultaneously without conflicts.

FAQ: Preview environments for Codex

Do solo developers benefit from preview environments?

Yes. Even when working alone, preview environments make it easier to validate AI-generated changes before they reach production.

Does every pull request get its own deployment?

Yes. Each pull request automatically provisions its own isolated preview environment.

Can preview environments include databases?

Yes. Preview environments can provision PostgreSQL, MySQL, MongoDB, Redis, RabbitMQ, MinIO, and other project resources.

What happens after a pull request is merged?

Northflank automatically deletes the preview environment and its associated infrastructure.

Can Codex update the Preview Blueprint later?

Yes. Simply ask Codex to modify your deployment configuration. You'll review the proposed infrastructure changes before they're applied.

Conclusion

Preview environments help teams safely ship AI-generated software by giving every pull request its own production-like deployment. Instead of relying entirely on local testing or code review, reviewers can validate real infrastructure before changes reach production.

With Northflank, you can configure Preview Blueprints using Codex through Northflank Skills or create them manually through the dashboard. Either way, every pull request automatically receives its own isolated deployment, making it easier to build, review, and ship applications with confidence.

Ready to add preview environments to your Codex workflow?

Get started on Northflank with the free tier or book a demo to see how automatic preview environments help teams safely ship AI-generated code.

Share this article with your network
X