Dev Testing¶
Preview Deployments¶
When you open a PR against staging or main in an enabled repo, a live preview of your branch is automatically deployed. You get a unique URL to test your changes against the shared staging database — no local setup needed.
How it works¶
- Open or update a PR targeting
stagingormain - A bot comments: "Preview deployment triggered..."
- Your branch is built and deployed (~5–6 minutes)
- Once ready, the bot posts the preview URL as a PR comment
- When the PR is closed or merged, the preview is automatically torn down
What you need¶
- Your repo must be enabled for previews (via
auto-prrepo) - Your repo must have a
Dockerfileat the root - The PR must target
stagingormain(PRs fromstagingtomainare excluded)
Redeployments¶
Every push to the PR branch triggers a redeploy automatically. The URL may stay the same — but best to take the latest one you get on PR comment.
Things to know¶
- Previews share the staging database — they don't have isolated data
- If a deployment fails, the bot posts a comment with a link to the build logs
- Only one deployment runs per PR at a time — rapid pushes cancel the previous build
Custom Backend Override¶
You can point the frontend to a custom backend by adding ?be=<url> to any page URL. The override is stored in sessionStorage and persists across navigations within the same tab. Closing the tab clears it.
Because it's tab-scoped, two tabs can hold two different backends at once — useful for comparing two backend PRs against the same frontend.
The override is applied before the app makes its first request, so it takes effect on the very first load. That includes the logged-out case: the login redirect keeps ?be= and returns you to the same URL afterwards.
Usage¶
Dev / staging / preview environments:
http://localhost:3000/?be=https://preview-studio-backend-pr-42.preview-dev.scenarix.ai
Production hostnames (app.studiojadu.com, studio-internal.scenarix.ai) — requires a secret key param beKey:
https://app.studiojadu.com/?be=https://custom-backend.com&beKey=<secret>
Environment Variables¶
| Variable | Description |
|---|---|
NEXT_PUBLIC_BE_PROD_HOSTS |
Comma-separated hostnames where the override key is required (e.g. app.studiojadu.com,scenarix-internal.scenarix.ai) |
NEXT_PUBLIC_BE_OVERRIDE_KEY |
Secret key required for override on production hostnames |
NEXT_PUBLIC_BE_ALLOWED_HOSTS |
Comma-separated backend hostnames allowed as override targets (e.g. localhost,my-staging.aws.com). If not set, any host is allowed |
Override Indicator¶
When a custom backend is active, an orange badge appears at the bottom-left of the page. Click the × button on the badge to remove the override.
No badge means no override — you're on the default backend. Check the URL, and check that the host is covered by NEXT_PUBLIC_BE_ALLOWED_HOSTS if that variable is set, since hosts outside the list are rejected.
Which Deployment Wrote an Activity¶
Previews don't have isolated data, so activity you generate while testing lands in the same projectActivities collection as real usage. Every row written by a non-production backend now records the deployment that served the action:
"metadata": {
"origin": "manual_ui",
"testSource": {
"backendUrl": "https://preview-studio-backend-pr-42.preview-dev.scenarix.ai",
"environment": "preview"
}
}
| Field | Meaning |
|---|---|
backendUrl |
The backend that handled the request — i.e. the ?be= target you were testing against |
environment |
preview, staging or local |
Production rows carry no testSource at all, so its absence means production.
This is stamped automatically on every activity, whether the action came from the UI or from a guru/AIDA tool — nothing to pass or enable.
Putting it Together¶
A typical workflow for testing a backend PR against the frontend:
- Push your backend changes and open a PR to
staging - Wait for the preview deployment URL from the bot comment
- Open the frontend (local or staging) with the backend override:
http://localhost:3000/?be=https://preview-studio-backend-pr-42.preview-dev.scenarix.ai - Test your changes end-to-end
- When done, close the tab (clears the override) or click the × on the orange badge