Problem DJ Martin needed a platform where fans could stream his mixes for free and local independent artists could upload and sell their music. Existing platforms (SoundCloud, Bandcamp) don't support M-PESA, take large revenue cuts, and don't give artists direct control over pricing and payouts. A custom platform was the only viable path. Solution A full music streaming and marketplace backend. Fans stream DJ mixes freely. Artists upload tracks, set prices, and receive automated payouts. Built on Django with AWS S3 + CloudFront for audio delivery, FFmpeg for server-side transcoding, Paystack for payments, and Celery for async processing. Key Technical Decisions Pre-signed S3 PUT URLs for uploads: app server never handles audio bytes CloudFront signed URLs for streaming: byte-range support, edge caching, content protection FFmpeg for transcoding: produces HQ (192kbps) and preview (90s, 96kbps) derivatives; strips metadata with -map_metadata -1 Separate Mix and Track models: mixes are always free, tracks have pricing; clean business logic separation Paystack over M-PESA direct: cleaner API, reliable webhook delivery, supports card + mobile money Security Considerations HMAC-SHA512 webhook signature verification: prevents fake payment events hmac.compare_digest for constant-time comparison: prevents timing attacks on signature verification CloudFront signed URLs expire after a short window: cannot be shared or hotlinked SELECT FOR UPDATE on payment records: prevents duplicate purchase creation under concurrent webhooks FFmpeg -map_metadata -1 strips embedded metadata from audio files before storage Performance & Scalability CloudFront edge delivery: audio served from nodes close to the listener, not from the origin server Redis caches preview URLs and play count deduplication keys Celery handles all transcoding asynchronously: uploads return immediately F() expressions for play count increments: no read-modify-write race conditions Weekly payout batching via Celery beat: aggregates all unpaid purchases per artist in a single pass Measurable Results Live platform at theflyingdecksman.com 28% increase in repeat listen rates after recommendation engine deployment Local artists earning from music sales via automated Paystack payouts
- AI Engineer
- Back-End Developer
- Full Stack Developer
- +2






