Skip to content
← PortfolioLive at focuship.appNext.js PWA + Laravel

Focuship · Case study An ambient sound mixer PWA and OAuth MCP server in eight days.

A mobile-first ambient sound mixer and focus timer that runs offline as a Next.js PWA, with a Laravel backend and a Model Context Protocol server so AI assistants can build mixes.

●64 sounds, offline✓660 tests passingMCP 16 tools
Days8
My commits47
With Claude36
ADRs5
My role
Architect and developer, with Claude Code as pair
Team
1 engineer, 1 monorepo (Next.js + Laravel)
Timeline
Eight days
Stack
Next.js 15, Web Audio API, Laravel 11, Cloudflare, Playwright, Pest
01 — Timeline

47 commits, 44 of them in the first three days.

Pick a day to see what shipped.

Day 1 · 23 commitsThe mixer as an offline PWA on Cloudflare, renamed Focuship, then the SEO pages, their quality gate and the research guides.
02 — Platform

Static at the edge, a server only for accounts and AI.

  • Audio on the first tap, no seams
  • Static export, no SSR
  • Plays offline once cached
  • No account needed
  • Guides cite peer-reviewed DOIs
Edge PWA · focuship.appNext.js app shellstatic export · out/Service workeroffline cache per pageWeb Audio enginedual-deck crossfade loopcookieLaravel 11 · api.focuship.appSanctum authhttpOnly cookie sessionApp\Account\Librarypresets · caps · settingscatalog.json64 sounds, exported from TStoolsMCP · api.focuship.app/mcpAI assistantClaude, Cursor, agentsPassport OAuth 2.1RFC 8414 discovery · PKCEMCP server16 tools, 2 resources
Edge PWA: A static Next.js export served from Cloudflare’s edge, with no server rendering. Sounds fetched once play from the local cache, through a Web Audio engine that loops on two crossfading decks.
03 — Key decisions

Five calls that shaped the app.

The first day

Zero-latency audio and the PWA foundation

The first day took the mixer from an idea to an offline PWA on Cloudflare, with audio that starts on the tap and loops without a click. A starship drone is synthesised live from detuned oscillators and filtered brown noise.

Web Audio · dual-deck loop · PWA
day one
14:43First build: a mobile-first ambient mixer PWA16:16Fullscreen, V/F shortcuts, Safari audio session16:52Static deploy to Cloudflare22:18Renamed Focuship, offline cache per page22:39A synthesised drone and a Deep space preset✓ installable, offline, on the edge
Programmatic pages

Landing pages that must earn their index

A page is indexable only if it has its own audio setup, full copy, FAQs and checked cross-links. One that fails still works, but gets noindex and stays out of the sitemap and llms.txt.

Page registry · quality gate
TemplateRouteThe gate
Single sound/sounds/[slug]Curated copy, preloaded layer, FAQ
Timer length/timer/[duration]Valid bounds, task advice
Interval/pomodoro/[work]-[break]Work and break balance
Preset mix/mix/[slug]Distinct layers, all in the catalogue
Guide/guides/[slug]Peer-reviewed citations with DOIs
Navigation

Tabs became real routes

Switching tabs changed component state but never the URL. Mix, Sounds, Timer and About became real routes, and playback carries on because the audio engine lives outside the React tree.

Push-state routes · module singleton
Tabs in local state
  • Tab switches change component state
  • The URL never changes
Refactored ↓
Native-feeling routes
  • /, /sounds, /timer, /about, with no reload
  • Playback survives every route change
  • A 5-slot bottom bar with a centre play button
  • Swipe-to-dismiss sheets and 1-2-3 keys
Visual identity

Near-black surfaces, one ember

The redesign put every screen on near-black surfaces with warm hairlines and a single orange ember as the focal point. It keeps visual fatigue low through long deep-work sessions.

Ember glow · timer-ring mark
TokenValueRole
Surface#0a0a0aNear-black page and cards
Hairline#1f1f1fWarm dividers
Ember#f08a4bThe one focal point
The backend

A Laravel API, so assistants can build mixes

Supabase gave way to a Laravel 11 API, because the MCP needs OAuth 2.1 with dynamic client registration and PKCE. One Library class backs both the site’s account API and the MCP tools, so the two can’t drift apart.

Laravel 11 · Sanctum · Passport OAuth 2.1
build-mix, end to end
Assistanttools/call build-mix {rain: 0.6, cafe: 0.3}MCPValidates and clamps it in LibraryMCPReturns focuship.app/?mix=rain-on-window:60,cafe:30ListenerTaps the link: a trusted gestureBrowseractions.visit(intent) → sync(layers)✓ the gapless loop starts on the tap
04 — Results

55 tests became 660, with zero hydration errors.

The Laravel API landed with a four-layer test harness that runs before every edge deploy. Flip the switch to see the suite before and after.

660Automated tests
Frontend tests478Unit, static export, end-to-end
Backend tests182Pest against MySQL
MCP tools16Plus 2 resources and 1 prompt
AccountsLaravelSanctum cookie sessions
Passing, per layer
82Unit & component
331Static export
65End-to-end
182API & MCP
0Hydration errors

Test counts from the CI suites recorded when the Laravel API landed. Playwright runs on desktop and a Pixel 7 and fails the build if React logs a hydration mismatch.

05 — Screens

focuship.app, phone first.

Mix, Sounds, Timer and You on a phone, and the home page on a desktop.

06 — Behind the build

One engineer, Claude Code as pair.

36 / 47commits carry a Claude Code co-author trailer. Five written decision records kept the system coherent while it moved fast.
With Claude Code (36)Solo (11)
I directed

The dual-deck audio engine, the Laravel API and MCP design, the cookie-session and OAuth security model, the ember identity and the quality gates.

Claude drafted

The page registry, the app-shell routes, the sign-in flows, the MCP tools with their Pest tests, and the static-export test suites.

Forwarding headers from Cloudflare only

Laravel trusts X-Forwarded-For and X-Forwarded-Proto only from Cloudflare’s published IP ranges, so the origin IP can’t be spoofed.

Email sign-in behind Turnstile

Passwordless 6-digit codes need a fresh Turnstile token on every submit, and go out through Brevo SMTP.

Migrations that survive shared hosting

Explicit timestamp defaults and InnoDB declarations keep migrations running on MariaDB, on a cPanel host with a 1000-byte key limit.

Hydration guardrails

Playwright fixtures catch console errors and fail CI if React logs a hydration mismatch on a prerendered page.

One catalogue for both sides

The TypeScript catalogue of 64 sounds is the source; an export script writes catalog.json for Laravel, and CI fails if the two drift.

Next.js 15TypeScriptWeb Audio APILaravel 11SanctumPassportCloudflare WorkersTurnstilePlaywrightVitestPestClaude Code

Non-merge commits on the main branch. Claude Code commits were made in my sessions and count as mine. Commit counts measure activity, not effort.

Lets work together

Need a successful project?

I’m available for freelance work.

Hire/Contact Me Now