

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:
- Using Codex with Northflank Skills (recommended): Install Northflank Skills and let Codex configure preview environments automatically.
- 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.
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.
Whether you use Northflank or another deployment platform, every production-ready preview environment should provide the same core capabilities.
- Automatic creation for every pull request: Opening a pull request should automatically create a new environment without requiring manual deployment.
- Isolated infrastructure: Every preview should run independently from production and other pull requests. Databases, services, and environment variables should not interfere with one another.
- Production-like configuration: Preview environments should use the same runtime, networking, dependencies, and infrastructure as production so reviewers test realistic conditions.
- Shareable URLs: Every preview deployment should generate a unique URL that developers, designers, QA engineers, and stakeholders can access without local setup.
- 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.
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.
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.
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.
From inside your Codex session, install Northflank skills:
$skill-installer https://github.com/northflank/skills/tree/master/skills/northflank

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.
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.
Here's what happens after you approve the deployment plan.
Codex creates a project, provisions a build service for your repository, and connects it to your Git provider to enable automatic builds and deployments.
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.
To verify the workflow, Codex creates a temporary branch and opens a pull request, triggering the Preview Blueprint immediately.
Once provisioning finishes, Codex verifies that the preview deployment is healthy and ready for review.

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


If you choose to configure preview environments manually, you can create the same workflow directly from the Northflank dashboard by following this guide:
Once Preview Blueprints are configured, every pull request follows the same workflow:
- A developer or Codex opens a pull request.
- Northflank detects the new pull request.
- The Preview Blueprint provisions an isolated environment.
- The application and supporting infrastructure are deployed.
- A unique preview URL is generated.
- Reviewers validate the running application.
- The pull request is merged or closed.
- 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.
Yes. Even when working alone, preview environments make it easier to validate AI-generated changes before they reach production.
Yes. Each pull request automatically provisions its own isolated preview environment.
Yes. Preview environments can provision PostgreSQL, MySQL, MongoDB, Redis, RabbitMQ, MinIO, and other project resources.
Northflank automatically deletes the preview environment and its associated infrastructure.
Yes. Simply ask Codex to modify your deployment configuration. You'll review the proposed infrastructure changes before they're applied.
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.
- How to set up CI/CD for a vibe-coded app: Build a production-ready deployment pipeline with preview environments, staging, and rollback.
- How to auto-create preview environments on every PR: Full walkthrough for setting up automatic preview environments on Northflank.
- How to vibe code securely: Security controls for vibe-coded apps: secrets management, sandbox isolation, and access controls.

