MSMetaSocial← BackSetup & go live
Full steps also live in the repo: README.md, docs/SETUP.md.
1
Install & env
cd C:\Users\manoj\xAutomation-tool
copy .env.local.example .env.local
npm install
npm run dev
Fill Supabase URL + anon key. Optional: X keys, XAI_API_KEY, Stripe.
2
Database (Supabase SQL Editor)
Run once (new project):
supabase/migrations/000_COMPLETE_SETUP.sql
Or run 001 → 005 in order. Includes auth workspace RPC, identity links, billing/teams, and RLS recursion fix.
3
Auth URLs (Supabase)
- Site URL: http://localhost:3000
- Redirect: http://localhost:3000/auth/callback
- Enable Google provider + OAuth client
4
X developer app
- Type: Web App · Website: public https URL (not localhost)
- Callbacks:
https://YOUR_REF.supabase.co/auth/v1/callback
http://localhost:3000/api/x/callback - .env: X_CLIENT_ID, X_CLIENT_SECRET, TOKEN_ENCRYPTION_KEY
- Free X API often blocks profile/mentions/post — upgrade for live API features
5
Use the product
- Sign in with Google
- Settings → Connect X
- Compose → queue → Approve & post
- Inbox → Refresh mentions → Reply
- Rules → approve mode first; kill switch OFF
- AI: set XAI_API_KEY
- Billing: STRIPE_DEV_BYPASS=true locally, or real Stripe keys
6
Production deploy
- Deploy to Vercel; set all env vars
- NEXT_PUBLIC_SITE_URL=https://your-domain.com
- Update Supabase + X callbacks for production URL
- Stripe webhook → /api/billing/webhook
- Cron (optional) → POST /api/cron/publish with CRON_SECRET
Phases 0–7 are implemented. Prefer Google login; Connect X for posting; keep auto-send kill switches off until rules are trusted.