Implementation Modes
Direct response mode
The frontend sends a prompt via POST. The backend processes it synchronously and returns a complete AI‑generated response. Best for: Simple chatbots, quick responses, minimal infrastructureReal‑time background mode
The backend queues the request as a background job. The frontend receives updates over Supabase WebSockets as the database updates. Best for: Long‑running tasks, complex workflows, scalable applicationsBoth modes simulate streaming on the frontend by progressively displaying the message for a natural typing effect.
Setup Guide
Architecture Overview
- Direct Response
- Background Processing
Characteristics:
- Synchronous processing
- Lower latency for short responses
- Simpler error handling
- Limited by request timeout
Key Features
- Even though the backend returns complete responses, the frontend simulates a streaming effect by progressively revealing characters. This provides a more engaging user experience similar to ChatGPT.
- The background mode leverages Supabase’s real-time capabilities to push updates to the frontend immediately when the database is updated, eliminating the need for polling.