How frezanz/kchat works
KChat is a browser-first AI chat workspace: users configure a model and prompt, manage local conversations, and send chat requests directly to their chosen API. The workspace also exposes tool integrations, custom API connections, and a sandboxed coding/browser runtime; account routes support workspace syncing. The README documents streaming chat and presentation controls, while the sampled page excerpt confirms conversation state, settings, and runtime requests. Some UI-to-route wiring and unsampled subsystems are inferred only from documented capabilities and the file tree.
Main entry points: page.tsx Chat interface · runtime/route.ts Runtime actions · auth Auth endpoints · execute/route.ts Tool execution
Components 18
Chat workspace
- Chat interface
app/page.tsx
Accounts
- Sign-in UI
app/components/AuthScreen.tsx - Auth endpoints
app/api/auth - Session and passwords
lib/auth.ts
Tools and connections
- Tool catalog endpoint
app/api/tools/catalog/route.ts - Tool definitions
lib/tool-registry.ts - Tool execution
app/api/tools/execute/route.ts - Custom API connector
app/api/connectors/api/route.ts
Sandbox runtime
- Runtime actions
app/api/runtime/route.ts - Sandbox ownership records
lib/db.ts
Other components
- Workspace user
- Postgres
lib/db.ts - Browser session storage
- Configured model API
- GitHub API
- Netlify API
- E2B sandbox
- Playwright browser CLI
Connections 21
- Workspace user → Chat interface: uses
- Chat interface → Browser session storage: stores chats and key
- Chat interface → Configured model API: sends chat requests
- Chat interface → Sign-in UI: opens sign-in
- Sign-in UI → Auth endpoints: submits credentials
- Chat interface → Auth endpoints: checks and ends session
- Auth endpoints → Session and passwords: uses session helpers
- Auth endpoints → Postgres: reads and writes accounts
- Session and passwords → Postgres: reads and writes sessions
- Chat interface → Tool catalog endpoint: requests tools
- Tool catalog endpoint → Tool definitions: returns definitions
- Chat interface → Tool execution: submits tool calls
- Tool execution → GitHub API: calls GitHub
- Tool execution → Netlify API: calls Netlify
- Chat interface → Custom API connector: sends connection requests
- Chat interface → Runtime actions: requests sandbox actions
- Runtime actions → Session and passwords: checks user
- Runtime actions → Sandbox ownership records: checks sandbox ownership
- Runtime actions → E2B sandbox: creates or connects; runs commands
- Runtime actions → Playwright browser CLI: dispatches browser commands
- Playwright browser CLI → E2B sandbox: runs inside sandbox