Documentation Index
Fetch the complete documentation index at: https://mintlify.com/MatthewSabia1/SubPirate-Pro/llms.txt
Use this file to discover all available pages before exploring further.
Overview
SubPirate Pro uses a dual-server architecture for local development:- Frontend: Vite dev server on
http://localhost:5173 - API: Express server on
http://localhost:8787 - Database: Supabase (local via Docker or hosted)
Prerequisites
- Node.js 18+ and npm
- Docker (required for local Supabase)
- Supabase CLI v2.33.9 (validated version)
Quick Start
Configure environment variables
Copy the example environment file and fill in the required values:Key environment variables for local development:
.env
Start local Supabase (optional)
If you want to run a local Supabase instance instead of connecting to a hosted project:This will start all Supabase services in Docker containers. Once started, copy the
API URL and anon key from the output and update your .env file.View the Supabase Studio dashboard at http://127.0.0.1:54323.Local Admin Bypass (Development Only)
For rapid local testing without Supabase auth, enable the local admin bypass:.env
/login that authorizes API calls without authentication.
Supabase Local Commands
Common Supabase CLI commands for local development:Development Scripts
Available npm scripts for development:| Command | Description |
|---|---|
npm run dev:all | Start both frontend and API servers (recommended) |
npm run dev | Start frontend dev server only (Vite) |
npm run dev:api | Start API server only (Express) |
npm run typecheck | Type-check TypeScript without emitting files |
npm run build | Type-check and build for production |
npm run lint | Run ESLint |
npm run secret-scan | Scan for accidentally committed secrets |
npm run smoke:local | End-to-end smoke test (requires local Supabase) |
Smoke Testing
Run the local smoke test to verify auth confirmations and RLS policies:Update environment variables
Set
VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY from supabase status output.Architecture Notes
Dual-Server Design
SubPirate Pro uses different server configurations for development and production:- Local development: Express server (
server.js) handles all/api/*routes - Production (Vercel): Serverless functions in
api/directory mirror Express routes
/api/* and /health requests to the Express server during development (configured in vite.config.ts).
API Request Flow
- Frontend makes API call using
secureFetch()fromsrc/lib/fetch.ts - Supabase JWT (or local admin token in dev) is automatically attached
- Vite dev server proxies request to Express at
:8787 - Express routes in
server.jshandle the request - Response returned to frontend
Troubleshooting
Port conflicts
If ports 5173 or 8787 are already in use, you can change them:.env
vite.config.ts.
Supabase connection issues
Verify Supabase is running and accessible:CORS errors
EnsureCORS_ORIGINS in .env includes your frontend origin:
Next Steps
Supabase Setup
Configure your Supabase project
Vercel Deployment
Deploy to production