Ns web deploy

From Melvynx/saveit.now · View interactive version

Ns web deploy is an AI agent skill from the GitHub repository Melvynx/saveit.now. Deploy the NowStack Mobile web app to production on Vercel with the Convex backend shipped alongside it. Use when the user says "deploy my app", "deploy the web app", "ship to production", "go live", or needs CONVEX_DEPLOY_KEY / the Vercel build wired so the backend never drifts behind the frontend.

How to use this skill

Skill file

Web Deploy - NowStack Mobile

Deploy web-app/ (TanStack Start) to Vercel so that Convex and the frontend ship together on every commit. The Vercel build runs convex deploy first, then builds the site — without this, the frontend ships against a stale backend. Run these steps IN ORDER; never skip the deploy-key step (Step 2 is the one teams forget).

<critical>

</critical>

<step n="1" title="Confirm the build wiring (already in the repo)">

Two things must be true. npm run check-setup verifies both — they MUST pass:

npm run check-setup    # "web-app/vercel.json" AND "web-app nitro plugin" checks MUST pass
  1. web-app/vercel.json runs npm run build:vercel →

cd .. && npx convex deploy --cmd 'cd web-app && npm run build' --cmd-url-env-var-name VITE_CONVEX_URL.

  1. The nitro host preset is wired so SSR routes serve on Vercel.

If either is missing (older project), restore them:

// web-app/vercel.json
{ "installCommand": "npm install && npm --prefix .. install", "buildCommand": "npm run build:vercel" }
// web-app/package.json scripts:
// "build:vercel": "cd .. && npx convex deploy --cmd 'cd web-app && npm run build' --cmd-url-env-var-name VITE_CONVEX_URL"
// web-app/vite.config.ts — add the nitro plugin (after tanstackStart(), before react()/tailwind())
import { nitro } from "nitro/vite";
// plugins: [ tanstackStart({...}), nitro(), viteReact(), tailwindcss() ]
// and add "nitro": "^3.0.260610-beta" to web-app dependencies, then `cd web-app && npm install`.

Sanity-check locally that the build emits the Vercel output (Node 22):

cd web-app && VERCEL=1 npm run build   # must end with "Generated .vercel/output/nitro.json"; trash .vercel/output after

</step>

<step n="2" title="Provision the Vercel project (ALWAYS run this)">

vercel link                 # run from the REPO ROOT; pick/create the project
npm run setup:vercel        # from repo root

setup:vercel (scripts/setup-vercel-convex.mjs):

Idempotent — safe to re-run; npm run setup:vercel -- --force rotates the key.

Link at the repo root (not web-app/) so a CLI deploy uploads the whole monorepo. Root Directory = web-app then makes Vercel build inside web-app/, where .. reaches the root convex/ folder.

Prefer the dashboard? Convex → Settings → Deploy keys → "Generate production deploy key", add it to Vercel as CONVEX_DEPLOY_KEY (Production), and set Root Directory = web-app under Settings → Build & Deployment.

</step>

<step n="3" title="Deploy and verify">

Preferred — push to main. Vercel's Git integration checks out the whole repo (no file-count limit) and builds in web-app/:

git push origin main

CLI alternative — from the REPO ROOT with --archive=tgz:

vercel --prod --archive=tgz     # repo root, NOT web-app/ (see <critical>)

Confirm in the build log that Convex deployed and Nitro produced the Vercel output:

> cd .. && npx convex deploy --cmd 'cd web-app && npm run build' --cmd-url-env-var-name VITE_CONVEX_URL
- Running 'cd web-app && npm run build' with environment variables "VITE_CONVEX_URL" and "CONVEX_SITE_URL" set...
✓ built in ...
ℹ Generated .vercel/output/nitro.json     # ← the Nitro→Vercel preset ran

Then check the deployment is Ready and hit the routes (a SPA-404 regression only shows here, not in the build):

for p in / /privacy /cgv /support /app /admin; do
  echo "$p -> $(curl -s -o /dev/null -w '%{http_code}' https://<your-domain>$p)"
done
# every public route must be 200 (not 404). Sign in and confirm /app and /admin.

</step>

<step n="4" title="Domain (first launch only)">

Add the custom domain in Vercel project settings, then create the CNAME at your DNS provider (Cloudflare: CNAME subdomain → cname.vercel-dns.com, proxy off until verified). After the final domain is set, update site-config.ts > urls + auth.trustedOrigins and convex/siteConfig.ts > auth.trustedOrigins, then redeploy.

</step>

<failure_modes>

</failure_modes>

<success_metrics>

</success_metrics>

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.