TL-M0-21 · The Vercel project for apps/web, pointed at staging
Why: apps/web is hosted on Vercel, with its functions in Singapore next to the database (D5). This step makes the one Vercel project v2 will use. Until cutover it points at staging, so the team can sign in against staging's data: production and every preview read staging's URL and publishable key. Cutover changes the production values to the production project; nothing else in this step changes then.
It needs a Pro team: Vercel's Hobby plan doesn't deploy a repository owned by a GitHub organization, and Opleettop/monorepo is one. Deployment Checks hold each production deployment until CI's checks job has passed on its commit, so a merge whose checks fail never reaches the production address (D28). Everything here is set by hand in the dashboard (L0); the project's settings are not in the repository.
ID TL-M0-21 · Level L0 · Run order row 33 · Issue #23
A Vercel project named opleet-web, in a Pro team, deploys apps/web from main on Node 24 with pnpm 12.8.1. Its functions run in Singapore (sin1), and production and previews read staging's URL and publishable key. A production deployment reaches the production address only after the checks job passes on its commit. Previews need a Vercel sign-in. An E2E login signs in on the production address, and staging's Auth Site URL is that address.
Before
Section titled “Before”- Row 31, TL-M0-20, is Done. The password manager entry "Opleet v2 staging" holds the project ref and the publishable key, which starts with sb_publishable_.
- Row 32, BE pack F (#22), is Done, so staging has the schema and the E2E logins. If it isn't, run blocks 1 to 8 now, and block 9 once it is.
- .env.e2e exists from BE-M0-25, with E2E_PASSWORD and an E2E_ADMIN_EMAIL line.
- A payment card at hand: Vercel Pro is $20 a month for each member, and this team has one, you.
- You own the Opleettop organization on GitHub, so you can install a GitHub app on it.
- You are in ~/opleet-v2/opleet on main, up to date, and
git status --shortprints nothing. The latest commit on main has a green checks job.
1 · A Pro team
Section titled “1 · A Pro team”In the browser: vercel.com, sign in (with GitHub is simplest), then the team switcher at the top left › Create Team.
- Team name: Opleet. Keep the slug it suggests.
- Plan: Pro. Enter the card.
If you already have a Pro team you want v2 in, use it and skip this block. Below, every page is inside this team.
2 · Vercel for GitHub, on this one repository only
Section titled “2 · Vercel for GitHub, on this one repository only”In the team: Add New › Project › Import Git Repository › GitHub. When GitHub asks where to install Vercel:
- Account: Opleettop.
- Repository access: Only select repositories › Opleettop/monorepo. Not "All repositories".
- Install.
You land back on Vercel's import page, with Opleettop/monorepo in the list.
3 · Import apps/web, with the three environment variables, then deploy
Section titled “3 · Import apps/web, with the three environment variables, then deploy”Select Import beside Opleettop/monorepo, then fill in the form:
- Project Name: opleet-web.
- Framework Preset: Next.js.
- Root Directory: Edit › apps/web › Continue.
- Build and Output Settings: leave every Override off. Vercel runs
next buildin apps/web. - Environment Variables: add these three. The publishable key is public by design (D13); the secret key never goes to Vercel, and apps/web refuses one that starts with sb_secret_.
| Key | Value |
|---|---|
NEXT_PUBLIC_SUPABASE_URL |
https://<STAGING_PROJECT_REF>.supabase.co |
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY |
<STAGING_PUBLISHABLE_KEY>, pasted from the password manager |
ENABLE_EXPERIMENTAL_COREPACK |
1: Vercel then installs with the pnpm that package.json pins (12.8.1), not its own |
Select Deploy and wait for it to finish, two or three minutes. Below, <VERCEL_URL> is the production address the project page shows under Domains, such as opleet-web.vercel.app. If the name was taken, Vercel adds a few characters.
4 · Check where the variables apply
Section titled “4 · Check where the variables apply”Settings › Environment Variables. Each of the three must apply to Production and Preview. Development can stay off: nobody runs vercel dev. If one shows only Production, open it with Edit, tick Preview too, and save.
5 · Node 24 and Singapore
Section titled “5 · Node 24 and Singapore”- Settings › Build and Deployment › Node.js Version: 24.x. Save. (D25 pins Node 24. The root package.json's engines doesn't reach Vercel, because the Root Directory is apps/web.)
- Settings › Build and Deployment › Root Directory: apps/web, with "Include files outside the root directory in the Build Step" on. apps/web reads packages/db-types from the workspace. Leave "Skip deployment" off.
- Settings › Functions › Function Regions: select Singapore (sin1) and deselect every other region, Washington, D.C. (iad1) included. Save.
6 · Previews behind a Vercel sign-in, production open to its own login page
Section titled “6 · Previews behind a Vercel sign-in, production open to its own login page”Settings › Deployment Protection › Vercel Authentication: on, with Standard Protection. Save if you changed anything.
Previews and deployment addresses then need a Vercel login with access to this team, which today is only you. The production address stays open, because v2 has its own login page and staff have no Vercel account.
7 · Deployment Checks on CI's checks job
Section titled “7 · Deployment Checks on CI's checks job”- Settings › Environments › Production: automatic aliasing for production (the setting that assigns new production deployments to the production domains) is on. It is by default.
- Settings › Build and Deployment › Deployment Checks › Add Checks. Choose GitHub as the provider, search for
checks, and select the check named exactly checks (CI's job,.github/workflows/ci.yml). Not pr-title, not database: database is skipped on most changes. Save.
8 · Redeploy with the settings, and read the build log
Section titled “8 · Redeploy with the settings, and read the build log”Deployments › the latest Production deployment › the ⋯ menu › Redeploy. Leave "Use existing Build Cache" off and confirm. Open the new deployment's Build Logs while it runs.
9 · Staging's Site URL, then sign in as an E2E login
Section titled “9 · Staging's Site URL, then sign in as an E2E login”In the Supabase dashboard, project opleet-v2-staging: Authentication › URL Configuration.
- Site URL:
https://<VERCEL_URL>. Save. - Redirect URLs: Add URL ›
https://<VERCEL_URL>/**. Save.
Password sign-in doesn't use them; admin invites will (OQ2). Then copy the admin login's email and password without printing the password:
grep '^E2E_ADMIN_EMAIL=' .env.e2esed -n 's/^E2E_PASSWORD=//p' .env.e2e | tr -d '\n' | pbcopyIn a private browser window, open https://<VERCEL_URL>. Sign in with that email and paste the password. Then sign out with Keluar, and run pbcopy < /dev/null to clear the clipboard.
Expect
Section titled “Expect”- Block 2: GitHub shows "Only select repositories" with monorepo, and Vercel lists Opleettop/monorepo.
- Block 3: the first deployment ends Ready, and the project page shows <VERCEL_URL> under Domains. The variables can't change this build; block 8 rebuilds with every setting in place.
- Block 4: three variables, each applying to Production and Preview.
- Block 5: each page shows the value you set after saving. Function Regions lists sin1 only.
- Block 7: Deployment Checks lists one GitHub check, checks.
- Block 8: the build log says it found a pnpm-lock.yaml and uses pnpm 12.8.1, with no line about Corepack ignoring packageManager. It runs
next buildwithout errors and ends with "Deployment completed". The deployment's Deployment Checks show checks passed (it already passed on this commit), and the deployment becomes the Current production deployment. - Block 9: the sign-in page in Indonesian, then the app's home page after signing in, then the sign-in page again after Keluar.
Replace <VERCEL_URL> first.
curl -s -o /dev/null -w '%{http_code}\n' "https://<VERCEL_URL>/login"gh api "repos/Opleettop/monorepo/commits/$(git rev-parse HEAD)/check-runs" --jq '.check_runs[] | select(.name=="checks") | .conclusion'- The first prints 200: the production address is open to its own login page.
- The second prints success: CI's checks job passed on main's latest commit, which Vercel waited for.
- In the dashboard, the Current production deployment's page, under Deployment Summary, lists its functions in sin1 only.
On the next merge to main, open Deployments while CI runs: the new production deployment shows its Deployment Checks as pending and the production address still serves the previous one. It is promoted once the checks job passes. On the next pull request, Vercel comments a preview address; opening it in a private window asks for a Vercel sign-in. Log both on #23.
If it fails
Section titled “If it fails”- Block 2 or 3 says the repository can't be deployed on the Hobby plan, or asks you to upgrade: you are in your personal account, not the Pro team. Switch to the team at the top left and import again.
- Block 8's build uses pnpm 10, or fails with "Cannot find module" under corepack: Vercel's Corepack didn't run pnpm 12.8.1. Paste the first 40 lines of the build log into #23, then try this once: delete
ENABLE_EXPERIMENTAL_COREPACK, and in Settings › Build and Deployment › Install Command turn Override on withnpm install -g pnpm@12.8.1 && pnpm install --frozen-lockfile. Redeploy as in block 8. Tell a CTO session what happened either way, so this page records the setting that worked. - The build fails with "Set NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": a variable is missing from Production. Block 4 again, then block 8.
- The build fails with "holds a secret key": the secret key was pasted. Replace it with the publishable key (sb_publishable_), redeploy, and rotate staging's secret key in Supabase (Project Settings › API Keys), because it has been in Vercel's settings.
- The build fails with a type error or "Module not found" for @opleet/db-types: "Include files outside the root directory" is off. Block 5, then block 8. Anything else: paste the end of the build log into #23. main builds in CI, so it is likely a project setting.
- The Deployment Summary lists iad1: the region didn't save, or the deployment predates it. Block 5's Function Regions, then block 8.
- Block 7 finds no check named checks: the search needs a recent run on the repository. Open a commit on main in GitHub to see that the checks job ran, then search again.
- The next merge goes live before its checks job finishes: Deployment Checks aren't holding it. Check block 7's two settings, and ask in #23 before the next merge.
- Block 9 says the email or password is wrong: BE-M0-30 hasn't made the staging logins, or .env.e2e is from another run. Check #22 first.
- The project: Settings › Advanced › Delete Project. The production address stops working.
- The GitHub app: github.com/organizations/Opleettop/settings/installations › Vercel › Configure › Uninstall.
- The team, if it was made here: Team Settings › Advanced › Delete Team, which also ends the Pro subscription.
- Staging's Auth URLs: set the Site URL back to
http://localhost:3000and remove the redirect URL.
Log each run as a comment on #23: the date, what you ran, the build log's pnpm and Node lines, the two Check lines and the region the Deployment Summary lists.