Swiftbeauty.
Platform for the beauty industry with a directory of masters, a shop, a subscription video academy, live events and webinars, and reviews. I built most of the new Next.js app with Sanity, PostgreSQL and Stripe and the tooling to move the old PHP data. The hard parts were video access, linking Stripe to legacy members and planning the move of a live subscriber base.
- Year
- 2025
- Built for a client
- My part
- Lead developer
My role
I led 1 other developer and built about 80 percent of the new Next.js app meant to replace the old PHP back end: the UI, the server part and API, and the docs and tests. The other developer built a few pages and did fixes. The app has 50+ pages and routes and 80+ Prisma models, mostly legacy tables, covered by 140+ test files.
Capabilities
Shop
Academy
- Video courses in modules and chapters, with filters, search and save for later
- Basic, Pro and Expert plans billed monthly, every six months or yearly
- Practice owners invite guests into a shared subscription
- Mux playback with signed tokens, one stream per member and saved watch progress
Site and content
- Directory of masters, events and webinars, reviews, gallery and before and after cases
- Sanity Studio embedded in the site for editors
Accounts and migration
- Sign-in with email, Google, Facebook and Apple, plus phone codes through Twilio
- MySQL to PostgreSQL import and cutover scripts with dry runs
- Playwright and Vitest suites with a page-coverage gate in CI
Patterns and decisions
- Stripe is the source of truth for plans, prices and customers. One sync function mirrors it into the database, and the webhook calls it.
- Product copy lives in Sanity. Price and ids come from Stripe through an editor action called "Sync from Stripe" and the product and price webhook events.
- The Stripe webhook runs the state steps before it answers. Notifications and analytics run after the response, with three attempts and a 15 second bound.
- Access to a video is one pure function of the member row. The page gate and the token gate both use it, so they cannot disagree.
- Most public pages render from Sanity. A circuit breaker trips when Sanity answers 402 over quota, and the pages and the sitemap fall back to a static list instead of failing.
- Academy module pages are dynamic, because they read the session and the saved watch state.
- The four Cron routes on Vercel fail closed behind a shared secret.
- A page-coverage gate fails CI when a new page ships without an end-to-end test path, and its baseline can only shrink. Vitest covers the units and Playwright the journeys, accessibility and SEO, in 140+ test files in all.
Cases
Video access that makes harvesting by a paying member hard. A signed Mux token can be handed to ffmpeg and turned into an MP4. The options were measured and each member is limited to one stream. The slot claim is race-free because of a unique constraint on member and slot, not a count followed by an insert. A ceiling of 25 distinct chapters an hour and a honeypot module that records a PostHog event on direct slug access add two more layers.
Lifecycle emails that are neither lost nor sent twice. A webhook redelivery or an interrupted background task can lose an email or send it twice. A ledger table has a unique event key. A compare-and-swap claim runs before the call to the email provider, a sweeper cron retries stuck rows, and a provider-side unique id is the second layer.
A cutover that refuses to be wrong. The task was to move users, subscriptions and statuses from a MySQL dump to PostgreSQL without breaking paying members. The scripts are re-runnable and default to a dry run. The Stripe warm-up and reconcile scripts print whether the key is live or test and refuse to apply on a test key. A destructive-sync constant needs a commit to turn on, so the sync cannot cancel subscriptions by accident. A one-page checklist has a confirm step for each move.