AI chat application using Electric for resumeability, interruptability, multi-user and multi-agent sync. See the Building AI apps on sync blog post for more context.
Electric is a Postgres sync engine. It solves the hard problems of sync for you, including partial replication, fan-out, and data delivery. See https://electric-sql.com for more information.
This is a demo application that shows how to build collaborative AI apps that use Electric to keep both agents and users in sync. It shows:
The demo is deployed at electric-ai-chat.examples.electric-sql.com. See the blog post for more information.
Clone the repository and install dependencies:
git clone https://github.com/electric-sql/electric-ai-chat.git
cd electric-ai-chat
pnpm install
docker compose up -d
export OPENAI_API_KEY=<your-openai-api-key>
pnpm dev:api
pnpm dev:app
Open in your browser at http://localhost:5173
electric-ai-chat/
├── packages/
│ ├── app/ # React frontend application
│ │ ├── src/ # Source code
│ │ └── ... # Configuration files
│ └── api/ # Backend API server
│ ├── src/ # API source code
│ ├── ai/ # AI integration and tools
│ └── ... # Configuration files
├── db/ # Database initialization scripts
│ └── schema.sql # Database schema
├── docker-compose.yaml # Docker configuration for development
└── pnpm-workspace.yaml # Workspace configuration
Front-end
React 19
Radix UI
Back-end:
Node.js
TypeScript
Database:
Postgres
ElectricSQL for sync
AI:
OpenAI API with tool calling capabilities
The demo app implements several LLM tools to enhance the AI assistant capabilities:
ElectricSQL Tools
Fetch and utilize ElectricSQL documentation
Provide context-aware answers about ElectricSQL features and best practices
Database Tools
Query database schema information
Safely handle database connections with proper authentication
File Management Tools
Create, read, edit, delete, and rename files within chat sessions
Persist files in the database for cross-session access
Chat Management Tools
Automatically generate descriptive chat names based on content
Pin/unpin chats for easier organization
Todo List Tools
$ claude mcp add electric-ai-chat \
-- python -m otcore.mcp_server <graph>