A scalable backend responsible for music streaming, playlist migration, downloads, waveform generation, metadata management, and real-time communication.
The Noctune Backend is the core service behind the Noctune music application. It provides APIs for streaming music, downloading tracks, migrating Spotify playlists, generating waveforms, retrieving lyrics, and managing user playlists.
Rather than storing copyrighted media, the backend intelligently integrates multiple services to fetch metadata, stream audio, and enrich the listening experience.
- Low-latency audio streaming
- Direct YouTube audio extraction
- FFmpeg transcoding pipeline
- Automatic reconnection handling
- High-quality MP3 streaming
- Download songs from YouTube
- Automatic metadata embedding
- Album artwork support
- Artist and album information
- Download progress via WebSockets
Migrate Spotify playlists into Noctune in a few steps.
The backend:
- Reads Spotify playlist metadata
- Extracts song information
- Finds the best YouTube match
- Returns playable tracks
- Preserves playlist ordering
Generate waveform data used by the Noctune player.
Features include:
- Audio analysis
- Cached waveform generation
- Faster repeat requests
- Optimized for mobile visualization
Retrieve synchronized song lyrics using the Genius API.
Supports:
- Artist lookup
- Song lookup
- Clean lyric formatting
Backend support for:
- Playlist creation
- Playlist editing
- Playlist deletion
- Persistent storage
- Redis caching
Redis is used for:
- Temporary playlist migration
- Cached waveform data
- Session storage
- Faster API responses
Noctune Mobile App
β
β REST API
βΌ
FastAPI Backend
β
βββββββββββββββββ¬ββββββββββββββββ¬ββββββββββββββββ
β β β β
βΌ βΌ βΌ βΌ
Streaming Downloads Playlist Sync Lyrics
β β β β
yt-dlp FFmpeg Spotify API Genius API
β
βΌ
YouTube Audio
β
βΌ
Waveform Generation
β
βΌ
Redis Cache
NoctuneBackend
β
βββ Server.py # FastAPI application
βββ Download.py # Download pipeline
βββ Waveform.py # Waveform extraction
βββ Redis.py # Playlist management
βββ redis_cache.py # Redis caching
βββ spotify_meta.py # Spotify metadata
βββ HashMap.py
βββ config/
βββ requirements.txt
βββ README.md
| Technology | Purpose |
|---|---|
| FastAPI | Backend API |
| Python | Core application |
| yt-dlp | Audio extraction |
| FFmpeg | Audio transcoding |
| Redis | Caching |
| AsyncPG | Database connectivity |
| WebSockets | Download progress |
| Genius API | Lyrics |
| Mutagen | Audio metadata |
Client Request
β
βΌ
FastAPI Endpoint
β
βΌ
yt-dlp extracts audio URL
β
βΌ
FFmpeg transcodes stream
β
βΌ
StreamingResponse
β
βΌ
Noctune Player
User downloads song
β
βΌ
yt-dlp downloads audio
β
βΌ
Embed metadata
β
βΌ
Download album artwork
β
βΌ
Attach ID3 tags
β
βΌ
Notify client through WebSocket
git clone https://github.com/krishnanx/NoctunePython.git
cd NoctunePythonpip install -r requirements.txtCreate a .env file containing:
SUPABASE_URL=
SUPABASE_KEY=
REDIS_HOST=
REDIS_PORT=
GENIUS_API_TOKEN=redis-serveruvicorn Server:app --reload| Endpoint | Description |
|---|---|
/stream |
Stream music |
/download |
Download tracks |
/lyrics |
Fetch lyrics |
| Playlist APIs | Manage playlists |
| Migration APIs | Import Spotify playlists |
- Authentication
- Background task queue
- Adaptive bitrate streaming
- Audio caching
- Recommendation engine
- Search indexing
- Docker deployment
- Kubernetes support
Krishnan E
GitHub: https://github.com/krishnanx
This project is open source and intended for educational and personal use.