Overview
BoxApp is built with modern web technologies and requires minimal setup to get started. This guide covers both local development and production deployment.Tech Stack: React 18 + TypeScript, Vite, Supabase (PostgreSQL + Auth), TailwindCSS, Radix UI
Prerequisites
Before you begin, ensure you have:- Node.js 18+ and npm
- Supabase Account (free tier works)
- Git for version control
- A code editor (VS Code recommended)
Environment Setup
Clone or Initialize Project
If you have the source code:This will install all required dependencies:
Key Dependencies
Key Dependencies
Configure Environment Variables
Create a Update the file with your Supabase credentials:
.env file in the project root:.env
Where to find Supabase credentials
Where to find Supabase credentials
- Go to supabase.com
- Open your project dashboard
- Navigate to Settings > API
- Copy your Project URL and anon/public key
Set Up Supabase Database
BoxApp requires several database tables. Run the migrations:This executes:
npx supabase db pushThe migration creates the following core tables:
boxes- Box/gym recordsprofiles- User profiles and roleswods- Daily workout programmingbookings- Class reservationsleads- Prospective member trackingresults- Workout results and PRsmovements- Exercise librarybenchmarks- Standard CrossFit benchmarks
Development Server
Start the development server:- Runs
predevscript (attempts database migration) - Starts Vite dev server on
http://localhost:5173 - Enables Hot Module Replacement (HMR)
The
predev script runs npm run db:migrate || true, which attempts to push database changes before starting the server. The || true ensures the dev server starts even if migrations fail.Authentication Setup
BoxApp uses Supabase Auth with custom flows:Email/Password Authentication
Implemented insrc/pages/Login.tsx:70:
Google OAuth
Configured insrc/pages/Login.tsx:151:
Configure Google OAuth in Supabase
Configure Google OAuth in Supabase
- Go to Supabase Dashboard > Authentication > Providers
- Enable Google provider
- Add your Google OAuth credentials (Client ID & Secret)
- Configure redirect URLs:
- Development:
http://localhost:5173/auth/callback - Production:
https://your-domain.com/auth/callback
- Development:
Multi-Tenancy
BoxApp supports multiple boxes (gyms) on a single platform:TenantContext and buildTenantUrl utility.
Box Registration Flow
New boxes register throughsrc/pages/RegisterBox.tsx:289:
Building for Production
Compile the application:- TypeScript compiler (
tsc) - Type checking - Vite build - Optimized production bundle
dist/
Build Configuration
Build Configuration
package.json
Deployment Options
Option 1: Vercel (Recommended)
Environment Variables
Environment Variables
Add to Vercel project settings:
VITE_SUPABASE_URLVITE_SUPABASE_ANON_KEY
Option 2: Netlify
Option 3: Docker
Create aDockerfile:
Database Schema
Core tables structure:Security Configuration
Row Level Security (RLS)
Enable RLS on all tables:Auth Policies
Example policy for box isolation:Troubleshooting
Supabase Connection Errors
Supabase Connection Errors
Check console output for:If missing:
- Verify
.envfile exists - Restart dev server
- Check Supabase project status
Database Migration Failures
Database Migration Failures
Build Errors
Build Errors
Authentication Issues
Authentication Issues
- Verify email confirmation is disabled in Supabase (or check email)
- Check Auth policies in Supabase Dashboard
- Ensure redirect URLs are configured
- Validate JWT secret configuration
Next Steps
Now that BoxApp is installed:- Follow the Quick Start Guide to register your first box
- Configure multi-tenancy for production
- Set up custom domain (if not using boxora.website)
- Configure email templates in Supabase
- Set up backup and monitoring