A small web app that generates guided meditation scripts from either random inspiration or user-provided keywords, and (once signed in) lets users save, copy, download, and regenerate their scripts.
Script output is designed to follow the guided-meditation writing guidance from TunePocket’s article: How To Write A Compelling Guided Meditation Script.
- End-to-end product thinking: landing → generate → refine → save → export
- Modern web stack: React + Vite + TypeScript + Tailwind
- Serverless backend: Netlify Functions for AI calls (API key stays server-side)
- Real user features: authentication + per-user persistence (Supabase)
- Security basics: secrets never in the browser, Row Level Security (RLS) for private user data
- Generate meditation scripts
- Random: chooses a random inspiration link from
src/lib/inspiration-data.tsand derives a topic label from its slug - Keywords: uses user-entered topic keywords
- Random: chooses a random inspiration link from
- Constrained style (based on TunePocket)
- simple language
- specific, easy-to-follow instructions
- vivid visualization
- positive present tense
- action steps
- gradual ending (no abrupt stop)
- Duration slider: targets ~5–30 minutes (implemented via word-count/time targets)
- Library (account): save generated scripts, view/open them later
- User identification: avatar icon in header showing first letter of email with tooltip
- Actions: copy to clipboard, download
.txt, regenerate from saved script (same params; returns to generator), regenerate with tweaks (pre-fills generator form for modification)
- Frontend: React + Vite + TypeScript
- Styling: Tailwind CSS
- AI: OpenAI (via Netlify Function)
- Auth/DB: Supabase Auth + Postgres
- Hosting: Netlify
- The browser app calls a Netlify Function at
/.netlify/functions/generatefor script generation. - The function calls OpenAI with server-side credentials and returns a structured script (
script_json+script_text). - Signed-in users save scripts to Supabase; RLS keeps scripts private per user.
More detail: docs/ARCHITECTURE.md.
src/: React appnetlify/functions/: serverless functions (OpenAI generation)src/lib/inspiration-data.ts: inspiration links used by Random modedocs/example-scripts-excerpts.json: source list (for curation/reference)supabase/schema.sql: database table + RLS policiesdocs/: planning + architecture docs
- Install dependencies
npm install- Create
.envfor the frontend (Vite)
VITE_SUPABASE_URL=...
VITE_SUPABASE_PUBLISHABLE_KEY=...See docs/ENV.example for a copy/paste template.
- Run dev server
# Recommended: Netlify Dev (so `/.netlify/functions/generate` works locally)
npx netlify devSee docs/NETLIFY.md (build settings, redirects, and required env vars).
docs/PROGRESS.md: implementation checklist + statusdocs/ARCHITECTURE.md: data flow + storage + security notesdocs/TROUBLESHOOTING.md: common issues and solutions