multiplayer-prompting
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v20View latest version
This directory contains the server-side logic for Vibe-Draft.
index.ts: Main Hono application with all API routessse-hub.ts: Server-Sent Events hub for real-time multiplayer updatesvibe-engine.ts: Synthesizes prompt stack into OpenAI calls
database/schema.ts: SQLite table definitions and initializationdatabase/queries.ts: Type-safe database query functions
The SSE hub maintains active connections and broadcasts events to all connected clients in a session.
The vibe engine takes a stack of played cards and constructs a coherent system prompt for OpenAI, handling:
- Role assignments
- Tone modifications
- Token limits
- Custom instructions
- Image context
All routes are documented in the main README. The backend handles:
- Session creation/joining
- Card playing and turn management
- OpenAI generation
- Real-time updates via SSE