Interactive command-line tools for managing your JumpFlix database.
- Create
.envfile with your Supabase credentials:
PUBLIC_SUPABASE_URL=https://your-project.supabase.co
PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
# Optional: Spotify (needed for tracklists)
SPOTIFY_CLIENT_ID=
SPOTIFY_CLIENT_SECRET=Note: The CLI will work with the anon key, but using the service role key gives you admin privileges and bypasses RLS policies.
- Install dependencies (if you haven't already):
npm installRun the admin CLI for content management:
npm run adminRun the backup tool:
npm run backupAdd a new movie with all metadata:
- Title, slug (auto-generated from title)
- Description
- Year, duration
- Video ID, Vimeo ID
- Thumbnail URL
- Auto-generate blurhash from thumbnail image
- Paid/free flag
- Provider info
- Creators and cast (comma-separated)
Create a new series with seasons:
- Series metadata (similar to movies)
- Auto-generate blurhash from thumbnail image
- Automatically create seasons with YouTube playlist IDs
- Option to sync episodes immediately from YouTube playlists
Automatically sync episodes from YouTube playlists:
- Refresh specific series - Sync all seasons for one series
- Refresh specific season - Sync just one season
- Refresh all series - Sync episodes for your entire catalog
Episodes are automatically fetched from YouTube playlists (no API key required). The system will:
- Add new episodes that aren't in the database
- Update existing episodes with latest info
- Preserve episode numbers and ordering
View all your movies and series with their basic info
Update existing content metadata
Remove content from your database (cascades to seasons/episodes)
Add and maintain timestamped song tracklists for movies.
- Manual add: paste a Spotify track URL/URI and enter a start timecode
- Import from YouTube (best-effort): uses video description timestamps and/or “Music in this video” attribution
- Bulk import: imports missing tracklists for all movies with 0 tracks
This feature requires SPOTIFY_CLIENT_ID + SPOTIFY_CLIENT_SECRET in .env.
The backup tool creates complete local backups of your Supabase database.
- 📦 Complete backup - Schema + Data + Users + Migrations (recommended)
- 📋 Schema only - Database structure (DDL)
- 💾 Data only - All table data (DML)
- 👥 Users only - Supabase Auth users (JSON export)
- 📁 Migrations only - Copy of all migration files
- ⚙️ Custom backup - Choose what to include
Schema (DDL):
- Complete table definitions from migrations
- Column types and constraints
- Indexes and primary keys
- RLS policies and security rules
- Combines all migration files into single file
- Fallback introspection if migrations unavailable
Data (DML):
- All rows from all tables
- Formatted as SQL INSERT statements
- Handles JSON, arrays, and special types
- Safe string escaping
Users (Auth):
- All users from Supabase Auth
- Exported as JSON format
- Includes user metadata
- Email, phone, and authentication details
- Restore via Auth Admin API or dashboard
Migrations:
- All
.sqlmigration files fromsupabase/migrations/
Each backup creates a timestamped directory with:
backups/
└── backup_2025-11-05_14-30-00/
├── README.md # Restore instructions
├── backup-info.json # Backup metadata
├── schema.sql # Database schema
├── data.sql # All table data
├── users.sql # Auth users (JSON)
└── migrations/ # Migration files
├── 202510310001_initial_schema.sql
├── 20251103120000_add_watch_history.sql
└── ...
-
Restore Schema:
psql -h your-db-host -U your-user -d your-database -f schema.sql
-
Restore Data:
psql -h your-db-host -U your-user -d your-database -f data.sql
-
Restore Users:
Users are exported as JSON. Use Supabase dashboard or Auth Admin API to import. See
users.sqlfor the JSON data and detailed instructions. -
Apply Migrations: Run migration files in order from the
migrations/directory
- Default output:
./backups/directory - Custom output: Choose any directory during backup
- Automatic timestamping: Each backup gets a unique timestamp
- Backups include all public schema tables
- User data requires service role key - Auth Admin API access needed
- Keep backups secure - they contain sensitive user data including emails
- Test restores in non-production first
- Backups are stored locally (not in git)
- Service role key required for complete backups
- User passwords are hashed and handled securely
- Episodes are managed automatically from YouTube playlists - you don't manually add them
- Blurhash is auto-generated when you provide a thumbnail URL
- Each season needs a YouTube playlist ID to auto-sync episodes
- The YouTube sync uses public Atom feeds (no API key required)
- Slugs are auto-generated from titles (e.g., "The Matrix" → "the-matrix")
- Leave fields empty to skip optional fields
- Comma-separated lists for creators and cast (e.g., "John Doe, Jane Smith")
- Press Ctrl+C anytime to exit
- All changes are immediate - be careful with deletions!
- Back up regularly - Run
npm run backupbefore major changes
.env file or expose your service role key.
The .env file is already in .gitignore to prevent accidental commits.