Zoohm — book your slot, know the price first
Multi-tenant SaaS for salons and barbershops. Customers chat with an AI stylist or send a hair photo, get matched to a real service with an exact quote, pick a real opening, and hold it with a PayPal deposit. Owners run inbox, calendar, catalog, customers, payments and settings from the dashboard.
Built for the PayPal AI Hackathon: PayPal Orders + Invoicing + Webhooks meet a vision-and-chat agent that moves real money.
Live demo: https://zoohm.vercel.app (frontend) + https://zoohm-api-ikzi.onrender.com (API)
Demo owner (owns all 4 demo studios):
Email: [email protected]
Password: ZoohmDemo123
Also [email protected] / ZoohmDemo123. Or create your own studio at /create-store.
How it works (60 seconds)
- A customer opens a studio page (
/s/:slug) or the floating AI dock. - They send a hair photo or name a style. The AI matches it against the studio's service menu and prices it — or books a named style at list price.
- Real openings come from the store's hours, notice period and live bookings, shown as pickable time cards.
- Accepting creates a booking, emails a PayPal invoice, and opens a PayPal deposit checkout. Paid webhooks confirm the slot; reminders, retry links and policy-aware cancellation run through the same chat.
- If the customer sends name/email/WhatsApp but does not accept/pay within ~1h, the quote/booking becomes Abandoned — the owner dashboard shows it with a
wa.medraft; nudging pushes the AI thread and gives aCopy draft/Open wa.melink to send from the owner's own WhatsApp number (AI has no number; if it cannot help it refers to the owner).
Customers never sign up — they act through unguessable booking links (access_code). Only shop owners register.
Repo layout
backend/ Express API (Postgres + Prisma, port 4000)
src/ auth, tenants, staff, catalog, quotes, chat, bookings,
payments, paypal/paypalConnect, webhooks, calendar,
abandoned, availability, reminders, files
prisma/ schema.prisma (run `npx prisma db push`)
seed-demo.mjs 4 fictional demo studios + reviews + portfolio + staff (rerunnable, Pexels images)
fix-demo-login.mjs ensures [email protected] owns the studios
update-images.mjs patches Service.imageUrl from Pexels
frontend/ Vite SPA (React 19, TanStack Router, plain JavaScript)
src/routes/ / (directory), /s/:slug (storefront + booking sheet + map/team/portfolio),
/login, /register, /create-store, /dashboard + owner pages (incl. Abandoned)
src/lib/api.js the only data layer (fetch + JWT, SPA-only)
index.html Vite entry → src/main.jsx
Prerequisites
- Node 20+, a Postgres database, PayPal sandbox app credentials, an OpenAI-compatible vision model key.
Run it locally
# Backend
cd backend
npm install
cp .env.example .env # fill in DATABASE_URL, JWT_SECRET, FILE_URL_SECRET,
# PAYPAL_CLIENT_ID/SECRET (/WEBHOOK_ID), AI_MODEL/KEY, CRON_SECRET
npx prisma db push # create tables (also prisma generate)
node seed-demo.mjs # 4 fictional demo studios (Pexels images)
node fix-demo-login.mjs # [email protected] / ZoohmDemo123 owns them
node --watch src/index.js # API on :4000 — GET /api/health should say {"ok":true}
# Frontend (new terminal)
cd frontend
npm install --legacy-peer-deps
cp .env.example .env # VITE_API_BASE=http://localhost:4000
npm run dev # app on http://localhost:5173
npm run build # Vite SPA → dist/index.html + dist/assets/*
The backend refuses to boot without JWT_SECRET, DATABASE_URL and FILE_URL_SECRET. Without PayPal/AI keys it still runs: quotes fall back to the menu and invoices report "not configured".
| Var | Where | Needed for |
|---|---|---|
DATABASE_URL |
backend | Postgres connection (Vultr in prod, helium in Replit dev) |
JWT_SECRET, FILE_URL_SECRET |
backend | Auth tokens, signed photo URLs |
PAYPAL_CLIENT_ID/SECRET |
backend | Sandbox deposit checkout + invoices |
PAYPAL_API_BASE |
backend | Sandbox API (https://api-m.sandbox.paypal.com) |
PAYPAL_WEBHOOK_ID |
backend | Webhook signature verification |
PAYPAL_MERCHANT_EMAIL |
backend | Sandbox business email on invoices |
AI_BASE_URL/KEY/MODEL |
backend | Vision matching + front-desk replies (muse-spark-1.3) |
CRON_SECRET |
backend | Guards POST /api/cron/reminder-run and /abandoned-run |
FRONTEND_URL |
backend | CORS + PayPal return links (https://zoohm.vercel.app in prod) |
VITE_API_BASE |
frontend | Where the web app reaches the API (https://zoohm-api-ikzi.onrender.com in prod) |
GOOGLE_CLIENT_ID/SECRET/REDIRECT_URI |
backend | Optional Google Calendar OAuth (free-busy + create event, per-store) |
BLOB_READ_WRITE_TOKEN / S3_* / UPLOAD_DIR |
backend | Persistent file storage (see backend/README.md) |
PayPal sandbox wiring
- Create a sandbox app at
developer.paypal.com/dashboard/applications/sandbox, copy the client ID + secret intobackend/.env(platform fallback). - Per-store PayPal (recommended): dashboard
Settings → PayPal— paste per-storeclientId/secret/merchantEmail, Test, Save. Deposits/invoices then useBusiness.paypalClientId/Secretviasrc/paypal.js:12credsFor/accessTokenForper-business token cache; fallback is env when not connected. - Create a webhook subscription pointing at
https://<your-api-host>/api/webhooks/paypalwith eventsPAYMENT.CAPTURE.COMPLETEDandINVOICING.INVOICE.PAID/INVOICING.INVOICE.CANCELLED, copy the webhook ID intobackend/.env(or per-storepaypalWebhookId). - Flow: accept quote → booking + PayPal invoice emailed → customer pays the deposit (approve link) → capture on return and via webhook → booking confirmed. Resends reconcile first — never a duplicate invoice.
Reminders & abandoned cron
curl -X POST http://localhost:4000/api/cron/reminder-run \
-H "x-cron-secret: $CRON_SECRET"
curl -X POST http://localhost:4000/api/cron/abandoned-run \
-H "x-cron-secret: $CRON_SECRET"
reminder-run— every ~30 min. Nudges bookings starting within 24h (with a fresh deposit link when unpaid, policy-aware), marks each booking reminded exactly once.abandoned-run— every ~30–60 min. Finds quotesstatus=quoteduntouched for 1h+ and bookingsstatus=deposit_dueunpaid for 1h+, withnudgeCount<3and 2h cooldown, pushes an AI thread message (what happened?) — owner follow-up is via the dashboardwa.medraft (AI has no WhatsApp number and refers tobusiness.whatsappwhen it cannot help).
AI used
- Vision matching (
backend/src/ai.js→matchStyle): customer photo + catalog + notes → exact style, price, time, confidence. - Front-desk chat (
chatReply): grounded replies with real openings (hours + live bookings + Google free-busy) injected server-side, style cards, no invented prices or times. Follow-up nudges askwhat happened?and refer to the owner atbusiness.whatsappwhen the AI cannot help (tension/allergy/date). - Both run server-side through an OpenAI-compatible chat-completions endpoint (
AI_MODEL, e.g.muse-spark-1.3); keys never touch the browser.
Abandoned follow-up (WhatsApp-first, no Business API)
Tracked from the first name/email/whatsapp send (POST /api/quotes or POST /api/chat/:code/quote → StyleRequest nudgeCount/lastNudgedAt). GET /api/stores/:storeId/abandoned + POST /api/stores/:storeId/abandoned/:kind/:id/nudge returns {draft, waLink: https://wa.me/{digits}?text=} — owner taps Open wa.me or Copy draft to send from their own business number in WhatsApp. AI has no number; it nudges the web thread and drafts the WhatsApp text. POST /api/cron/abandoned-run auto-nudges the same set.
Deploy
Frontend: Vercel static SPA. vercel.json at repo root:
{ "framework": "vite", "buildCommand": "cd frontend && npm install --legacy-peer-deps && npm run build", "outputDirectory": "frontend/dist", "rewrites": [{ "source": "/(.*)", "destination": "/index.html" }] }
Env: VITE_API_BASE=https://zoohm-api-ikzi.onrender.com (Production/Preview). vercel deploy --prod builds frontend/dist.
Backend: Render web service (render.yaml zoohm-api, plan: free, rootDir: backend, buildCommand: npm install && npx prisma generate && npx prisma db push --accept-data-loss, startCommand: node src/index.js, healthCheckPath: /api/health). Env vars (DATABASE_URL, JWT_SECRET, PAYPAL_*, AI_*, FRONTEND_URL) are sync: false (set in Dashboard).
The old zoohm-web Node service (frontend with Nitro) was removed after the x-render-routing: loop / Vercel INFINITE_LOOP — the SPA needs no server.
Demo data & images
seed-demo.mjs creates 4 fictional studios (Copper Fade Barbers — London 22 Brick Lane, Lacquer & Co. — Manchester 32 Oldham St, Crown & Coil — Birmingham Custard Factory, The Gilded Comb — Leeds 23 Call Lane) with 5 services each, address/lat/lng (OpenStreetMap iframe, no redirect), portfolioImages[3] and staff[2] per studio, and hours per day. Service imageUrl and portfolio/team avatars are Pexels CDN (images.pexels.com, ?auto=compress&cs=tinysrgb&w=600) — free to use, no attribution required but credited. Nothing is scraped from real businesses. Storefront GET /api/stores/:slug/public returns staff + portfolioImages + hours.
Smoke test
cd backend && node smoke.mjs # register → store → public storefront
curl https://zoohm-api-ikzi.onrender.com/api/stores | jq
curl -X POST https://zoohm-api-ikzi.onrender.com/api/auth/login -H "Content-Type: application/json" -d '{"email":"[email protected]","password":"ZoohmDemo123"}' | jq
License
MIT — see LICENSE.
Built With
- codex
- paypal