🧭 Runtime Architecture
Prompt Wizard is a single Bun service with a Vite-built React client. The browser talks only to same-origin routes. The server owns persistence, uploads, identity, generation calls, and live invalidation events.
Runtime components
- browser SPA:
- React 18 app built by Vite
- imports
roomfromsrc/lib/room.jsfor collection access - imports
generateText,generateImage,uploadFile,getCurrentUser, andreportErrorfromsrc/lib/ai.js - renders generated prompt steps, settings, library, blueprint views, admin prompts, debug views, and wizard management
- Bun server:
- serves
dist/with SPA fallback - serves uploaded files from
data/uploads/under/uploads/ - exposes JSON API routes under
/api/ - stamps identity from the Authelia-provided user header
- shells out to installed
ompfor generation
- serves
- SQLite store:
- database path:
data/pwiz.db - journal mode: WAL
- JSON-valued columns are stored as text and parsed at API boundaries
- database path:
- event stream:
- one shared
EventSource('/api/events')in the client module - successful mutations broadcast the affected collection name
likestoggles broadcast bothlikesandblueprints
- one shared
Request lifecycle
- page load:
- nginx authenticates app requests with Authelia
- Bun serves the SPA shell
- React mounts immediately; no WebSim initialization race remains
- collection read:
- component creates
room.collection(name).filter(criteria)orroom.collection(name) useQuery(query)fetches/api/collections/:name- result is newest-first array data
- component creates
- mutation:
- client calls create, patch, delete, or
toggleLike - server validates collection and payload
- server writes SQLite row or transaction
- server emits collection invalidation event
- subscribed browser queries refetch
- client calls create, patch, delete, or
- generation:
- client posts to
/api/ai/textor/api/ai/image - server writes the prompt context into an
ompsystem-prompt file - server runs
ompwith stdin ignored and project context disabled - server stores an
llm_logsrow with the true outcome
- client posts to
Development proxy
The Vite development server proxies /api and /uploads to the Bun backend origin. Use a symbolic backend origin in examples and keep machine-specific loopback values out of published prose.
server: {
proxy: {
"/api": "${BACKEND_ORIGIN}",
"/uploads": "${BACKEND_ORIGIN}"
}
}Runtime dependencies
- Bun: runs server and scripts
- Vite: builds client assets
- React and React DOM: UI runtime
- marked and Mermaid: rendered docs and diagrams
- Fabric.js: wizard avatar editor
- Font Awesome package: local icons, not CDN
- installed
omp: sole text and image generation backend
See omp-integration for the generation bridge and api for route contracts.