Inspiration
I run a small creative team and I kept watching the same thing happen: we would produce a short form video, put real ad spend behind it, and watch it tank because the hook was not strong enough. Seventy one percent of users decide to scroll past a video in the first three seconds. If you miss that window, the rest of the production does not matter.
I looked for tools that could tell me whether a video would work before I spent money on it. Nothing existed. Traditional split testing burns the same ad budget you are trying to protect. Focus groups are slow and expensive. So I decided to build something that could predict attention using the same neuromarketing principles that the big research firms measure in labs.
What it does
Virality Predictor takes a short form video up to twenty seconds and runs it through a multimodal AI model that analyzes visual, auditory, and language cues simultaneously. It models how the human brain would respond and returns a set of quantitative metrics you can act on before you publish.
You get back a Viral Potential score, a Hook Score, a Hold Rate, and a second by second attention curve. Each metric maps to a specific brain activity region: Visual Cortex, Auditory Cortex, Language Network, and Attention Control. Focus drift timestamps flag the exact moments where viewer attention begins to drop, and each flagged moment includes a fix prescription you can apply immediately. Upload a video, get your score, apply the fixes, and publish with confidence.
No sign up required for the first prediction. MP4, WebM, and MOV formats are supported, both 9:16 vertical and 16:9 horizontal. Maximum one hundred megabytes, maximum twenty seconds.
How I built it
The frontend is Next.js 15 with Tailwind CSS v4 and Shadcn UI components, deployed to Cloudflare Pages via OpenNext. The prediction pipeline runs on Cloudflare Workers with Durable Objects for stateful processing. Video uploads land in Cloudflare R2. User data and credit accounting sit in Cloudflare D1 accessed through Drizzle ORM. Auth is NextAuth v5 with Google OAuth.
The core prediction engine is a multimodal classification model that processes visual, auditory, and language features in a unified inference pass. It correlates low level video features with known neural response patterns from published neuromarketing research and returns structured attention metrics. The model runs inside a Durable Object to keep state predictable and latency low.
The ROI calculator on the landing page is a lightweight client side slider that estimates monthly ad spend savings based on test volume and average budget per test. The whole thing is internationalized with next-intl and supports automatic language detection.
Challenges I ran into
Video processing at the edge. Cloudflare Workers have tight CPU and memory limits. Processing video files up to one hundred megabytes within those constraints meant I had to design the upload and inference pipeline carefully. Chunked uploads to R2 happen first, then the Worker triggers the model inference as a separate step inside a Durable Object where state can be held across the processing window.
OpenNext and Cloudflare Pages compatibility. OpenNext is still maturing and the integration with Cloudflare Pages is not always smooth. I ran into several edge cases around middleware routing, internationalized paths with next-intl, and server side session handling with NextAuth v5. Each one required reading OpenNext source to understand where the abstraction was leaking.
Keeping prediction latency under thirty seconds. Multimodal inference on video is inherently heavy. Getting from upload to scored output in a timeframe that feels instant to a user required careful model optimization and a pipeline that processes visual, auditory, and language features in parallel rather than sequentially.
Building trust without showing the model. Users cannot inspect the model directly, so I had to ground every metric in published research from Nielsen Consumer Neuroscience and Kantar. Each score dimension references a specific study and a specific neural mechanism. That transparency matters when your tool is telling someone their creative will fail.
Accomplishments that I am proud of
Zero friction first prediction. No sign up, no credit card, no email. Drop a video and get results. That was hard to design correctly with Cloudflare's edge architecture and credit accounting, but it was worth it. The first prediction experience is the entire product.
Sub-thirty-second prediction latency. For a fifteen second clip, the pipeline returns results in under thirty seconds end to end. That includes upload, inference across four neural dimensions, and structured output generation. Given the constraints of running this at the edge, I am happy with that number.
The attention curve visualization. The second by second attention curve that marks focus drift timestamps took several design iterations to get right. It had to be scannable enough for a busy performance marketer to use in five seconds, but detailed enough for someone who wants to understand exactly where their creative breaks down.
Shipping on Cloudflare's stack end to end. Workers, Pages, Durable Objects, D1, R2, OpenNext, and the AI binding. There are not many production apps that use every piece of Cloudflare's developer platform together under a single deployment. This one does.
What I learned
Building a product that depends on AI inference at the edge taught me a lot about designing for constraints. You cannot just throw more compute at latency problems when you are running inside a Worker. You have to think about pipeline architecture, parallelization, and what you can precompute.
I also learned that OpenNext on Cloudflare Pages is ready for production if you are willing to work through the rough edges. The dev experience is good enough. The hard parts are middleware, cookies, and server side session handling, not the basics of rendering and routing.
On the product side, I learned that "pre-publish testing" is a category most content creators do not know exists. They understand A/B testing after the fact. They understand focus groups. The idea that you can get a modeled read on attention before you publish is new to most people, which means the landing page has to educate before it can convert.
What is next for Virality Predictor
Public API. The number one request from early users is programmatic access. Teams running high volume content operations want to integrate pre-publish scoring directly into their workflow tools and content calendars. An API endpoint that accepts a video and returns the same structured metrics is in progress.
Long form content support. The current model is optimized for short form up to twenty seconds because that is where the hook window lives. Extending the analysis window to handle longer content will open up YouTube creators and traditional advertisers.
Batch processing. Content teams and agencies often need to score ten or twenty variants at once. A batch upload mode with comparative scoring across variants will let them pick winners from a lineup instead of testing one at a time.
Deeper metric breakdowns. Right now you get a score per brain region. The next version will break each region into subcomponents and give you a clearer picture of which creative element (visual, audio, text, pacing) is driving the score in which direction.
Built With
- cloudflare
- next.js
- typescript
Log in or sign up for Devpost to join the conversation.