| title | Web Preview |
|---|---|
| sidebarTitle | Web Preview |
| icon | browser |
Codegen's Web Preview feature lets you start a development server in your sandbox and view your running application directly in the Codegen interface.
Define your web server startup commands just like Setup Commands. Instead of taking a snapshot, Codegen keeps the server running as a long-lived process.
A "View Web Preview" button appears on the agent trace page once the server starts. Click it to open your running application in a new tab through Codegen's secure proxy.
You configure Web Preview commands in a manner similar to Setup Commands, likely within the same repository settings area (e.g., https://codegen.com/{your_org}/{repo_name}/settings/web-preview).
You'll provide the command(s) necessary to start your development server. Ensure that your server is configured to listen on an appropriate host (often 127.0.0.1) and a predictable port that Codegen can then expose.
The primary use case is starting a development web server:
# For a Node.js/npm project
npm run dev# For a Python/Django project
python manage.py runserver 127.0.0.1:3000# For a Ruby on Rails project
bundle exec rails server -b 127.0.0.1 -p 3000