FleetOS Production Deployment Guide

Version: 1.0 Last Updated: 2025-12-31 Status: Production Ready


Overview

This guide walks through deploying FleetOS to production. FleetOS is built with React + TypeScript + Vite, backed by Supabase (PostgreSQL + Auth + Realtime).

Tech Stack:

  • Frontend: React 18, TypeScript, Vite

  • Backend: Supabase (PostgreSQL, Auth, Realtime, Storage)

  • Notifications: Twilio (WhatsApp)

  • Analytics: Custom viral analytics via Supabase

Production Readiness:

  • βœ… Row Level Security (RLS) policies ready

  • βœ… Error boundaries implemented

  • βœ… Loading states added

  • βœ… Progressive authentication system

  • βœ… Viral analytics tracking

  • βœ… Production build optimized


Pre-Deployment Checklist

1. Security Audit

CRITICAL: Review credentials before deploying

Files to review:

  • .env.production.example (safe template)

  • SECURITY_CREDENTIALS.md (security audit)

2. Database Setup

CRITICAL: Apply database migrations before deploying

All SQL migrations must be applied via Supabase SQL Editor:

  1. RLS Policies: database/fleetos/rls-policies.sql

    • 30+ policies for data isolation

    • Apply via Supabase dashboard β†’ SQL Editor

  2. Core Migrations: database/APPLY_ALL_MIGRATIONS.sql

    • Combines 3 migrations: auth tiers, tracking tokens, viral tables

    • Run once in production database

  3. Verification:

See: database/MIGRATION_GUIDE.md for step-by-step instructions


Environment Variables

Production Environment Variables

Create a .env.production file with the following structure:

Security Notes:

  1. VITE_ Prefix = Frontend Exposed:

    • Only use VITE_ for PUBLIC keys (anon key, URL)

    • NEVER prefix service role or Twilio tokens with VITE_

  2. Service Role Key:

    • Bypasses ALL RLS policies

    • Must be server-side only

    • Rotate immediately if exposed

  3. Magic Link Security:

    • 24-hour expiry

    • Single-use tokens

    • Cryptographically random (32 bytes)


Build Process

1. Install Dependencies

2. Run Production Build

Expected output:

3. Preview Production Build Locally

Visit: http://localhost:4173

Test checklist:


Deployment Platforms

Why Vercel:

  • Zero-config for Vite

  • Automatic HTTPS

  • Global CDN

  • Serverless functions (if needed)

Steps:

  1. Install Vercel CLI:

  2. Deploy:

  3. Set Environment Variables in Vercel Dashboard:

    • Settings β†’ Environment Variables

    • Add all variables from .env.production

    • Ensure VITE_ prefix is correct

  4. Verify Deployment:

    • Visit provided URL

    • Test magic link auth

    • Check Supabase connectivity

Vercel Configuration (vercel.json):

Option 2: Netlify

Steps:

  1. Install Netlify CLI:

  2. Deploy:

  3. Configuration (netlify.toml):

Option 3: Custom Server (Node.js)

Use serve or similar static server:

For production, use PM2:


Post-Deployment Verification

1. Functional Tests

Run through complete user flows:

Supplier Flow:

  1. Visit /fleetos/login

  2. Request magic link

  3. Click email link

  4. Complete onboarding

  5. Access supplier dashboard

  6. Acknowledge a request

  7. Mark request complete

  8. Verify viral moments appear

Fleet Flow:

  1. Visit supplier's public request page

  2. Submit service request

  3. Receive magic link

  4. Track request status

  5. Verify real-time updates

  6. Check WhatsApp notifications

2. Database Verification

3. Performance Verification

4. Security Verification


Rollback Procedure

If deployment fails or critical bugs appear:

1. Immediate Rollback (Vercel/Netlify)

Vercel:

Netlify:

  • Dashboard β†’ Deploys β†’ Click previous deploy β†’ "Publish deploy"

2. Database Rollback

If migrations cause issues:

IMPORTANT: Only rollback if absolutely necessary. Test in staging first.

3. Emergency Hotfix

For critical frontend bugs:

  1. Identify commit with bug

  2. Revert locally:

  3. Trigger new deployment

  4. Verify fix deployed


Monitoring & Maintenance

1. Analytics Monitoring

Key Metrics to Watch:

Viral Dashboard:

  • Access via: /fleetos/analytics (requires ROBO_HUB tier)

  • Monitor Rβ‚€ replication rate

  • Track conversion funnel

  • A/B test results

2. Error Monitoring

Set up Sentry (optional but recommended):

Add to App.tsx:

3. Database Health

Weekly checks:

4. Performance Monitoring

  • Supabase Dashboard: Monitor API request rates

  • Browser DevTools: Check bundle size growth

  • Lighthouse: Monthly performance audits


Troubleshooting

Build Fails

Error: terser not found

  • Fix: Use esbuild for minification (already configured)

Error: TypeScript errors

  • Fix: Run npm run build locally first

  • Check tsconfig.json is correct

Deployment Fails

Error: Environment variables not set

  • Fix: Add all variables in platform dashboard

  • Verify VITE_ prefix for frontend vars

Error: 404 on all routes

  • Fix: Configure redirects (see platform sections above)

  • Ensure SPA fallback to index.html

Runtime Errors

Error: Supabase connection fails

  • Fix: Check VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY

  • Verify network access to Supabase

Error: Real-time not working

  • Fix: Check Supabase Realtime is enabled

  • Verify RLS policies allow subscriptions

Error: Magic links not sending

  • Fix: Check email configuration in Supabase Auth

  • Verify SMTP settings or use Supabase's email service


Production Optimization Checklist


Next Steps After Deployment

  1. Domain Setup:

    • Point custom domain to deployment

    • Configure DNS (A/CNAME records)

    • Enable HTTPS/SSL

  2. Email Configuration:

    • Set up custom SMTP (SendGrid, Postmark)

    • Configure magic link sender domain

    • Test email deliverability

  3. WhatsApp Verification:

    • Submit Twilio WhatsApp business profile

    • Get approval for production messaging

    • Set up message templates

  4. Analytics Setup (optional):

    • Google Analytics 4

    • Mixpanel for funnel analysis

    • Segment for data pipelines

  5. Backup Strategy:

    • Supabase auto-backups (enabled by default)

    • Weekly manual snapshots

    • Test restore procedure


Support & Resources

Documentation:

Codebase Docs:

  • SECURITY_CREDENTIALS.md - Security audit

  • database/MIGRATION_GUIDE.md - Database setup

  • database/fleetos/README_RLS.md - RLS policy details

  • components/common/LOADING_USAGE.md - UX component guide

Issue Reporting:

  • GitHub Issues: anthropics/claude-code


πŸš€ FleetOS is now production-ready.

Strategic Note: FleetOS is designed as "calm infrastructure" - professional, non-pushy, respectful of users' time. The viral engine is built to achieve Rβ‚€ β‰₯ 1.2 through trust and quality, not manipulation. This deployment guide reflects that philosophy: thorough, clear, and respectful of production environments.

Last updated

Was this helpful?