{"id":28412242,"url":"https://github.com/electric-sql/electric-ai-chat","last_synced_at":"2025-09-02T08:41:44.430Z","repository":{"id":287027325,"uuid":"955237252","full_name":"electric-sql/electric-ai-chat","owner":"electric-sql","description":"AI chat application using Electric for resumeability, interruptability, multi-user and multi-agent sync.","archived":false,"fork":false,"pushed_at":"2025-04-20T17:40:15.000Z","size":386,"stargazers_count":36,"open_issues_count":6,"forks_count":6,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-24T12:42:22.259Z","etag":null,"topics":["agents","ai","apps","chat","sync"],"latest_commit_sha":null,"homepage":"https://electric-sql.com/blog/2025/04/09/building-ai-apps-on-sync","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/electric-sql.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-26T10:25:25.000Z","updated_at":"2025-06-23T14:51:47.000Z","dependencies_parsed_at":"2025-04-09T16:26:10.652Z","dependency_job_id":"f904af96-4f6b-4051-9b71-451b27956075","html_url":"https://github.com/electric-sql/electric-ai-chat","commit_stats":null,"previous_names":["electric-sql/electric-ai-chat"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/electric-sql/electric-ai-chat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electric-sql%2Felectric-ai-chat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electric-sql%2Felectric-ai-chat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electric-sql%2Felectric-ai-chat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electric-sql%2Felectric-ai-chat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/electric-sql","download_url":"https://codeload.github.com/electric-sql/electric-ai-chat/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electric-sql%2Felectric-ai-chat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273257528,"owners_count":25073530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agents","ai","apps","chat","sync"],"created_at":"2025-06-02T20:15:33.557Z","updated_at":"2025-09-02T08:41:44.392Z","avatar_url":"https://github.com/electric-sql.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003c!-- blog post header image extra-landscape crop --\u003e\n# Electric AI Chat\n\nAI chat application using Electric for resumeability, interruptability, multi-user and multi-agent sync. See the [Building\u0026nbsp;AI\u0026nbsp;apps\u0026nbsp;on\u0026nbsp;sync](https://electric-sql.com/blog/2025/04/09/building-ai-apps-on-sync) blog post for more context.\n\n## ElectricSQL\n\nElectric 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.\n\n## Building AI apps on sync\n\nThis 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:\n\n- real-time multi-agent, multi-user and multi-device sync\n- live streaming of AI sessions with seamless resumeability and session continuity\n- real-time streaming of LLM tool responses\n\nThe demo is deployed at [electric-ai-chat.examples.electric-sql.com](https://electric-ai-chat.examples.electric-sql.com). See the [blog post](https://electric-sql.com/blog/2025/04/09/building-ai-apps-on-sync) for more information.\n\n\u003c!-- and can be seen running in the video below ... --\u003e\n\n## Getting Started\n\n### Pre-reqs\n\n- Node.js (v18 or higher)\n- pnpm (v8 or higher)\n- Docker and Docker Compose (for local development environment)\n- An OpenAI API key\n\n### Install\n\nClone the repository and install dependencies:\n\n```bash\ngit clone https://github.com/electric-sql/electric-ai-chat.git\ncd electric-ai-chat\npnpm install\n```\n\n### Develop\n\n1. Start Postgres and Electric using Docker:\n\n```bash\ndocker compose up -d\n```\n\n2. Start the backend API:\n\n```bash\nexport OPENAI_API_KEY=\u003cyour-openai-api-key\u003e\npnpm dev:api\n```\n\n3. Build and serve the frontend app:\n\n```bash\npnpm dev:app\n```\n\nOpen in your browser at http://localhost:5173\n\n## Code structure\n\n```\nelectric-ai-chat/\n├── packages/\n│   ├── app/       # React frontend application\n│   │   ├── src/   # Source code\n│   │   └── ...    # Configuration files\n│   └── api/       # Backend API server\n│       ├── src/   # API source code\n│       ├── ai/    # AI integration and tools\n│       └── ...    # Configuration files\n├── db/            # Database initialization scripts\n│   └── schema.sql # Database schema\n├── docker-compose.yaml # Docker configuration for development\n└── pnpm-workspace.yaml # Workspace configuration\n```\n\n## Stack\n\n1. **Front-end**\n\n   - React 19\n   - TypeScript\n   - Vite\n   - TanStack Router\n   - Radix UI\n\n2. **Back-end**:\n\n   - Node.js\n   - Hono (web framework)\n   - TypeScript\n\n3. **Database**:\n\n   - Postgres\n   - ElectricSQL for sync\n\n4. **AI**:\n\n   - OpenAI API with tool calling capabilities\n\n## Tools\n\nThe demo app implements several LLM tools to enhance the AI assistant capabilities:\n\n1. **ElectricSQL Tools**\n\n   - Fetch and utilize ElectricSQL documentation\n   - Provide context-aware answers about ElectricSQL features and best practices\n\n2. **Database Tools**\n\n   - Query database schema information\n   - Execute read-only PostgreSQL queries and return results\n   - Safely handle database connections with proper authentication\n\n3. **File Management Tools**\n\n   - Create, read, edit, delete, and rename files within chat sessions\n   - Support various file types with MIME type handling\n   - Persist files in the database for cross-session access\n\n4. **Chat Management Tools**\n\n   - Automatically generate descriptive chat names based on content\n   - Rename chats with user-specified names\n   - Pin/unpin chats for easier organization\n\n5. **Todo List Tools**\n   - Create, update, delete, and manage collaborative todo lists\n   - Bidirectional real-time synchronization of todo items across all clients\n   - LLM-powered todo processing with the ability to:\n     - Process entire todo lists automatically\n     - Watch lists for new items and process them as they're added\n     - Respond to task completion status changes in real-time\n     - Use ElectricSQL's shape streams to monitor tasks without polling\n   - Todo items can be created by users or the AI, demonstrating real-time collaboration\n   - Demonstrates practical uses of ElectricSQL for:\n     - Event-driven architectures with shape streams\n     - Real-time UI updates across multiple clients\n     - Reactive programming patterns with AI integrations\n     - Resumable operations that can survive page reloads or connection interruptions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectric-sql%2Felectric-ai-chat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felectric-sql%2Felectric-ai-chat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectric-sql%2Felectric-ai-chat/lists"}