
06 · Movie & series marketplace
Treasures Movie Bank
Preview, buy and download movies and series.
- Category
- Movie & series marketplace
- Role
- Product design & full-stack engineering
- Built by
- Empire Pro Dev
- Links
- Live product


Screens
Treasures Movie Bank interface
Overview
A mobile-first marketplace for movies and series. Visitors browse a curated catalogue and watch free previews, then buy a title, a single episode or a whole season and download what they own through short-lived secure links. Staff manage the catalogue, uploads, orders and settings from an admin dashboard.
Product areas
- Catalogue & search
- Free previews
- Purchases
- Episodes & seasons
- Secure downloads
- Payments
- Admin dashboard
- Installable app
Technologies
- Next.js
- TypeScript
- Tailwind CSS
- Supabase
- PostgreSQL
- Cloudflare R2
- React Query
Case study
From problem to product
The complete engineering lifecycle behind Treasures Movie Bank.
- 01
Problem
Selling films digitally means protecting the files: a buyer must be able to download what they paid for, and nobody else should be able to reuse their link.
- Buyers need to download what they paid for, reliably
- Download links must not work for anyone who did not pay
- Distribution rights expire and have to be respected
- 02
Idea
Treasures Movie Bank: a catalogue with free previews, purchases down to a single episode, and downloads issued only after ownership is checked.
- Free previews before buying
- Buy a film, a single episode or a whole season
- Short-lived, private download links
- 03
Approach
I started with the rules that protect the business, ownership, pricing and downloads, and put them in the database itself, so no screen or API can go around them.
- Access rules enforced by the database, not only by the application
- A built-in demo catalogue, so the interface can be explored before any backend exists
- A payment interface that does not depend on any single provider
- 04
Architecture
Full films sit in a private storage bucket. Each download request is checked in the database for ownership, distribution rights, file readiness and download limits, and only then is a link issued that expires within hours and is never cached.
- Storefront, sign-in, admin and API routes in one Next.js application
- Server-only modules for auth, catalogue, commerce, payments and storage
- Two buckets: a private one for films and a public one behind a CDN for artwork
System architecture
3 layers · 10 modules
L01Experiences
3 modules- Storefront
- Account & library
- Admin dashboard
L02Services
4 modules- Catalogue & search
- Checkout & payments
- Download authorisation
- Uploads
L03Data & storage
3 modules- PostgreSQL · Supabase
- Row-level security
- Cloudflare R2
Conceptual architecture: layers and their responsibilities. - 05
Design
The storefront is mobile-first, with a gold-and-ink brand, square corners throughout, and light and dark themes.
- Search from anywhere through a command palette
- Curated collections and genres on the home page
- Installable as an app, with its own icons and splash screens
- 06
Development
The app is TypeScript on Next.js, with Supabase for the database and sign-in, React Query on the client and Zod validating every input.
- Admins upload large videos straight to storage in resumable parts, never through the app server
- A sandbox payment provider for development and a Paystack adapter for mobile money, cards and bank
- Clean download file names, and a log of every download attempt, granted or denied
- 07
Data
Prices are always computed in the database from the catalogue, and an order is marked paid only after a verified webhook from the payment provider, never because the browser says so.
- Trending scores recomputed on a schedule from views, previews and sales
- Unpaid orders expired automatically, so abandoned checkouts never block buying again
- Keyset pagination for fast browsing of a large catalogue
- 08
Testing
Database tests run the real migrations on an in-process Postgres to cover access rules, pricing, payment idempotency, ownership and download limits, alongside unit tests for redirects, filters and webhook signatures.
- Access rules and adult-content gating
- Search and pagination
- Pricing, payment idempotency, ownership, download limits and refunds
- Open-redirect protection and webhook signatures for both payment providers
- 09
Deployment
The app deploys to any Node host, and a single check command runs type-checking, linting and every test before each deploy.
- A Content Security Policy built from the configured database, storage and media hosts
- Artwork cached at the edge under versioned file names
- A service worker that never caches account, checkout, admin or API responses
- 10
Result & current state
The storefront, purchases, secure downloads and admin dashboard are built and tested. Before launch: a live payment test, legal review of the terms and privacy pages, and the first licensed titles.
- Complete: catalogue, previews, purchases, secure downloads and admin
- Next: live payments and launch content
What building it taught.
Challenges
- Stopping one buyer's download link from working for anyone else
- Uploading very large video files from a browser
- Trusting payment callbacks
Solutions
- Links issued only after a database ownership check, expiring within hours and never cached
- Resumable multipart uploads straight to storage
- Webhooks verified by signature, re-checked with the provider and matched against the order amount
Lessons
- Put the rules that matter most where nobody can skip them: in the database
- Test security rules against a real database engine, not mocks
- Keep payments behind an interface, so the provider can change







