A web application for cycle instructors to create AI-powered lesson plans with Spotify music integration.
- AI-generated lesson plans using Claude
- Spotify integration for music playback
- Customizable workout segments with tempo-matched songs
- Supabase authentication and database storage
- Python 3.11+
- A Supabase project
- Spotify Developer account
- Anthropic API key
-
Clone the repository:
git clone <repository-url> cd cycle-planner
-
Create and activate a virtual environment:
python -m venv .venv # Windows .venv\Scripts\activate # macOS/Linux source .venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Copy the example environment file:
cp .env.example .env
-
Configure environment variables (see below)
-
Run database migrations:
alembic upgrade head
Create a .env file with the following variables:
ANTHROPIC_API_KEY- Your Anthropic API key from https://console.anthropic.com/
SUPABASE_URL- Your Supabase project URL (found in Settings > API)SUPABASE_KEY- Your Supabase anon/public keySUPABASE_SERVICE_KEY- Your Supabase service role keyDATABASE_URL- PostgreSQL connection string (found in Settings > Database > Connection string > URI)
APP_ENV- Environment mode (developmentorproduction)APP_SECRET_KEY- Secret key for session management (use a random string)CORS_ORIGINS- Comma-separated list of allowed origins (e.g.,http://localhost:8000,https://yourdomain.com)
Get these from https://developer.spotify.com/dashboard:
SPOTIFY_CLIENT_ID- Your Spotify app client IDSPOTIFY_CLIENT_SECRET- Your Spotify app client secretSPOTIFY_REDIRECT_URI- OAuth callback URL (e.g.,http://localhost:8000/api/spotify/callback)
GETSONGBPM_API_KEY- API key from https://getsongbpm.com/api (used as fallback for tempo data)
Start the development server:
uvicorn main:app --reloadThe application will be available at http://localhost:8000
- Create an app at https://developer.spotify.com/dashboard
- Add your redirect URI to the app settings (e.g.,
http://localhost:8000/api/spotify/callback) - Copy the Client ID and Client Secret to your
.envfile
- Create a new project at https://supabase.com
- Copy the project URL, anon key, and service role key to your
.envfile - Get the database connection string from Settings > Database > Connection string > URI
- Run migrations with
alembic upgrade headto create the required tables
In your Supabase dashboard, configure the following:
URL Configuration (Authentication → URL Configuration):
- Site URL:
https://yourdomain.com - Redirect URLs: Add
https://yourdomain.com/**
Password Reset (Authentication → Email Templates → Reset Password):
- Update the action button URL to:
{{ .SiteURL }}/reset-password
Custom SMTP (Optional - Authentication → SMTP Settings):
- Enable custom SMTP to send emails from your own domain instead of Supabase's default address
GetSongBPM is used as a fallback when Spotify audio features are unavailable.
- Create an account at https://getsongbpm.com/api
- Set your Backlink URL to:
https://yourdomain.com - Copy the API key to your
.envfile
When deploying to production, configure these URLs in each service:
| Service | URL Type | Development | Production |
|---|---|---|---|
| Spotify | Redirect URI | http://localhost:8000/api/spotify/callback |
https://yourdomain.com/api/spotify/callback |
| Supabase | Site URL | http://localhost:8000 |
https://yourdomain.com |
| Supabase | Redirect URLs | http://localhost:8000/** |
https://yourdomain.com/** |
| GetSongBPM | Backlink URL | http://localhost:8000 |
https://yourdomain.com |