Skip to content

Latest commit

 

History

History
84 lines (57 loc) · 3.81 KB

File metadata and controls

84 lines (57 loc) · 3.81 KB

Deploying MetaShift

Do not commit .env or any file with real secrets. Use .env.example as a template; set values in your environment or in the host dashboard.

MetaShift is a monorepo: backend (Node/Express + WebSocket) and frontend (React/Vite). Deploy backend first, then frontend, and set the frontend’s VITE_BACKEND_URL to the backend URL.

Environment variables

Backend (required)

Variable Description
PORT Set by Render automatically; default 3001 locally.
SUPABASE_URL Supabase project URL.
SUPABASE_SERVICE_KEY Supabase service_role key (keep secret).
SUPABASE_JWT_SECRET Supabase JWT secret (Settings → API) for auth.

Optional: CORS_ORIGIN = comma-separated frontend URLs (e.g. https://your-app.vercel.app). Omit in dev to allow all.
Optional: GEMINI_API_KEY for resolution suggestions.

Frontend (build-time)

Vite bakes these in at build time. API and WebSocket URLs are derived from VITE_BACKEND_URL.

Variable Description
VITE_BACKEND_URL Backend base URL, no trailing slash (e.g. https://metashift-backend.onrender.com).
VITE_SUPABASE_URL Same as backend SUPABASE_URL.
VITE_SUPABASE_ANON_KEY Supabase anon public key.

Deploy on Vercel (frontend only)

Use when the backend is already deployed (e.g. on Render).

  1. VercelAdd NewProject → import the MetaShift repo.
  2. Root Directory: set to frontend.
  3. Environment variables: Add (use your real backend URL and Supabase values; do not commit them):
    • VITE_BACKEND_URL = your backend URL (e.g. https://metashift-backend.onrender.com)
    • VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY
  4. Deploy. Set backend CORS_ORIGIN to include your Vercel URL.

Deploy on Render (backend + frontend)

  1. Supabase: Create a project, run migrations from supabase/migrations/, and copy URL, anon key, service role key, and JWT secret. Do not commit them.

  2. Blueprint: RenderNewBlueprint → connect the MetaShift GitHub repo. Render reads render.yaml and creates metashift-backend and metashift-frontend.

  3. Backend: In the backend service dashboard, add env vars:

    • SUPABASE_URL, SUPABASE_SERVICE_KEY, SUPABASE_JWT_SECRET
    • CORS_ORIGIN = your frontend URL(s), comma-separated (e.g. https://metashift-frontend.onrender.com)
    • Optional: GEMINI_API_KEY Save; Render redeploys. Health check uses GET /health (returns { "ok": true }).
  4. Note the backend URL (e.g. https://metashift-backend.onrender.com).

  5. Frontend: In the frontend service dashboard, add env vars:

    • VITE_BACKEND_URL = backend URL from step 4 (no trailing slash)
    • VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY Save and redeploy the frontend so the build uses the new values.
  6. Open the frontend URL; dashboard and WebSocket should connect. SPA routing is handled by the rewrite in render.yaml (/*/index.html).


GitHub

  • CI: On push/PR to main (or master), GitHub Actions runs:
    • Backend: npm ci + npm run test in backend/.
    • Frontend: npm ci + npm run test + npm run build in frontend/.
  • Secrets: No secrets are required for CI. For deployment, configure env vars in Vercel and Render dashboards (not in GitHub repo secrets unless you use GitHub Actions to deploy).

Checklist

  • Supabase project created; migrations run; no secrets committed.
  • Backend deployed; GET /health returns { "ok": true }.
  • Frontend env has VITE_BACKEND_URL (and Supabase keys); frontend redeployed after setting.
  • Backend CORS_ORIGIN includes the frontend URL(s).
  • Browser opens the app; dashboard loads and WebSocket connects.