How to Run the Stack Locally
The local setup is not "clone and npm run dev" — fan login round-trips through real
Ticketmaster, and two vendor libraries refuse to load on bare localhost. This guide is the
workflow the team actually uses.
Use this when: setting up a machine for the first time, or when login / the 3D map / the address autocomplete mysteriously fails on local.
The two problems, and the two tools
- TM auth redirects to production. The fan app's login sends you to
auth.ticketmaster.comwithredirect_uri=https://flex.attendevents.com/tmcallback/<schema>— the production URL, always. Without help, every local login ends on prod. → Requestly (Chrome extension) rewrites that redirect back to your local host. - Whitelisted vendor libraries. The TK3D 3D venue map and the Google address API (checkout)
are whitelisted to
seasonshare.com-style domains — onlocalhostthey render blank. → the frontends run behind a virtual host,www.flex3.seasonshare.com:3700, so the browser thinks you're on a whitelisted domain.
Setup, step by step
1. Env files
Get the current env files for both frontend and backend of each app from the engineering
channel. Frontends use .env.local — Next.js insists on that exact filename. The same bundle
contains the dev RDS credentials for DBeaver.
Before testing anything, check which backend your frontend points at — it ships pointing at a
deployed URL, and it's an easy trap to "test locally" while actually hitting the production
backend. For local work it should be http://localhost:5011 (Flex/Premium) or
http://localhost:3001 (Cortex).
2. Requestly rules
Create one Redirect Request rule per product (they could share one rule, but separate rules give you a per-product on/off toggle; the free tier allows five). In Requestly:
- New Rule → Redirect Request.
- Set the source to URL + RegEx, and paste the pattern from the table below.
- Under Redirects to, choose Another URL and paste the local target.
- Save and make sure the rule's toggle is on.
| Schema kind | Source (URL · RegEx) | Redirect to (Another URL) |
|---|---|---|
| Flex schemas | /^https:\/\/flex\.attendevents\.com(\/.*_flex.*)$/ | http://www.flex3.seasonshare.com:3700$1 |
| Premium schemas | /^https:\/\/flex\.attendevents\.com(\/.*_premium.*)$/ | http://www.flex3.seasonshare.com:3800$1 |
Flex and Premium are separate local apps on separate ports (3700 / 3800), so they need one rule
each, keyed on the schema segment of the callback path. Requestly uses RE2, which has no
negative lookahead — so match the schema name positively (…_flex… → 3700, …_premium… → 3800)
rather than "everything except premium." The $1 back-reference preserves the path + query that
carries the TM auth code back to your local app.
3. Run the apps
| App | Command | Note |
|---|---|---|
| Backends | npm run start:dev | nothing special |
| Flex frontend | sudo npm run dev | sudo is for the virtual-host server (binding the seasonshare hostname). Windows: run the terminal as Administrator — plain PowerShell fails with permission errors |
| Premium frontend | sudo PORT=3800 npm run dev | Premium runs on :3800 (Flex is :3700). PORT=3800 takes effect because the virtual-server reads process.env.PORT — the -p 3700 in its dev:server script is inert/cosmetic. The shared .env already lists http://www.flex3.seasonshare.com:3800 in CORS_ORIGIN; just verify it's there (add only if missing) so Premium can reach the shared backend |
Then open http://www.flex3.seasonshare.com:3700/<schema>/events_home — not localhost:3700;
the backends' CORS only allows the virtual-host origin.
4. Log in
Click LOG-IN → real Ticketmaster → sign in with the sandbox account → TM redirects to the prod
callback URL → Requestly bounces it to your local host → the local backend exchanges the code →
you're authenticated locally. If TM blocks the token exchange from your machine, use
bypass auth instead (BYPASS_AUTH_ENABLED=true + BYPASS_EMAIL/BYPASS_ACCOUNT_ID,
remembering the account ID is per-DSN — see
Environments & Sandboxes).
Troubleshooting
| Symptom | Usual cause |
|---|---|
| 404 on the fan app | schema isn't in the backend's whitelist, or a stale default URL path — try <schema>/events_home |
| "Resource not found" with data you know exists | frontend pointing at the wrong backend (check .env.local) |
| Login lands on production | Requestly rule disabled (check the toggle) or not matching (test with a ?code=ruletest URL) |
| 3D map / address autocomplete blank | you're on localhost instead of the virtual host |
| Frontend won't start, EACCES | forgot sudo (mac) / Administrator (Windows) |
| Sandbox purchase fails oddly | check the SS event dates — the Archtics sandbox drifts (SS1 was once in the past) |
See also
- Environments & Sandboxes — why sandbox works this way, test cards, bypass auth
- How to onboard a new team — the next step once the stack runs