All case studies
Pay-Per-View Web App · Proof of concept

Clipping Marketplace

A pay-per-view marketplace for short-form video. Brands fund campaigns at a rate per 1,000 views, and clippers earn from the views their posts get on TikTok, Instagram, YouTube and X. Every cent between them moves through one double-entry ledger.

Web
Demo data from the proof of concept: a brand's overview with views, spend and budget left, and a clipper's submissions with views, earnings and review status
Role
Spec, web app, worker, payments
Platform
Web
Type
Two-sided marketplace
Status
Proof of concept · 2026
Overview

This is a pay-per-view marketplace for short-form video, built for a client whose product hasn't been named or branded yet. Brands fund campaigns at a rate per 1,000 views. Clippers post clips on their own TikTok, Instagram, YouTube and X accounts, submit the links, and earn from the views those posts get. The platform charges fees, pays out withdrawals and runs a referral program.

Clippers and brands each get their own app, with a small admin console beside them. A separate worker process does everything that waits on a clock or on another company: counting views, approving clips nobody reviewed, sending payouts and posting scheduled videos to the social platforms.

It's a proof of concept. It hasn't launched or handled a real campaign, and the interface is deliberately unbranded, black and white with colour only where a status needs it, so the client's branding can go in later by changing design tokens. The screens on this page come from its seeded demo data, cropped to leave the product's working name out.

The client's commercial terms, such as the fees, the minimum withdrawal and how long a brand has to review a clip, are left off this page. They're settings the client can change, so this page describes the rules without the numbers.

The problem

What we set out to solve

A marketplace that pays per view sits between two groups who each want to be sure of the numbers. A brand wants to pay only for real views on posts made for its campaign, and never more than the budget it put in. A clipper wants every view counted and paid, and wants to withdraw without waiting for someone to press a button.

Each of those wishes turns into a rule someone has to write down. Which posts count, and from when. What a view is worth if the brand later wants a different rate. What happens to a clip nobody reviews, and to money a brand disputes with its card issuer after clippers have already earned from it.

Then there's the posting. Clippers can schedule videos to post themselves on their connected accounts. That means video files too large to pass through a web request, handed to a third-party posting service by background jobs that have to cope when a platform is slow or refuses a post.

Our approach

How we built it

We wrote the money rules down before building screens, and the screens read a real database from the first day, filled by a seed script instead of mock files. Every cent moves through one ledger module, and nothing else in the code is allowed to write to the ledger.

01

A double-entry ledger in whole cents

Every money movement is a transaction whose lines add up to zero, stored append-only in integer cents and rounded down wherever a share is worked out. A balance is the sum of its lines, so any wallet, budget or fee can be explained line by line. A campaign's remaining budget is its ledger balance, with no separate budget column to drift out of step.

02

Brands pay the fees on top

A brand chooses a budget, and checkout charges that budget plus one fee line. The campaign receives the whole budget and the fee is booked as platform revenue in the same step. A top-up is another payment and another funding entry, and an admin can record a budget paid by bank transfer.

03

A clip's rate is fixed when it's submitted

The campaign's rate per 1,000 views is copied onto each clip when it is submitted. Once a campaign is live, its rate, its optional limit per clip and its start date are locked, so a new rate means a new campaign.

04

One path from views to money

Earnings are written by one function only. It works out what a clip is owed from the highest view count ever seen, subtracts what it has already been paid, and caps the difference at the budget left and the clip's limit. Views that later drop never take money back.

05

Background jobs on the same Postgres

Anything that waits on a clock or on another company runs in a separate worker on pg-boss, a job queue that lives in the app's own Postgres. The jobs that pay or post are written so that a second run, or two workers on the same row, can't do it twice.

06

One small module per outside service

bundle.social, Stripe, storage and email each sit behind one module, so a provider can be replaced without touching the rules. Tests swap those modules for fakes and run the money code against a real Postgres database.

Capabilities

What it does

Campaign funding

Brands fund through Stripe Checkout. The campaign gets the whole budget, the fee goes to revenue, and a payment confirmation delivered twice still funds the campaign once.

Clips checked against the account

A submitted link is matched against the posts bundle.social imported from the clipper's own connected account. Posts made before the campaign started, or before the clipper joined the brand, don't count.

Views counted on a schedule

The worker polls every live clip, keeps a snapshot history, and credits approved clips from the highest count seen. Views keep counting for a set window after a post goes up, and X posts are refreshed on request because bundle.social only updates them when asked.

Review with a deadline

Brands approve, deny with a reason, or flag a clip for an admin. A clip nobody reviews is approved by the worker after a set time, and the brand gets a reminder before that happens.

Budget caps and a limit per clip

Crediting stops at the campaign's remaining budget, and a brand can cap what any one clip can earn. When the budget runs out, the campaign ends itself.

Withdrawals

A clipper withdraws to a bank account or a USDC wallet once their balance clears the minimum, and sees the fee before confirming. Changing where payouts go needs an emailed confirmation and pauses withdrawals for a while.

