Spotify Wrapped works because every user gets a story about themselves: a few big numbers, one card at a time, and a picture worth posting. You can build the same thing for your own app. This post walks through every part it takes, the bits that quietly eat the time, and how long it really is.

The six parts

  1. One row of stats per user. A query over a year of events.
  2. The slides. The words around each number, for every kind of user.
  3. A story player. Tap forward and back, progress bars, hold to pause.
  4. A private link per user, plus hosting and link previews.
  5. A share picture sized for Instagram and TikTok stories.
  6. Sending it: the link on the button of an email or push.

Part 1 is the same no matter how you do the rest, so here it is in full.

1. One row of stats per user

Everything downstream gets simpler if the data is one flat table: one row per user, one column per stat. This Postgres query works on a plain events table with a user, a timestamp and a duration:

with ev as ( select user_id, created_at, duration_seconds from events where created_at >= '2026-01-01' and created_at < '2027-01-01' ), totals as ( select user_id, round(sum(duration_seconds) / 60) as minutes, count(*) as sessions from ev group by user_id ), days as (select distinct user_id, created_at::date as d from ev), -- Consecutive days share the same (date minus row number), so each run of days is one group. runs as ( select user_id, d - (row_number() over (partition by user_id order by d))::int as grp from days ), streaks as ( select user_id, max(n) as streak from (select user_id, count(*) as n from runs group by user_id, grp) s group by user_id ), top_day as ( select distinct on (user_id) user_id, trim(to_char(created_at, 'Day')) as top_day from ev group by user_id, trim(to_char(created_at, 'Day')) order by user_id, count(*) desc ) select t.user_id, t.minutes, t.sessions, s.streak, d.top_day, greatest(1, ceil((1 - percent_rank() over (order by t.minutes)) * 100))::int as percentile from totals t join streaks s using (user_id) join top_day d using (user_id); 

The streak uses a classic trick. Number each active day in order, subtract that number from the date, and every run of consecutive days lands on the same value. Group by that value and the biggest group is the longest streak.

The percentile line gives each user a "top X%" number, with 1 as the floor so nobody is told they're in the top 0%.

Export the result as CSV and it looks like this:

user_id,minutes,sessions,streak,top_day,percentile u_1001,4820,212,31,Sunday,3 u_1002,1310,88,9,Tuesday,41 

I tested the query against a sample events table in PGlite (Postgres 16.4). If your events live in Mixpanel, Amplitude or PostHog instead, export one row per user from there and you end up with the same file.

2. The slides

Five to eight slides, one number each, the biggest thing on the screen. Writing them for your best user is easy. The work is everyone else:

  • The user with 2 minutes all year needs a slide that doesn't read like a scolding.
  • A "top 3%" slide only for the people it flatters, and something else for the rest.
  • "1 days", names with emoji, app names that wrap onto three lines, numbers in the millions.
  • Every slide checked against real rows, not the three test users you made up.

3. The story player

People already know how stories work, so it has to behave exactly like the ones on their phone: tap right for next and left for back, progress bars that fill, hold to pause, stop on the last slide. Then come the parts nobody plans for:

  • Phone browsers change height when the address bar slides away, and cut off your bottom line. Use 100dvh, not 100vh.
  • The tap that ends a long press also skips a slide unless you catch it.
  • Fonts that load late make the first slide flash in the wrong typeface.
  • Reduced motion, screen readers, keyboard arrows, and old Android phones.

The progress bars are the easy part. A CSS animation per bar, paused with one class:

.bars .now i { animation: fill var(--dur, 5s) linear forwards; } .story.paused .bars .now i { animation-play-state: paused; } @keyframes fill { to { width: 100%; } } 

4. A private link for every user

Don't put the user ID in the URL, or anyone can change one digit and read a stranger's year. Each link needs to be unguessable. Each page also needs hosting, a noindex tag so it stays out of search results, and its own link preview so it looks right when someone drops it into a group chat.

For 10,000 users, that's 10,000 pages and 10,000 preview images.

5. The share picture

The share is where the recap spreads, so it has to be a real picture, not a link: 1080 by 1920 pixels, the size of an Instagram or TikTok story. Where it gets fiddly:

  • Only some phone browsers can hand a picture straight to the share sheet. The rest need a download.
  • Links opened inside Instagram, Gmail or Slack open in their own browsers, which often block both.
  • Fonts and emoji have to be drawn into the picture, and they render differently on each phone.
  • Leave off anything that would embarrass someone in public, like money spent or late-night usage.

6. Send it

Your build should spit out one file with each user's ID and link. Import it into your email or push tool (OneSignal, Customer.io, Braze, whatever you use) as a custom field, and put the link on the button of a short December email.

How long it really takes

Build it yourself
Your work The query, the slides, the player, links, hosting, share pictures, link previews, sending, and testing it all on real phones
Time A week or more for a plain web version. 3 to 6 weeks for a designed one that holds up on every phone
Cost Developer time in your busiest month, plus hosting

Building makes sense when the story has to live inside your native app and you have a developer free in December.

If you'd rather skip parts 2 to 5, that's what I made Yearcap for. You bring the CSV from part 1 and get a designed story, a private link, a preview and a share picture for every user. It's free up to 500 users.

Either way, the query above is the hard-to-get-right part, so feel free to take it.