How I Designed a Scalable Music Streaming Platform Without Burning Cloud Costs
Habib Qureshi
MVP Developer
6 min read
Jan 22, 2026

A client came to me with an idea that he wants to build a music streaming app for music fans. The app needed to play both audio and video. It had to run on iPhone, Android, and the web. It had to support free users (with ads) and paid users (with offline downloads and no ads). And it had to launch in a few months. That was the easy part. The hard part was the budget.
What the Client Wanted
- A working app in 3 to 6 months, ready for 20k+ users at launch.
- Growth to 100k+ users within two years.
- Monthly cloud cost between $300 and $500.
- Fast playback: A song should start in under one second.
- Smooth experience on slow internet.
- Built to grow later: AI recommendations, social features, ads, and DRM.
He was also clear about what he did not want: No Kubernetes, no microservices, no expensive AWS services like MediaConvert, and no heavy analytics tools on day one.
The Core Idea Behind My Design
The backend should never touch the actual music or video files. Music and video are big. If the backend had to stream video to users, the cloud bill would blow past $500 in the first week. So I designed the system in two halves:
- The backend handles logins, playlists, payments, search, etc. (JSON data).
- Cloudflare handles all the music and video (Storage, delivery, playback).
The Architecture

Module by Module Breakdown
- Auth & Users: Secure sessions with JWT + Redis.
- Subscription: Stripe and Apple integration.
- Media: Cloudflare signed link generator.
- Playlists: Private and public rankings.
- Offline Downloads: Encrypted local storage (see below).
- Search: Elasticsearch for millisecond results.
Why I Chose Each Technology
- NestJS: Clean, modular TypeScript code.
- PostgreSQL: Rock-solid relational data.
- Redis: Caching popular songs and tokens.
- Cloudflare: Low egress costs + global CDN edge.
- AWS ECS Fargate: Cheap, serverless container hosting.
- Elasticsearch: Fast search for millions of tracks.
The Two Tricky Problems I Solved
Problem 1: Offline Downloads That Cannot Be Stolen
Encryption with split keys. The actual key is sent to the user's phone and stored in secure storage (Keychain/Keystore). The song is encrypted on the phone. The key never leaves the device.
Problem 2: Counting Plays Without Killing the Database
A 30-second rule plus a cache table. A play only counts if listened for >30s. We use a pre-calculated totals table for artist dashboards to keep it fast.
The real skill is saying no to complexity until the product actually needs it. Boring, simple, and well-chosen beats clever every time. Let’s build your scalable MVP!
— Habib Qureshi