Overview
BoxApp’s multi-tenant architecture allows you to operate multiple CrossFit gyms (“boxes”) from a single platform. Each box has completely isolated data, custom branding, and independent subscription management.Subdomain Routing
Each gym gets its own branded subdomain (e.g.,
yourbox.boxapp.com)Data Isolation
Member data, schedules, and billing are completely separated by box
Subscription Status
Independent subscription management per gym location
Custom Configuration
Each box can customize plans, schedules, and branding independently
How Multi-Tenancy Works
Tenant Resolution
BoxApp identifies your gym based on the hostname or query parameter:TenantProvider loads your box configuration before rendering the app:
Subscription Status
BoxApp automatically checks your subscription status:Accessing Tenant Information
Use theuseTenant hook throughout your application:
Multi-Location Management
Each box operates independently with its own:
- Member database
- Class schedules
- WOD programming
- Billing and invoices
- Competition management
Box Switching
If you manage multiple locations, you can switch between them using the box selector in the navigation. The system will:- Update the current box context
- Reload all data specific to that location
- Maintain separate sessions and permissions
Benefits of Multi-Tenancy
Centralized Management
Centralized Management
Manage multiple gym locations from a single dashboard while keeping data completely isolated.
Scalability
Scalability
Easily add new locations without additional infrastructure setup.
Custom Branding
Custom Branding
Each location can have its own branding, subdomain, and configuration.
Data Security
Data Security
Row-level security ensures members can only access data from their registered box.
Best Practices
- Verify tenant loading: Always check
isLoadingbefore accessingtenantBoxdata - Handle errors gracefully: Display user-friendly messages when a box is not found
- Monitor subscription status: Alert admins before subscriptions expire
- Use box IDs consistently: Always filter queries by
currentBox?.idto ensure data isolation
Development vs Production
- Development: Use query parameters (e.g.,
?box=your-slug) for tenant resolution - Production: Automatically detects tenant from subdomain (e.g.,
yourbox.boxapp.com)
getTenantSlug() utility function.