How bytemystique/the-woven-chronicle works
Project type and purpose
• Type: A full-stack, single-page web application built with Vite and vanilla JavaScript, leveraging a Backend-as-a-Service (Supabase) for real-time collaboration and persistent storage.
• Purpose: “The Woven Chronicle” is a chaotic, collaborative storytelling platform where users add sentences in real time and a small on-device AI weaves them together, using Supabase for data sync and persistence and Vercel for static hosting.
File structure
• Top-level
• LICENSE, README.md
• db/schema.sql → database schema for Supabase Postgres
• web/ → contains the entire front-end app
• web/
• package.json, package-lock.json, vite.config.js → build and dependency management
• .env.example → environment variables (Supabase URL/keys)
• index.html, admin-local.html → entry points for production and local admin view
• main.js → bundles client-side logic (boots the SPA)
• src/ → application modules (UI components, CSS, business logic)
• processor.js, peer-processor.js → client-side AI/text-weaving logic
• public/ → static assets
• No custom backend code: all server-side logic is outsourced to Supabase (Postgres + Realtime).
README for additional insights
• Uses @supabase/supabase-js for real-time DB updates and auth-free access
• Web Audio API for sound effects
• Hosted on Vercel as a static site, with live updates handled via Supabase WebSockets
a. Main components
• Web Client (browser)
– UI layer (HTML/CSS, src/*.js)
– AI Processor (processor.js + peer-processor.js)
– Realtime Sync (supabase-js library)
– Sound Engine (Web Audio API)
• Supabase Service
– Postgres Database (db/schema.sql)
– Realtime Engine (WebSockets)
• Vercel Hosting
– Static file CDN (serves built JS/CSS/HTML)
b. Relationships and interactions
• Browser ←HTTPS— Vercel (initial page load)
• Browser ⇄ WebSockets/HTTPS— Supabase Realtime & REST endpoints
• AI Processor runs entirely on the client and reads/writes to the local state, then pushes changes to Supabase
c. Architectural patterns and principles
• Client-centric architecture with BaaS (Backend-as-a-Service)
• Event-driven updates (pub/sub via Supabase Realtime)
• Single-page application (SPA) model using Vite
• On-device computation (minimizes server cost, boosts privacy)
d. Key technologies
• Vite (dev server, bundler)
• Vanilla JavaScript, HTML, CSS
• @supabase/supabase-js (Realtime + Postgres client)
• Web Audio API (typewriter blips)
• Vercel (static hosting CDN)