Deploy TSP-V2 to Netlify. Use when: deploying to production, pre-deploy checklist, setting up env variables, configuring Netlify, checking build output, netlify.toml, PWA deploy, publish new version.
Pre-deploy checklist and deployment workflow for TSP-V2 → Netlify.
Run the full QA pipeline (see qa-check skill):
npx tsc --noEmit ; npm run lint ; npm test ; npm run build:check
All must pass with 0 errors before deploying.
Verify .env.local exists locally and all variables are configured in Netlify → Site settings → Environment variables:
| Variable | Description |
|---|---|
VITE_SUPABASE_URL | Supabase project URL |
VITE_SUPABASE_ANON_KEY | Supabase anon/public key |
Rules:
VITE_ to be accessible in the browser.env.local to git — it's in .gitignorenpm run build
Check dist/ folder was created successfully. Preview it:
npm run preview
Open http://localhost:4173 and verify:
/customers)Auto-deploy (recommended): Push to the connected git branch (usually main or master).
git push origin main
Manual deploy via Netlify CLI:
npx netlify deploy --prod --dir=dist
netlify.toml)Key settings already configured in the project:
| Setting | Value | Purpose |
|---|---|---|
| Build command | npm install --include=dev && npm run build | Installs devDeps + builds |
| Publish dir | dist | Output folder |
| Node version | 20 | Required for Vite |
/* → index.html | 200 redirect | SPA client-side routing |
/api/privatbank-rate | Proxy to PrivatBank API | Avoid CORS on exchange rate |
| Security headers | X-Frame-Options, X-XSS-Protection, etc. | OWASP headers |
/assets/* | max-age=31536000, immutable | Long-term asset caching |
/sw.js | no-cache | Service worker always fresh |
After Netlify deploy completes:
/parts/* routes accessible| Problem | Likely Cause | Fix |
|---|---|---|
Build fails: Cannot find module | Missing dep in dependencies (not devDependencies) | Move to dependencies in package.json |
| Build fails: TypeScript error | tsc errors not caught locally | Run npx tsc --noEmit and fix |
| Blank page after deploy | SPA redirect missing | Check netlify.toml has /* → /index.html rule |
| Supabase 401 errors | Env vars not set in Netlify | Add VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY in Netlify dashboard |
| CORS on PrivatBank API | Missing proxy rule | Check netlify.toml redirect for /api/privatbank-rate |
| PWA not installing | sw.js cached old version | Headers set no-cache for sw.js — force refresh |