Project case study

Full-stack engineering / 2026

Summarist

Paid access the browser can’t fake.

A book-summary and audiobook app rebuilt in a virtual internship: Firebase sign-in, a reader and audio player, search, a saved library and Stripe subscriptions, with every paid read checked on the server.

Explore live project
Project
Virtual internship (supplied brief and design)
Role
Full-Stack Development
Built with
Next.js 16 · React 19 · TypeScript · Firebase · Stripe
Code
View on GitHub ↗
Summarist For You page: a sidebar with For You, My Library, Highlights and Search, a Selected just for you card for The Lean Startup, and rows of recommended and suggested books with Premium labels
The For You feed: each row loads on its own, with its own loading, empty and retry states.

01 / The brief

Eleven stages, one branch each.

Summarist was a virtual internship. I received a written brief, a reference design, a static HTML starter and a public book API, and rebuilt the product as a Next.js app: sign-in, a For You feed, book details, a reader and audio player, search, a saved library, paid plans and account settings.

I built it in eleven stages over ten days. Each stage had its own branch and was merged through a pull request, and the README records what each one added and what it deliberately left for later. The visual design was supplied. My job was the engineering.

02 / The key decision

The browser never decides who has paid.

A premium badge in the interface is a suggestion, not a lock. Hiding a Read button only stops people who don’t know where the content comes from.

So every protected read goes through a server route. The route verifies the Firebase ID token, checks that the session hasn’t been revoked, then asks Stripe for the account’s current subscription before it returns anything. The Firestore rules deny all direct access from the browser, so billing records are only reachable through those routes.

One honest limit: the book API was supplied by the internship and is public, so this gate protects the app, not the source. In a real product the content would sit behind the same server check.

app/api/books/[id]/content/route.ts ↗
export async function GET(
  request: Request,
  { params }: { params: Promise<{ id: string }> }
) {
  try {
    const { id } = await params;
    if (!/^[a-zA-Z0-9_-]{1,128}$/.test(id))
      return Response.json({ status: "empty" }, { status: 404 });
    const user = await identity(request);  // verified, unrevoked ID token
    if (!(await subscription(user.uid)).entitled)
      return Response.json({ status: "blocked" }, { status: 403 });
    // …fetch, validate and return the summary and audio
  } catch { return Response.json({ status: "error" }, { status: 403 }); }
}
Summarist book page for How to Win Friends and Influence People in the Digital Age, with rating, key ideas, duration and format, Read and Listen buttons, and an Add title to My Library link
Read and Listen route by subscription, but the content route checks again on the server.

03 / Subscriptions

A webhook can arrive twice, late or out of order.

Stripe sends billing events whenever it likes. The same event can arrive more than once, and an old “subscription updated” can land after a refund. If the app trusted each event as it came in, a retry could charge twice or a stale event could quietly restore access that a refund had removed.

So every webhook must pass Stripe’s signature check and is rejected if it comes from live mode. Each event ID is written inside a Firestore transaction, so a repeat is ignored. A full refund or a dispute sets a block that no later subscription event can clear. Checkout holds a short lease and uses idempotency keys, so retrying after a lost response returns the same session instead of a second one.

app/api/billing/webhook/route.ts ↗
// Persist risk blocks separately: old subscription events
// must never restore refunded/disputed access.
await database().runTransaction(async (tx: Transaction) => {
  if ((await tx.get(eventRef)).exists) return;  // already processed
  const data: Record<string, unknown> = { updatedAt: Date.now() };
  if (event.type === "charge.dispute.created" ||
      (event.type === "charge.refunded" && object.refunded === true))
    data.blocked = true;
  if (event.type.startsWith("customer.subscription.") && object.trial_start)
    data.trialUsed = true;
  tx.set(customer, data, { merge: true });
  tx.create(eventRef, { type: event.type, created: event.created,
                        processedAt: Date.now() });
});
Summarist plan picker with Premium Plus annual at $59.99 a year with a 7-day free trial for eligible first-time subscribers, Premium monthly at $9.99 a month with no trial, and a Continue with annual button
The trial is offered only when Stripe shows no earlier trial for that customer. Guest accounts can’t subscribe.

04 / Search, reader and phone

Small details that stop the screen fighting you.

Search waits 300 milliseconds after the last keystroke, cancels the request it replaces and ignores any answer that arrives late, so results never jump back to an older query. Arrow Down moves into the results and Escape closes them.

The reader has four text sizes. The audio player is built on the native audio element, with skip back and forward 10 seconds, keyboard seeking and playback speed, and it never starts playing on its own. The sidebar becomes a menu on phones and returns focus when it closes.

Summarist For You page on a phone with the search field, a menu button and the Selected just for you card for The Lean Startup
Phone: the For You feed
Summarist plan picker on a phone with the annual and monthly plans stacked
Phone: choosing a plan

05 / Verification

Fails closed, and tested where it can break.

40 tests on Node’s built-in test runner cover the book loaders, search, the access rules, the billing policy, the billing routes and the library, plus one test against the Firebase emulator. The project also passes strict TypeScript checks and the Next.js lint rules.

Sign-in can run entirely against a local emulator that refuses to connect to the live project, so I could test accounts without touching real users. If the configuration is missing or the emulator and live settings disagree, the app refuses to start sign-in instead of guessing. Stripe runs in test mode only, and the server rejects live keys by design.

Next: run these suites in GitHub Actions on every pull request, the way Proofline does, so the checks don’t depend on me remembering to run them.

Explore the work

Browse the library.