• internship
  • 2025
  • Frontend
  • Code splitting
  • Payments
  • Live video

Modulus prepares people for interviews in consulting, product, finance and other non-tech roles, with cohorts, mentorship, live sessions and peer practice.

As its frontend engineer I built the web app from the first screen, about 29,000 lines of TypeScript: the pages that sell a program, booking and payment, scheduling with a mentor, live sessions with chat beside the stream, and the admin console. It sits on the backend team's API, Razorpay, Cal.com and Firebase, and leaves nothing that matters to the browser: prices, payments, bookings and who you are in chat all come from a server.

The Modulus home page: a shortcut to non-tech interview preparation, with a tile for each role.
a way in for every role
A cohort page: the program, its curriculum and an enroll button beside the price.
cohorts, paid through razorpay
Sessions and workshops: a recorded session with its date, time and a watch now button.
live sessions over hls
Type
internship
Role
Frontend Engineer Intern, remote
When
Apr to Aug 2025
Stack
React, TypeScript, Vite, React Router, TanStack Query, Tailwind, Razorpay, hls.js, Firebase, PostHog
Links
trymodulus.com
routes, 29 loaded on demand
45
states in the booking flow
7
of the week on Peerlist
#8

What I built

  • Only the page you open

    Routes loaded on demand behind a skeleton of the page, so a visitor downloads the page they asked for and never sees a blank one.

    How it works
  • A cache per kind of data

    54 queries on TanStack Query, each fresh for as long as its data stays true, and a change refreshes only the keys it touched.

    How it works
  • Filters you can share

    Search and filters kept in the URL on every list, with a 350 ms debounce, so a link or the back button lands exactly where you were.

  • Payments the browser never decides

    Razorpay orders created and priced on the server, a booking flow for credits or card, and a payment final only when the signed webhook arrives.

    How it works
  • Live sessions

    HLS in the browser with Safari's own player as the fallback, a go-live dashboard for mentors, and chat on Firebase with server-issued tokens carrying each user's role.

    How it works
  • Access by role

    20 routes behind login and 4 more behind the mentor or admin role, which the API checks again; the page guards just keep people off pages that would refuse them.

    How it works
  • The admin console

    Intern and mentor applications fetched in parallel and merged into one searchable, paginated table, its page and filters in the URL.

  • Fixes in the API

    The Cal.com webhook that confirms a booked call, which read our session id from the wrong field, and login refused until an email is verified.

    How it works

How it fits together

React appVite · 45 routes · 29 lazycohorts · programsbooking · enrollmentlive stream playerfilters in the URLquery cache per resourceModulus APIbackend teamRazorpayverified by webhookCal.comschedulingHLS + Firebaselive sessions · chat
The browser asks and the servers decide: prices come from the API, a payment counts when Razorpay's signed webhook reaches it, a booked call when Cal.com's does, and chat signs in with a token the API mints.

Only the page you open

Pages load on demand behind one Suspense boundary whose fallback is a skeleton of the page, so a slow network shows the shape of what's coming instead of a blank screen. Each lazy page is its own chunk, 1 to 9 KB gzipped on a production build, fetched the first time its route opens.

A logged-out visitor who opens a members' page sees it blurred under a sign-in prompt, and lands back on it after signing in; an unfinished profile is sent to finish it first.

Fresh for as long as the data is true

Every read goes through TanStack Query, and each kind of data keeps its own clock: a peer match's status is fresh for 15 seconds and polled every 30, posts and comments for a minute, mentors for two, questions for five, a question's official answer for fifteen. Filters and the debounced search are part of the query key, so each combination is cached on its own, and a mutation invalidates only the keys it changed.

Some reads cost more than others. AI mentor picks are a model call on the server each time, so the browser keeps each user's for an hour.

Payments the browser never decides

The page never names a price. It asks the server to start an order, which sets the amount, and checks the answer (an order id, an amount above zero, a key) before Razorpay's checkout opens. Booking a mentor is a small state machine, from idle through initiating and pending payment to scheduled, with an error state at each step, and it branches on whether the session is paid with a credit or a card.

Success on the page is not success: the payment is final when Razorpay's signed webhook reaches the backend, so a closed tab or a forged callback changes nothing. Until then the booking shows as paid and pending, and the views that depend on it are fetched again rather than patched by hand.

Scheduling follows the same rule. Once the payment is confirmed, the mentor's Cal.com link goes out by email, and Cal.com's own webhook turns the call into a session. In the API I fixed that webhook: it read our session id from the wrong field of the booking's metadata and turned away bookings with fewer than two attendees.

Live sessions, with chat beside them

Mentors go live from a dashboard with their RTMP address and a masked stream key, and viewers watch over HLS in the browser, with Safari's own player where it has one; a page opened early checks every 15 seconds until the stream starts.

Chat runs on Firebase's Realtime Database beside the stream. It signs in with a token the API mints, carrying whether you are a mentor or an admin, reads only the latest 100 messages, and stamps each with the server's clock rather than the browser's.

What breaks first at 10× the traffic

The first download. On a production build the main chunk is 552 KB gzipped, because 14 pages are still imported up front, the two live ones among them, and with them hls.js and Firebase. I measured the fix on trial builds of the code as I left it: making just the live pages lazy takes the main chunk to 369 KB, and all 14 to 242 KB, so the home page downloads 307 KB of JavaScript instead of 569.

After that, Razorpay's checkout script, which sits render-blocking in the head of every page though the checkout hook already loads it when it's needed.

Then the data: questions are fetched whole and filtered in the browser, fine for hundreds and not for tens of thousands, so search and paging move to the server, and chat pages back past the messages it loads first.

What I'd change. The session token out of localStorage, where any script on the page can read it, and into an httpOnly cookie; and a bundle budget checked in CI, so the first download can't quietly grow back.

Keyboard shortcuts

Anywhere on the site, while you are not typing.

M
Weather sound on or off
E
Copy my email
T
Day or night
S
Change the season
D
Portfolio
?
These shortcuts
Esc
Close what is open