Skip to main content

Deployment Overview

AppPlatformURL
PublisherVercelpublisher.trendingsociety.com
PlatformVercelplatform.trendingsociety.com
AgencyVercelagency.trendingsociety.com
DashboardVercelapp.trendingsociety.com
MCP GatewayCloudflare Workersmcp.trendingsociety.com
DocsMintlifydocs.trendingsociety.com
DatabaseSupabaseymdccxqzmhxgbjbppywf.supabase.co

Vercel Deployment

Initial Setup

  1. Connect Repository
    • Go to vercel.com
    • Import the GitHub repository
    • Select the monorepo
  2. Configure Project
    Framework Preset: Next.js
    Root Directory: apps/[app-name]
    Build Command: pnpm build
    Output Directory: .next
    Install Command: pnpm install
    
  3. Environment Variables Add in Vercel dashboard:
    NEXT_PUBLIC_SUPABASE_URL
    NEXT_PUBLIC_SUPABASE_ANON_KEY
    SUPABASE_SERVICE_ROLE_KEY
    SHOPIFY_STORE_DOMAIN
    SHOPIFY_ACCESS_TOKEN
    

Automatic Deployments

  • Production: Push to main branch
  • Preview: Push to any other branch

Manual Deployment

# Install Vercel CLI
npm i -g vercel

# Deploy from app directory
cd apps/publisher
vercel

# Deploy to production
vercel --prod

Cloudflare Workers (MCP Gateway)

Initial Setup

  1. Install Wrangler
    npm install -g wrangler
    wrangler login
    
  2. Configure wrangler.toml
    name = "mcp-server"
    main = "src/index.ts"
    compatibility_date = "2024-01-01"
    
    [vars]
    ENVIRONMENT = "production"
    
    [[kv_namespaces]]
    binding = "API_KEYS"
    id = "your-kv-namespace-id"
    
  3. Deploy
    cd services/mcp
    wrangler deploy
    

Secrets Management

# Add secrets
wrangler secret put SUPABASE_SERVICE_ROLE_KEY
wrangler secret put SHOPIFY_ACCESS_TOKEN

Supabase Database

Migrations

# Push migrations to production
supabase db push --project-ref ymdccxqzmhxgbjbppywf

Edge Functions

# Deploy all functions
supabase functions deploy --project-ref ymdccxqzmhxgbjbppywf

# Deploy specific function
supabase functions deploy function-name --project-ref ymdccxqzmhxgbjbppywf

Type Generation

# Generate types from production schema
npx supabase gen types typescript \
  --project-id ymdccxqzmhxgbjbppywf \
  > packages/db/types.ts

Mintlify Docs

Setup

  1. Connect GitHub repo to Mintlify
  2. Configure mint.json in apps/docs/
  3. Add custom domain: docs.trendingsociety.com

Deployment

Automatic on push to main branch.
# Preview locally
npx mintlify dev

Domain Configuration

Cloudflare DNS

All domains managed in Cloudflare:
SubdomainRecord TypeTarget
@AVercel IP
wwwCNAMEcname.vercel-dns.com
publisherCNAMEcname.vercel-dns.com
platformCNAMEcname.vercel-dns.com
agencyCNAMEcname.vercel-dns.com
appCNAMEcname.vercel-dns.com
mcpCNAMEworkers.dev
docsCNAMEmintlify.com

SSL

  • Cloudflare provides SSL for all subdomains
  • Use “Full (strict)” SSL mode
  • Enable HTTPS redirects

CI/CD Pipeline

GitHub Actions (Optional)

# .github/workflows/deploy.yml
name: Deploy

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - uses: pnpm/action-setup@v2
        with:
          version: 8
          
      - uses: actions/setup-node@v4
        with:
          node-version: 18
          cache: 'pnpm'
          
      - run: pnpm install
      - run: pnpm build
      - run: pnpm typecheck
      - run: pnpm lint

Deployment Checklist

Before deploying to production:
All tests pass
TypeScript compiles without errors
Linting passes
Migrations applied to production database
Environment variables set in deployment platform
Types regenerated if schema changed
Documentation updated

Rollback

Vercel

  1. Go to Deployments tab
  2. Find previous working deployment
  3. Click ”…” → “Promote to Production”

Cloudflare Workers

# List deployments
wrangler deployments list

# Rollback to previous version
wrangler rollback

Supabase

For database rollbacks, create and run a rollback migration:
-- Rollback: Undo [migration name]
DROP TABLE IF EXISTS table_name CASCADE;
Database rollbacks can cause data loss. Always backup before major migrations.

Monitoring

Vercel

  • Analytics: vercel.com/[team]/[project]/analytics
  • Logs: vercel.com/[team]/[project]/logs

Cloudflare

  • Analytics: Workers dashboard
  • Logs: wrangler tail

Supabase

  • Database: Supabase dashboard → Database
  • Edge Functions: Supabase dashboard → Edge Functions → Logs