Pickleball court booking, open play and player clubs for the Philippines. React frontends in apps/ talk to the Laravel API in backend/; see PLAN.md for the build plan and pickleball_saas_pwa_system_architecture_build_blueprint.md for the full spec.
pnpm install
# Laravel API (once per checkout)
cd backend
composer install
cp .env.example .env
php artisan key:generate
php artisan migrate --seed
php artisan storage:link
php artisan serve # http://127.0.0.1:8000
# Frontends, from the repo root
pnpm dev # everything at http://localhost:5174 (players at /, owner portal at /owner,
# front-desk staff at /staff, Super Admin at /admin)
pnpm test # unit tests against the mock fixtures
pnpm e2e # browser tests in Chrome, desktop and phone sizes
pnpm typecheck
pnpm lint
pnpm format # Prettier, including Tailwind class orderEveryone signs in at http://localhost:5174/login. Court owners and staff go on to the owner portal at /owner; players go to /home. People who are both switch sides from their menu without signing in again.
The design system is at http://localhost:5174/owner/style. The apps use the Laravel API through the Vite proxy; no mock switch is needed.
Note on TypeScript: packages type-check with TypeScript 7. The workspace root aliases typescript to @typescript/typescript6 only so typescript-eslint, which doesn't support TS 7 yet, keeps working.
Demo accounts for the owner portal (password password):
| Who | |
|---|---|
| owner@example.test | Alex, owner of the venues Mauban Pickleball Courts (trial), Quezon Sports Courts (active Starter plan) and Lucena Dink House (expired, read-only) |
| manager@example.test | Dana, manager at Mauban. Courts, hours, rates, bookings, payments and refunds; no staff, settings or plan |
| staff@example.test | Taylor, front desk at Mauban. Books walk-ins and takes payments; no refunds |
Player demo accounts (same password) are listed on the sign-in page and in PHASE4_CLUBS_OPEN_PLAY.md.
The player app at / is an installable PWA. Installing is optional: the same site keeps working in a
normal browser tab, and /owner and /admin remain ordinary desktop web apps. The installed app
opens on /login; a signed-in player is sent straight to /home. Installs made before that
change open / and are redirected to /login inside the app window.
pnpm --filter @courtflex/player build
pnpm --filter @courtflex/player preview # http://localhost:4173 — service workers need this, not the dev server
pnpm e2e:pwa # manifest, service worker, offline page, update promptThe PWA specs build and preview the app themselves and use the installed Chrome. They do not need the Laravel API.
To test installation on a phone, serve the preview through an HTTPS tunnel (the dev server has no service worker by design):
pnpm --filter @courtflex/player build
pnpm --filter @courtflex/player preview --port 4173 --strictPort
cloudflared tunnel --url http://localhost:4173Open the https://*.trycloudflare.com URL on the phone. Preview accepts those tunnel hostnames via
preview.allowedHosts. On Android use Install app in the browser menu or the landing-page
button; on iPhone use Safari's Share → Add to Home Screen.
The service worker precaches only the app shell and static assets (JS, CSS, HTML, fonts, images).
It never caches /api or /sanctum responses: a cached court slot is not a reservation, and
bookings, payments, availability and match scores always need the server. Opening a signed-in page
with no connection shows a branded offline screen that retries when the connection returns; an
interruption in an already-loaded session shows the existing offline banner.
Updates use vite-plugin-pwa's prompt flow. The app checks for a new worker hourly and when the tab
regains focus or comes back online. Update now activates it and reloads; Later dismisses the
prompt for that moment only, so it can appear again on the next focus or launch.
The landing page has an Install app button. It uses the browser's install prompt where one is available and otherwise shows the steps below.
- Android (Chrome/Edge/Samsung Internet): menu → Install app / Add to Home screen.
- iPhone/iPad: Safari → Share → Add to Home Screen. iOS does not offer installation from other browsers and shows no install banner.
- Desktop Chrome/Edge: install icon in the address bar, or menu → Install page as app / Apps → Install this site as an app.
Uninstalling removes only the shortcut and its cache; the website and the account are unaffected.
Serve over HTTPS and keep the SPA rewrites from How it's put together below. sw.js and
manifest.webmanifest must be served with Cache-Control: no-cache; hashed /assets/ files can be
immutable. Serve the manifest as application/manifest+json. The worker is scoped to / but refuses
/owner, /admin, /api, /sanctum and /storage.
- Reset a stuck device: open
/sw-reset.html. It unregisters the worker, clears all caches and does not sign the player out. - Withdraw a bad release:
PWA_DISABLED=true pnpm buildships a self-destroying worker that unregisters itself and clears its caches; the website keeps working.
Full install, deployment, header and notification details are in PWA.md § G, § M and § N.
The production image does all of the above itself: docker compose up -d --build builds
apps/player/dist in a Node stage and serves it with nginx (deploy/nginx/default.conf), which also
proxies /api, /sanctum and /storage to the Laravel backend on the same origin.
apps/portal Owner portal for court owners and their staff, served at /owner. React + Vite
apps/player Player web app at / (installable PWA), and the shared sign-in page: sign-up, onboarding, home, court search and map, clubs, open play, hosting
packages/features Screens shared by both apps: sessions, queue, members, payments
packages/ui Design tokens ("Night session" dark theme) and shared components
packages/api Typed API client and TanStack Query hooks for the /api/v1 contracts
packages/mocks Mock handlers used by the unit test suite only
backend Laravel API, compatible with the SPA's /api/v1 contract
The three apps talk to Laravel for every request. The mock package is kept only as a test fixture for the unit suites; it is not loaded by the browser apps and no sample data is shipped in their bundles. The API enforces booking conflicts, server-side prices, separate booking and payment status, and per-venue permissions. Super Admins configure SMTP, send a test email, and turn new-player email verification on or off from Settings → Email delivery.
Words: a venue is a court business run by its owner and staff (courts, bookings, payments, plan). A club is a player community, like a guild: members, admins, membership plans and sessions. Venues don't have members. In the code and API the venue is still called club (the blueprint's name); only the screens and page addresses say venue.
pnpm build writes one site to apps/player/dist, with the owner portal in dist/owner. The host must send unknown paths under /owner/ to /owner/index.html, and the rest to /index.html.
The apps use VITE_API_URL (default /api/v1). In development the Vite server proxies /api and /sanctum to http://127.0.0.1:8000; in production point it at your API or proxy those paths on the same origin.
The blueprint's §9 doesn't list these. The Laravel API will need them, or the screens will need adjusting:
GET /clubs/{club}/calendar?date=— courts plus every court reservation for the day (bookings, open play, maintenance)GET /clubs/{club}/reports/daily?date=— collected money by method, balance still due, court hours bookedGET /clubs/{club}/courts/{court}/availability?date=&duration_minutes=— club-scoped version of the player availability endpointGET /clubs/{club}/players?search=— find a player for a walk-inGET /clubs/{club}/bookings/{booking}— booking detail with payments, adjustments and status historyGET /clubs/{club}/courts/{court}— court with its weekly hours and price rulesPUT /clubs/{club}/courts/{court}/hours— replace the court's weekly hours (the blueprint lists CRUD on/court-hours)PUT /clubs/{club}/courts/{court}/price-rules— replace the court's price rulesPOST /clubs/{club}/bookings/{booking}/payments/{payment}/adjustments— refund or correction
Error shape addition: changes blocked by existing bookings return 409 with the affected bookings in errors.conflicts (one readable line each).
Organizers are either a venue club or a community club, so these routes take {type} = venue or community:
GET /discovery/clubs,GET /discovery/clubs/{type}/{slug}— directory and club pagesPOST /communities,PATCH /communities/{id}— start or edit a community clubGET /player/clubs— the signed-in player's clubs and whether they can hostPOST /organizers/{type}/{id}/join | leave;GET /organizers/{type}/{id}/members[/{member}];POST .../members/{member}/{approve|reject|suspend|reactivate|renew|make-admin|remove-admin|dues}GET|POST|PATCH /organizers/{type}/{id}/plans[/{plan}]GET /organizers/{type}/{id}/sessions?when=upcoming|past|pending,GET /organizers/{type}/{id}/payments,GET /organizers/{type}/{id}/reports/revenueGET|POST /open-play,GET|PATCH /open-play/{session},POST /open-play/{session}/{join|leave|waitlist|cancel|approve|reject}POST /open-play/{session}/participants,POST .../participants/{p}/{check-in|undo-check-in|no-show|remove|payments|refund},POST /open-play/{session}/court-feeGET /open-play/{session}/queue,POST /open-play/{session}/queue/{fill|finish|move|rest}GET /venues/{venue}/court-options?starts_at&ends_at— which courts are free for a sessionGET /players?search=— find a player to add to a session
The blueprint's /clubs/{club}/open-play/... routes are covered by these organizer routes; see PHASE4_CLUBS_OPEN_PLAY.md §6.
POST /auth/register,POST /auth/verify,POST /auth/verify/resend,POST /auth/forgot-password,POST /auth/reset-passwordGET|PATCH /player/profile,PATCH /player/location(blueprint §9.1)GET /geo/regions,GET /geo/{provinces|cities|barangays}?parent_id=— location pickersGET /player/home— next game and home cityGET /discovery/courts?q&lat&lng&radius_km&indoor_outdoor&surface&max_price&amenities— venues with matching courts, filtered by the serverGET /courts/{court},GET /courts/{court}/availability?date&duration_minutes— public court page and live availability within the booking window
GET /me now also returns email_verified and needs_onboarding. Verification codes, guest booking codes and password reset links are delivered through the Super Admin's email settings. While email delivery is off, they are written to backend/storage/logs/laravel.log for local development.