A powerful internal admin dashboard for managing music tracks, playlists, categories, and users for the PlaceDJ platform. Built with Next.js, Supabase, and Tailwind CSS.
- Dashboard: comprehensive overview of tracks, playlists, and user management.
- Audio Upload:
- Single and Multi-track upload capabilities.
- Automatic metadata extraction (Title, Artist, Duration, BPM, Key, Energy, Loudness, Genre, Mood).
- Waveform data generation for UI visualization.
- Smart Playlists:
- Auto-suggest playlists based on track mood, genre, and BPM.
- Create playlists from filtered track selections.
- Role-Based Access Control:
- Secure admin-only access for sensitive operations.
- Row Level Security (RLS) policies enforced via Supabase.
- Framework: Next.js (App Router)
- Language: TypeScript
- Styling: Tailwind CSS, shadcn/ui
- Backend/Database: Supabase (Auth, PostgreSQL, Storage)
- Audio Analysis:
- Basic:
music-metadata,music-tempo,fft.js(Pure JS fallback) - Advanced (Optional): Python (
librosa),aubio,ffmpeg
- Basic:
Follow these steps to get the project running locally.
- Node.js (v18 or later recommended)
- npm or yarn
- Supabase Account: You need a Supabase project for the database and authentication.
- Python 3 (Optional, for advanced audio analysis)
git clone <repository-url>
cd placedj-adminnpm installCreate a .env.local file in the root directory by copying the example:
cp .env.example .env.localUpdate .env.local with your Supabase credentials:
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key- Create a new Supabase project.
- Run SQL Migrations:
- Go to the SQL Editor in your Supabase dashboard.
- Copy the contents of
supabase/migrations/001_init.sql. - Run the query to set up tables, storage buckets, and RLS policies.
- Create an Admin User:
- Go to the Authentication tab and create a new user (email/password).
- Go to the Table Editor ->
public.userstable. - Insert a row for the user you just created, ensuring you set the
roleto'admin'. - Note: The
idmust match theUser UIDfrom the Authentication tab.
For more accurate BPM, Key, and Energy detection, you can enable the Python/Native analyzer.
- Create a Python virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install Python dependencies:
pip install -r requirements.txt
- Enable Native Analyzer:
- Open
.env.local. - Set
USE_NATIVE_ANALYZER=1.
- Open
npm run devOpen http://localhost:3000/admin/login in your browser.
app/admin: Main dashboard pages and layouts.components: Reusable UI components (Tracks, Playlists, etc.).lib: Utility functions, Supabase clients, and audio analysis logic.supabase: Database migrations and configuration.public: Static assets.
| Command | Description |
|---|---|
npm run dev |
Start the development server |
npm run build |
Build the application for production |
npm run start |
Start the production server |
npm run lint |
Run ESLint to check for code issues |
- Upload Limits: Server actions are configured for up to 150MB. The multi-track uploader limits batches to 50 files client-side.
- Security: RLS policies ensure that only users with the
adminrole can write data (upload tracks, create playlists, etc.). - UUID Support: Upload flows generate UUIDs in the browser; older browsers without
crypto.randomUUID()use acrypto.getRandomValues()fallback.