How selfxplanatorium/lf-chat works
LF Chat is a self-hosted, multi-conversation assistant whose configurable n8n workflows provide the model and automation boundary. A user signs in, configures a webhook, sends a message with optional attachments, and follows the response in the active conversation over authenticated SSE. The graph includes documented account, settings, conversation-management, and backup capabilities. Some server routes and generation modules are unsampled; those relationships are shown only where the README or SOURCE INDEX supports them.
Main entry points: App.tsx App shell · manager.ts Generation manager · index.ts Express API routes · apiClient.ts REST API client
Components 22
Chat experience
- App shell
src/App.tsx - Chat thread
src/components/AssistantThread.tsx - Conversation navigation
src/components/SidePanel.tsx - Conversation state
src/hooks/useConversations.ts - Localization
src/i18n/translate.ts
Accounts and settings
- Sign-in and registration
src/components/AuthPage.tsx - Authentication state
src/hooks/useAuth.tsx - Settings and webhook setup
src/components/settings/SettingsPage.tsx - Settings state
src/hooks/useSettings.ts - Import and export
src/components/settings/DataSection.tsx
API and orchestration
- REST API client
src/services/apiClient.ts - SSE client
src/services/streamClient.ts - Express API routes
server/src/index.ts - Auth endpoints
server/src/routes/auth.ts - Conversation endpoints
server/src/routes/conversations.ts - Generation manager
server/src/generation/manager.ts - SSE event bus
server/src/generation/eventBus.ts
Persistence and files
- SQLite database
server/src/db.ts - Attachment handling
server/src/lib/attachments.ts
Webhook integration
- Webhook runner
server/src/generation/runner.ts - Configured n8n workflow
Other components
- Chat user
Connections 28
- Chat user → App shell: uses
README.md - App shell → Sign-in and registration: shows when signed out
src/App.tsx - App shell → Chat thread: renders active chat
src/App.tsx - App shell → Conversation navigation: renders navigation
src/App.tsx - App shell → Conversation state: uses conversation state
src/App.tsx - Sign-in and registration → Authentication state: signs in through
src/components/AuthPage.tsx - Authentication state → REST API client: calls auth APIs
src/hooks/useAuth.tsx - App shell → Settings and webhook setup: opens settings
src/App.tsx - Settings and webhook setup → Settings state: edits settings
src/components/settings/SettingsPage.tsx - Settings state → REST API client: loads and saves
src/hooks/useSettings.ts - Settings and webhook setup → Import and export: offers data management
src/components/settings/SettingsPage.tsx - Conversation state → REST API client: loads and mutates chats
src/hooks/useConversations.ts - Conversation state → SSE client: subscribes to responses
src/hooks/useConversations.ts - REST API client → Express API routes: sends JSON requests
README.md - SSE client → Express API routes: opens authenticated SSE
README.md - Express API routes → Auth endpoints: mounts routes
server/src/index.ts - Express API routes → Conversation endpoints: mounts routes
server/src/index.ts - Auth endpoints → SQLite database: reads and writes accounts
server/src/routes/auth.ts - Conversation endpoints → SQLite database: reads and writes chats
server/src/routes/conversations.ts - Conversation endpoints → Generation manager: starts chat generation
server/src/routes/conversations.ts - Generation manager → SQLite database: persists messages
server/src/generation/manager.ts - Generation manager → Attachment handling: resolves chat files
server/src/generation/manager.ts - Generation manager → Webhook runner: runs generation
server/src/generation/manager.ts - Generation manager → SSE event bus: emits response events
server/src/generation/manager.ts - Webhook runner → Configured n8n workflow: posts webhook request
README.md - SSE event bus → SSE client: streams response events
README.md - Chat user → Localization: uses translated interface
README.md - Import and export → SQLite database: backs up app data