Introduction
The BoxApp API is built on Supabase, providing a powerful PostgreSQL-based backend with real-time capabilities, authentication, and row-level security. The API enables you to manage all aspects of your CrossFit gym, including members, classes, workouts, competitions, and more.Base URL
The API base URL is your Supabase project URL:Authentication
All API requests require authentication using Supabase Auth. You must include your authentication token in the request headers. See the Authentication page for detailed information on signing in, signing up, and managing user sessions.Client Initialization
To interact with the BoxApp API, you initialize the Supabase client with your project credentials:The
Database type provides full TypeScript type safety for all tables, columns, and relationships in your database.Environment Variables
You need to configure the following environment variables:Your Supabase project URL (e.g.,
https://xxxxx.supabase.co)Your Supabase anonymous/public API key. This key is safe to use in client-side code and respects row-level security policies.
Core Resources
The BoxApp API provides access to the following core resources:Profiles
User profiles with role-based access control (admin, coach, athlete).Boxes
Gym/box configurations including branding, themes, and subscription status.Classes & Sessions
Class schedules, sessions, and bookings for gym members.Workouts (WODs)
Daily workouts with structured blocks and programming.Competitions
Comprehensive competition management including events, divisions, participants, scoring, and leaderboards.Memberships & Billing
Membership plans, invoices, and payment tracking.Inventory
Equipment and supplies inventory management.Making Requests
The Supabase client provides a fluent API for querying and mutating data:Fetching Data
Inserting Data
Updating Data
Deleting Data
Response Format
All API operations return a response object with the following structure:The returned data from the query. Will be
null if an error occurred.An error object if the request failed, otherwise
null.Error Handling
Always check for errors in your API responses:Real-time Subscriptions
Subscribe to real-time changes in your database:Multi-tenancy
BoxApp implements multi-tenancy through thebox_id field. All queries automatically filter data based on the authenticated user’s box association through row-level security policies.
You don’t need to manually filter by
box_id in most cases - RLS policies handle this automatically based on the authenticated user’s profile.Rate Limits
Supabase enforces rate limits based on your subscription plan. Monitor your usage through the Supabase dashboard.TypeScript Support
The BoxApp API provides comprehensive TypeScript types generated from your database schema:Next Steps
- Read the Authentication guide to learn about user management
- Explore the Supabase Documentation for advanced features
- Review row-level security policies in your Supabase dashboard