A full-featured AI chat application built with SvelteKit, supporting multiple AI providers, conversation management, and advanced features like TTS and voice recording.
- Multiple AI Providers: OpenAI, Anthropic, Mistral, Google
- Streaming Responses: Real-time chat with proper error handling
- Custom Agents: Create AI personalities with custom instructions
- Per-user API Keys: Secure API key management
- Branching/Threading: Parent-child message relationships
- Message Editing: Edit and regenerate messages
- Organization: Pin conversations and organize with folders
- Sharing: Public conversation sharing
- Search: Full-text search across conversations and messages
- Text-to-Speech: ElevenLabs integration with voice selection
- Voice Recording: Built-in voice recording capabilities
- Audio Controls: Playback controls with audio stores
- Frontend: SvelteKit with TypeScript
- UI: Shadcn-svelte components with TailwindCSS
- Backend: SvelteKit with adapter-node
- Database: MySQL/MariaDB with Prisma ORM
- Queue: Redis/Valkey with BullMQ for async processing
- Auth: Clerk authentication
- Real-time: Socket.io for live updates
- Node.js 18+
- pnpm
- MySQL/MariaDB
- Redis/Valkey
- Clone the repository:
git clone https://github.com/lordluceus/chat-lounge.git
cd chat-lounge- Install dependencies:
pnpm install- Set up environment variables:
cp .env.example .env
# Edit .env with your configuration- Run database migrations:
pnpm migrate-dev- Start development server:
pnpm devpnpm dev # Start development server
pnpm build # Build for production
pnpm preview # Preview production buildpnpm lint # Run Prettier and ESLint checks
pnpm format # Auto-format code
pnpm check # Run SvelteKit sync and TypeScript checks
pnpm check:watch # Run checks in watch modepnpm migrate-dev # Run migrations in development
pnpm migrate-prod # Run migrations in production
pnpm migrate-create # Create new migration
pnpm studio # Open Prisma Studio
pnpm prisma-generate # Generate Prisma clientThe project includes Docker Compose setup with MariaDB and Valkey services:
docker-compose up -dFor production deployment, use the included run.sh script which handles migrations and server startup.
src/
├── lib/
│ ├── components/ # Svelte components
│ ├── server/ # Server-side services
│ │ ├── agents-service.ts
│ │ ├── conversations-service.ts
│ │ ├── ai-service.ts
│ │ └── ...
│ ├── stores/ # Svelte stores
│ ├── types/ # TypeScript definitions
│ └── utils.ts
├── routes/
│ ├── (app)/ # Main application routes
│ ├── api/ # API endpoints
│ └── auth/ # Authentication pages
└── ...
- AI Service: Handles multiple AI provider integration
- Conversations Service: Manages conversations and messages
- Agents Service: CRUD operations for AI agents
- Queue Service: Background job processing with BullMQ
- TTS Service: Text-to-speech functionality
Required environment variables (see .env.example):
DATABASE_URL: MySQL/MariaDB connection stringREDIS_URL: Redis/Valkey connection stringCLERK_SECRET_KEY: Clerk authentication key- API keys for AI providers (stored per-user in database)
- Follow the existing code style and conventions
- Run
pnpm lintandpnpm checkbefore committing - Write meaningful commit messages
- Test your changes thoroughly
- Framework: SvelteKit
- Language: TypeScript
- Styling: TailwindCSS + PostCSS
- UI Components: Shadcn-svelte
- Database: Prisma ORM with MySQL/MariaDB
- Queue: BullMQ with Redis/Valkey
- Authentication: Clerk
- Real-time: Socket.io
- AI SDKs: Vercel AI SDK with multiple providers
- Audio: ElevenLabs for TTS