Referrals paid from the platform's fee

Every user gets a short referral link, and the first link a visitor followed is the one that counts. When a referred clipper withdraws, the referrer gets a share of the platform's fee, so it costs the clipper nothing.

Flat offers and bounties in escrow

Brands can also send a flat-price offer to a specific page or post a bounty for a small task. The money moves into escrow when the offer is sent or the bounty is published, and goes back to the brand's campaign if nobody earns it.

Scheduled posting

Clippers upload videos straight from the browser to storage and schedule them for their connected accounts. Close to the post time the worker hands each one to bundle.social, reads back the result, and can submit the live post to a campaign.

Under the hood

Architecture

One Next.js 16 app serves the clipper app, the brand app and the admin console, and a worker process from the same repository runs the background jobs. Both share the database, the ledger module and the service modules. It's self-hosted as containers built from one image, and the migrations run in their own short-lived container before the site and the worker start.

Clipper app

Dashboard, wallet, campaigns, submissions and connected accounts, plus a Create area where clippers upload, edit and schedule videos. Captions from speech are made on the server with whisper.cpp, so the audio never leaves it.

Next.js 16Better Authbundle.socialS3-compatible storage
Brand app and admin

Brands apply for a workspace, run orgs and campaigns, decide which clippers join, review clips and track views, spend and effective cost per 1,000 views. Admins approve workspaces, hold or release withdrawals, reverse a bad clip's earnings and settle disputed offers.

Next.js 16Stripe CheckoutRecharts
Worker

A Bun process running pg-boss on the app's Postgres. On a schedule it polls views, ends campaigns, approves clips nobody reviewed, sends reminders and withdrawals, pushes and syncs scheduled posts, and renders video exports with ffmpeg.

Bunpg-bossPostgreSQLffmpeg
Tech stack

Built with

App
Next.js 16
App Router, React 19
Better Auth
Sessions kept in Postgres
shadcn/ui
Unbranded, restyled through tokens
Recharts
Brand views and spend charts
Money & data
PostgreSQL
App data, ledger and job queue
Drizzle ORM
Schema and migrations
Stripe Checkout
Campaign funding
Stripe Global Payouts
Bank and USDC withdrawals
Jobs & media
pg-boss
Scheduled jobs in Postgres
bundle.social
Accounts, view counts, posting
S3-compatible storage
Uploads straight from the browser
whisper.cpp + ffmpeg
Captions and exports on the server
Hard parts

Engineering challenges

Challenge

A view poll, a brand's approval and the end of a campaign can all reach for the same budget at the same moment.

Solution

Every money transaction locks the accounts it takes from, in a fixed order, then checks the balance and writes. Tests run concurrent credits against one budget, a poll racing an approval for the last cents, and a credit racing the end of the campaign. None of them overspends or pays a clip twice.

Challenge

Payment providers retry their messages, and a lost reply can mean the money moved anyway.

Solution

Transactions started from outside carry an idempotency key built from the event, so a funding confirmation delivered twice funds the campaign once. A withdrawal whose send fails without an answer stays in processing and is retried with the same key, instead of being refunded blind.

Challenge

A link to a post proves nothing about who made it.

Solution

Submitting expands share links, normalises the permalink and looks for the post among those bundle.social imported from the clipper's own account, asking for one re-import before giving up. A unique key on platform and post id means a post can earn in one campaign only, ever.

Challenge

A campaign needs a clean end, or views keep arriving after the money should have stopped.

Solution

A campaign ends when its budget runs out, its end date passes or the brand ends it. The worker then runs one last poll and credit for its clips and seals it, and view counts captured after that are never paid.

Challenge

A brand can dispute its card payment after clippers have earned from it.

Solution

A dispute pauses the campaign and takes the disputed amount out of its budget, letting the balance go below zero, which stops all crediting. Money clippers have already withdrawn is handled by an admin case by case.

Challenge

A scheduled post goes through a third party, and a crash at the wrong moment could post the same video twice.

Solution

Each scheduled post is a row in our own database until it's close to its time. The worker creates it on bundle.social with that row's id as the reference key, so after a crash or a second worker the existing post is picked up instead of created again. Large files go up in parts.

Screens

A look inside

Outcome

What shipped

A working proof of concept of both sides of the marketplace, with the admin console and the worker. It hasn't launched or handled a real campaign, and it carries no client branding yet.
Every cent moves through one append-only double-entry ledger, so any balance, budget or fee can be traced line by line.
More than 80 test files. The money tests run concurrent credits, repeated webhooks and racing withdrawals against a real Postgres database.
Fees, the referral share and the minimum withdrawal are settings, so the client can set its own terms without a code change.
Scheduled posting to TikTok, Instagram, YouTube and X through bundle.social, with uploads that go straight from the browser to storage.
Nothing has moved real money yet, and the client's branding still has to go in before launch.

Want us to build something like this?

Tell us about your project. Notchip scopes, designs, and ships on a milestone basis — you only pay for results.

Start a project
Next case study
Wageasy