---
title: "I Built a GitHub Wrapped That Renders Your Year as an MP4, in the Browser"
seoTitle: "GitHub Wrapped Video: Your Year in Code as a Free MP4 (WebGL + WebCodecs)"
description: "Type any GitHub username and get a five-slide video of your year: total, weekly rhythm, longest streak, languages. WebGL shader, encoded to MP4 in-browser."
date: "2026-12-03"
type: "build"
tags: ["github", "webgl", "webcodecs", "video", "creative coding", "nextjs"]
output: "/lab/github-wrapped"
---

Every December, everyone posts a wrap of their year. I wanted one for code, in the same grainy, glowing look as [Afterglow](/lab/afterglow), and I wanted it as a real video file, not a screen recording. So I built it: [type a username at avivashishta.com/lab/github-wrapped](/lab/github-wrapped) and download your year as an MP4.

<div class="highlight"><p><strong>The short version:</strong> one serverless route reads a GitHub profile, the page turns it into five slides, and one WebGL shader draws each slide in its own shape and palette. Then the browser renders every frame at 1920 × 1080 and encodes it to H.264 itself, with WebCodecs. Nothing is uploaded, and it doesn't matter how slow the laptop is.</p></div>

## The five slides

Each slide is a different Afterglow shape, palette and typeface, so the video feels like five pages of one magazine rather than one template five times.

1. **Hello.** Your profile picture in the middle of the ring tunnel, your handle above it.
2. **The big number.** Your contribution calendar, the squares popping in one by one, with the total rolling up like a ticker and your longest streak, best day and share of days active underneath.
3. **Your rhythm.** Seven glowing bars, Monday to Sunday, in a warm palette and a serif headline: "You're a Thursday person". Plus your best month and your best week.
4. **The streak.** One poster-sized number over drifting blobs, with the dates it ran. If GitHub tells us, the split between commits, pull requests and reviews.
5. **Your language.** A turning globe with your top three languages and the repo most of your work went into. Then the sign-off.

## Where the data comes from

The route at `/api/lab/github/{user}/wrapped` tries two ways:

- **With a GitHub token**, one GraphQL query returns everything: the calendar, the profile, and `commitContributionsByRepository`, which says where this year's commits actually went. Languages are weighted by those commits, not by which repos you happen to own.
- **Without a token**, it reads the public contribution calendar from your profile page and asks the public REST API for your profile and repos. If GitHub rate-limits that, the video still works from the calendar alone.

Either way it's cached for a day per username, so a lot of people asking costs GitHub one request each.

Everything else, the streak, the weekday split, the best week and month, comes from the 365 numbers in the calendar.

## Rendering a real video in the browser

Afterglow records the canvas in real time with `MediaRecorder`, which is fine for eight seconds. For a 27-second video at full HD, real time is the problem: a slow frame becomes a dropped frame, and switching tabs ruins the take.

So this page doesn't record, it renders. The player is written so any moment of the story can be drawn from a time `t` alone, never from what happened on the frame before. The export loops `t` from 0 to 27 seconds in steps of 1/30, draws each frame, and hands the canvas to [Mediabunny](https://mediabunny.dev), which feeds the browser's own H.264 encoder and writes the MP4. Every frame is there, however long it takes. Browsers without WebCodecs fall back to recording in real time.

## Two things that made it look right

- **The type needs its own shadow.** Lavender text over a lime ring disappears. The shader now darkens the glow in a soft halo around the words. My first try blurred the text in the shader with a ring of samples, and it drew ghost copies of every letter. What worked: draw the words again at an eighth of the size, blur that on a 2D canvas, and use it as a shadow mask. It's cheap and perfectly smooth once scaled up.
- **Text only where the glow is quiet.** The rings are hottest at the top and bottom of the frame and dark around the middle, so the handle, the picture and the headline sit in that dark band. The layout has separate positions for 16:9 and 9:16, because a ring that's in the margin in one frame runs straight through the text in the other.

## Make one for your own site

<div class="promptbox">
  <button class="copybtn" type="button" data-copy>Copy prompt</button>
  <div class="prompt">
<p>Build a "year in code" video page. Input: a GitHub username. Add a server route that fetches the user's contribution calendar (GraphQL contributionsCollection with a token, else the public page github.com/users/NAME/contributions), plus profile and top languages, cached for a day.</p>
<p>Turn it into five slides of about five seconds each: an intro with their avatar, total contributions over the animated calendar grid, a Monday-to-Sunday bar chart of their busiest weekday, their longest streak as one huge number, and their top three languages. Give each slide its own background shape, palette and typeface. Draw everything in one WebGL fragment shader: a soft field per slide, a six-stop colour ramp, film grain, and the words uploaded as a texture with a soft dark shadow behind them. Numbers roll up digit by digit like a ticker. Fade through black between slides and show a story progress bar at the top.</p>
<p>Make the player a pure function of time, so it can draw any moment on demand. Export by stepping time at 30fps, drawing each frame and encoding it to H.264 MP4 with WebCodecs (Mediabunny's CanvasSource is the easy way), at 1920 × 1080 or 1080 × 1920. Fall back to MediaRecorder where WebCodecs is missing.</p>
  </div>
</div>

Try it with your username at [`/lab/github-wrapped`](/lab/github-wrapped), and send me what you get.
