Overview
ClassroomIO uses Supabase for its database and authentication. For local development, you’ll run Supabase locally using Docker instead of using the cloud version.Prerequisites
Before starting, ensure you have:- Docker installed and running
- Supabase CLI installed
- Completed the initial setup from the Local Development guide
Installing Supabase CLI
If you haven’t installed the Supabase CLI yet:Starting Supabase Locally
1. Start Docker
Make sure Docker is running on your machine. You can verify by running:2. Start Supabase
From the project root directory, start Supabase:- Pull necessary Docker images (first time only)
- Start all Supabase services locally
- Run database migrations automatically
- Set up authentication
- Create seed data for testing
3. Get Your Credentials
Once Supabase starts successfully, you’ll see output like this:Save these credentials - you’ll need them for the next step!
4. Configure Environment Variables
Add the Supabase credentials to yourapps/dashboard/.env file:
apps/api/.env:
Accessing Supabase Studio
Supabase Studio is a web-based interface for managing your local database.Open Studio
Access the Studio interface at:What You Can Do in Studio
- Table Editor: View and edit database tables
- SQL Editor: Run custom SQL queries
- Authentication: Manage users and authentication settings
- Storage: Manage file uploads
- Database: View schema and relationships
- API Docs: Auto-generated API documentation
Working with Migrations
Viewing Existing Migrations
Migrations are located in thesupabase/migrations/ directory. These are automatically applied when you run supabase start.
Creating a New Migration
If you need to make database changes:supabase/migrations/.
Applying Migrations
Migrations are automatically applied onsupabase start. To manually apply migrations:
This will reset your local database and re-run all migrations, deleting any test data you’ve created.
Pushing Migrations to Cloud
If you’re working with Supabase Cloud, you can push local migrations:Database Access
Using the PostgreSQL Connection
You can connect to the local database directly using the DB URL:- pgAdmin
- DBeaver
- DataGrip
- VS Code PostgreSQL extensions
Using the GraphQL API
Supabase also provides a GraphQL endpoint:Testing Email Features
Inbucket Email Testing
Local Supabase includes Inbucket for testing email functionality:- Email verification
- Password resets
- Invitation emails
Managing Supabase Services
Check Status
To view the status of all Supabase services:Stop Supabase
To stop all Supabase services:Stop and Reset
To stop Supabase and remove all data:Common Issues
Docker Not Running
If you get an error about Docker not running:- Start Docker Desktop
- Wait for Docker to fully start
- Run
supabase startagain
Port Already in Use
If ports 54321-54324 are already in use:- Stop other services using these ports
- Or stop Supabase with
supabase stopand restart
Migrations Not Applying
If migrations aren’t applying correctly:Cannot Connect to Database
Ensure:- Docker is running
- Supabase services are started (
supabase status) - Your
.envfiles have the correct credentials - The API URL uses
127.0.0.1notlocalhost
Seed Data
The local Supabase instance comes with seed data that includes:- Demo admin account
- Demo student accounts
- Sample courses and lessons
- Test organizations
Next Steps
- Login with demo accounts to access the application
- Run the development server
- Learn about Gitpod setup for cloud-based development