ChatAPI#
A lightweight, multitenant chat service built in Go with SQLite, WebSocket support, and durable message delivery.
π Key Features#
- Multitenant Architecture: API key-based tenancy with per-tenant rate limiting
- Real-time Messaging: WebSocket connections for instant chat delivery
- Durable Delivery: Store-then-send with at-least-once guarantees and retry logic
- Message Sequencing: Per-room message ordering with client acknowledgments
- Room Types: Support for DMs, groups, and channels
- SQLite Backend: WAL mode for concurrent reads/writes
- Graceful Shutdown: Clean connection draining and state persistence
π Quick Start#
Prerequisites#
- Go 1.21+
- SQLite3 (optional, for CGO builds)
Installation#
# Clone the repository
git clone https://github.com/Byabasaija/chatapi.git
cd chatapi
# Install dependencies
go mod download
# Build the binary
go build -o bin/chatapi ./cmd/chatapiRun#
# Set environment variables
export LISTEN_ADDR=":8080"
export DATABASE_DSN="file:chatapi.db?_journal_mode=WAL&_busy_timeout=5000"
# Start the server
./bin/chatapiπ Documentation Sections#
- Getting Started - Installation and basic setup
- API Reference - REST and WebSocket API documentation
- Guides - Advanced usage and integration guides
- Architecture - System design and database schema
π Links#
ChatAPI is designed for modern chat applications requiring reliable, real-time messaging with multi-tenant support. Built with performance and simplicity in mind.