Laravel Tutorials

The Practical Guide to Laravel + Nova on OpenAI Codex Web

Published
The Practical Guide to Laravel + Nova on OpenAI Codex Web image

Scripts, screenshots, and gotchas for secure private Composer auth in Codex environment containers.

OpenAI Codex is a popular CLI tool, but did you know that it also has a web tool?

Why this guide?

Private packages (like Laravel Nova) need credentials at install time. On Codex Web, secrets are only exposed during the Setup phase. If you try to install Nova later, auth won’t be available and Composer will 401. This guide shows a battle‑tested structure you can copy for your Laravel project.

✅ Works for any private Composer source (e.g., self‑hosted Satis/Private Packagist) — just swap the domain and credentials in the Composer config lines.

The Codex web UI isn’t clunky at all. Quite straightforward to use.

Here’s the practical, “what goes where” difference on Codex Web:

  • Setup script *→ runs when Codex builds a fresh environment container (and when it warms the cache). Use it to install toolchains, OS packages, language runtimes, and project dependencies; do one‑time project bootstrapping. Secrets are available only here.
  • Maintenance script → runs when Codex resumes an environment container from cache (e.g., on follow‑ups within ~12 hours) to bring your workspace up‑to‑date for the current commit/branch: pull latest deps, rebuild artifacts, run light migrations, etc. It’s optional but saves you from re‑doing heavy installs.

When does each run?

  • Fresh task or cache warm: setup runs, and the resulting container state is cached for up to ~12 hours.
  • Follow‑up task using that cache: maintenance runs to reconcile the container with the current code. Cache resets if you change setup/maintenance scripts, env vars, or secrets.
It runs perfectly!

Quick rules of thumb

  • Put heavy installs & one-time bootstraps in setup; put incremental updates in maintenance.
  • Any work needing secrets must happen in setup; they’re not available afterward.

Part 1 — Installing Laravel Nova (or any private Composer package)

1) Add secrets in Codex Web

Create two secrets in your environment:

  • NOVA_USERNAME
  • NOVA_LICENSE_KEY
This assumes you use a private Composer registry like Satis (which is what Laravel Nova uses)

If it isn’t already obvious, don’t commit these values to your repo. Codex will decrypt and expose them only while Setup runs.

2) Authenticate Composer & install deps in Setup script

Add this to your environment’s Setup script:

# [Rest of your setup scripts]
 
# Authenticate to Nova using secrets exposed to setup scripts
composer config "http-basic.nova.laravel.com" " $NOVA_USERNAME " " $NOVA_LICENSE_KEY "
 
# Install PHP deps (no-dev typical for CI/agent use; tweak as you need)
composer install --no-interaction --optimize-autoloader --no-dev

3) Keep Maintenance script light

Maintenance doesn’t have access to secret values; it’s for quick refreshes only:

pnpm run build
cp .env.example .env
sed -i 's/^DB_CONNECTION=.*/DB_CONNECTION=sqlite/' .env
php artisan key:generate
php artisan migrate --force
php artisan cache:clear
php artisan optimize

Part 2 — The end result: your Codex Web environment container (Laravel)

Below is the final shape we aim for — all Nova auth and Composer install happen in SetupMaintenance is a quick Laravel refresh.

This gives your coding agent runs a good slate to start with

Part 3 — Security & reliability tips

Automated tests are never a bad idea.
  • Never commit auth: keep Nova credentials (or any private registry auth) in Secrets only.
  • Use branch protection rules: Lock down your master/main branch and ensure safeguards are in place to prevent a rogue agent from pushing to it directly.
  • Create an AGENTS.md file: Set up a some guardrails and put sensible rules like “Create a unit tests for every component you introduce” or “Run the entire suite suite once you’re done”.
  • Use GitHub Action workflows: Run your linters and unit/integration/E2E tests in the CI on every push to vet reliability of AI-generated code.
  • Composer hygiene: --prefer-dist reduces source downloads; --no-interaction avoids prompts; consider COMPOSER_MEMORY_LIMIT=-1 if you hit OOM in large repos.
  • Pin versions: lock images/tools when reproducibility matters.
  • Don’t rely on .rc files for persistence: environment containers are ephemeral; rerun any required exports within Setup or use absolute paths.
  • Make Maintenance idempotent: it should be safe to run multiple times without changing state unexpectedly.

Part 4 — I’ll leave that bit to you

So far I’ve only been using Codex web to make small cosmetic changes on the fly. It hooks up really nicely with GitHub and if you have a GitHub Copilot subscription, you can even have it auto-review the code that Codex generates. Pretty fun tandem.

Codex can review code, but it’s even better

Enjoy!

JP Caparas photo

Codex Ambassador @ OpenAI. I write technical explainers with a hint of humour and a dash of cynicism. Subscribe now for daily updates.

Sponsored

tinkerwell logo
Tinkerwell

Enjoy coding and debugging in an editor designed for fast feedback and quick iterations. It's like a shell for your application – but with multi-line editing, code completion, and more.

Visit Tinkerwell

The latest

View all →
CPX: The Composer Package Executor for PHP image

CPX: The Composer Package Executor for PHP

Read article
Laravel AI SDK Adds Human-in-the-Loop Tool Approval image

Laravel AI SDK Adds Human-in-the-Loop Tool Approval

Read article
Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals image

Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals

Read article
Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs image

Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs

Read article
Blade Formatting in Laravel Pint image

Blade Formatting in Laravel Pint

Read article
Inertia DevTools Is Now on the Chrome Web Store image

Inertia DevTools Is Now on the Chrome Web Store

Read article