Inspiration
Booking a community court, gym, studio, or boardroom is usually fragmented: users inspect a calendar, calculate a wallet deficit, navigate to payment, then return to a separate confirmation flow. AI can make that experience conversational—but only if it never invents availability, prices, refunds, or successful transactions. We built SpaceHub around that constraint: AI translates language into a typed request, while PostgreSQL and application code remain the authority for every operational decision.
What it does
SpaceHub is a community facility-management platform enhanced by GenState UI + TransactGuard. A user can ask: “Book Main Court two days from now from 7 PM to 9 PM.” The model does not generate a booking result or UI. Instead, it extracts a Zod-validated intent. SpaceHub then checks the real database rules, wallet balance, ownership, availability, and operating hours before returning one deterministic, allowlisted Vue card. For high-risk actions, TransactGuard runs the real mutation core inside an isolated PostgreSQL transaction, captures the exact result, then rolls everything back. That lets us show truthful previews for booking charges, cancellation refunds, reschedules, and admin closure impacts before anything is committed.
How we built it
Cost-aware AI routing: gpt-5-nano handles routine structured intent extraction. gpt-5-mini is used only when Nano returns UNKNOWN for a lifecycle-looking request or active-draft follow-up. GenState UI: OpenAI Structured Outputs and Zod produce typed intents rooted at { intent }. A deterministic backend FSM maps verified outcomes to a fixed Vue component allowlist—never model-supplied components, URLs, prices, or success messages. TransactGuard: runShadowTransaction uses the existing PostgreSQL pg.Pool and a single PoolClient at serializable isolation. It executes real connection-aware mutation cores, always rolls back, and releases the connection safely. Safe commits: Redis locks, QStash scheduling, PayMongo/mock checkout work, wallet broadcasts, and Supabase Broadcast events run only after a real committed mutation. Realtime UX: FullCalendar remains the primary workflow. AI commits refresh the visible calendar immediately and then propagate through the existing Supabase Realtime Broadcast channels. Persistent history: Chat prompts and capability-redacted GenUI snapshots are stored outside shadow transactions. History is owner-scoped, read-only, and renders the same local allowlisted components with every action disabled.
Challenges we ran into
The hardest problem was preventing simulations from triggering external side effects. We refactored booking, cancellation, reschedule, and closure logic into connection-aware database cores. Shadow previews can calculate exact outcomes, but cannot publish realtime events, obtain locks, schedule QStash jobs, charge a wallet, or create a payment session. We also had to prevent stale or confusing chat states. Draft overrides now safely abandon an old draft only when a user clearly starts a different lifecycle request. Live chat retains an in-memory transcript, while persistent history remains inert and incapable of replaying prior actions.
Accomplishments that we’re proud of
Reversed the usual Generative UI trust model: the LLM parses language, while the database dictates the outcome and UI state. Built exact rollback-derived previews for booking costs, refunds, reschedules, and closure blast radius. Added visible TransactGuard telemetry so judges can see that a card was verified through an isolated rollback. Preserved existing FullCalendar, modal, wallet, QStash, Passport, CSRF, idempotency, and Supabase Realtime patterns instead of creating a parallel AI-only system. Made historical GenUI cards strictly non-interactive, even if malformed data attempted to include an action ID.
What we learned
AI is strongest as a translation layer for critical workflows—not as the decision-maker. Zod Structured Outputs make language machine-checkable, but the real safety comes from deterministic state machines, database constraints, transaction isolation, and explicit confirmation.
What’s next
We plan to extract GenState UI and TransactGuard into reusable open-source packages for Vue/Node and React/Next applications. The goal is to make safe AI-assisted workflows practical for scheduling, commerce, healthcare operations, and any domain where “probably correct” is not acceptable.
Built With
- ai-agent
- api
- express.js
- generative-ui
- gpt-5.6
- node.js
- openai
- postgresql
- primevue
- state-machine
- supabase
- tailwind-css
- typescript
- vercel
- vue
Log in or sign up for Devpost to join the conversation.