Open Source Customer Service System - A real-time live chat system for customer service that's easy to use and extend.
Live Demo · Report Bug · Request Feature
HeraDesk is an open source customer service system built with modern technology. Perfect for businesses that need live chat features with customers without relying on third-party services.
HeraDesk is built with Bun.js for maximum WebSocket performance:
- 7x more WebSocket throughput compared to Node.js (source)
- Ultra-low latency for real-time messaging
- Handle thousands of concurrent connections efficiently
- Native WebSocket support with optimized memory usage
Learn more about Bun.js WebSocket improvements:
- Blazing Fast WebSocket - Built with Bun.js for 7x more throughput
- Real-time Chat - Instant messaging with ultra-low latency
- Anonymous Customer Chat - No registration required for customers
- Multi-Agent Support - Handle multiple CS agents with automatic queue
- Dashboard Analytics - Monitor team performance with statistics
- Canned Responses - Quick reply templates for faster response
- Chat Transfer - Transfer chats between CS agents easily
- Admin Dashboard - User management and chat logs
- JWT Authentication - Secure token-based authentication
- S3 Storage - Support for file uploads
| Layer | Technology | Why? |
|---|---|---|
| Runtime | Bun.js | 7x faster WebSocket, native TypeScript |
| Frontend | React 19, Tailwind CSS | Modern UI with latest features |
| Database | PostgreSQL, Prisma ORM | Reliable, type-safe database |
| Authentication | JWT (JSON Web Token) | Secure, stateless auth |
| Real-time | Native Bun WebSocket | High performance pub/sub |
| Storage | S3-compatible | Flexible file storage |
heradesk/
├── engine/ # Backend
│ └── src/
│ ├── config/ # Environment, database, S3 config
│ ├── db/ # Database seed
│ ├── middleware/ # Auth middleware
│ ├── routes/ # API routes
│ ├── services/ # Business logic
│ ├── utils/ # JWT utilities
│ ├── websocket/ # WebSocket handler
│ └── index.ts # Entry point
├── dashboard/ # Frontend
│ └── src/
│ ├── pages/
│ │ ├── Landing.tsx # Customer chat widget
│ │ ├── auth/Login.tsx # Login page
│ │ ├── cs/Dashboard.tsx # CS dashboard
│ │ └── admin/Dashboard.tsx # Admin dashboard
│ └── index.css # Tailwind CSS
├── prisma/
│ └── schema.prisma # Database schema
├── package.json
├── tailwind.config.js
└── tsconfig.json
- Bun.js (v1.0+)
- PostgreSQL (v14+)
- Clone the repository
git clone git@github.com:herihermwn/heradesk.git
cd heradesk- Install dependencies
bun install- Configure environment variables
cp .env.example .envEdit .env with your configuration:
DATABASE_URL=postgresql://user@localhost:5432/heradesk
JWT_SECRET=your_secret_key- Setup database
# Create database
createdb heradesk
# Push schema to database
bun run db:push
# Seed initial data
bun run db:seed- Build CSS
bun run css:build- Start the server
bun run devServer will run at http://127.0.0.1:3002
| Script | Description |
|---|---|
bun run dev |
Start development server with hot reload |
bun run start |
Start production server |
bun run css:build |
Build Tailwind CSS |
bun run css:watch |
Watch and rebuild CSS on changes |
bun run db:generate |
Generate Prisma client |
bun run db:push |
Push schema to database |
bun run db:migrate |
Run database migrations |
bun run db:seed |
Seed initial data |
bun run db:studio |
Open Prisma Studio |
After running bun run db:seed, the following accounts are available:
| Role | Username | Password |
|---|---|---|
| Admin | admin | admin123 |
| CS | cs | cs123 |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/login |
Login with username and password |
| POST | /api/auth/logout |
Logout current session |
| GET | /api/auth/me |
Get current user info |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/health |
Server health status |
| Path | Description |
|---|---|
/ |
Landing page with customer chat widget |
/login |
Login page for CS and Admin |
/cs |
Customer Service dashboard |
/admin |
Admin dashboard |
- users - Admin and CS accounts
- cs_status - CS online/offline/busy status
- chat_sessions - Customer chat sessions
- messages - Chat messages
- canned_responses - Quick reply templates
- activity_logs - Activity logging
| Event | Direction | Description |
|---|---|---|
customer:send_message |
Client to Server | Send message to CS |
chat:assigned |
Server to Client | CS has been assigned |
chat:message |
Server to Client | New message from CS |
| Event | Direction | Description |
|---|---|---|
cs:set_status |
Client to Server | Set online/offline/busy |
cs:send_message |
Client to Server | Send message to customer |
chat:new |
Server to Client | New chat waiting |
chat:message |
Server to Client | Message from customer |
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 3002 |
HOST |
Server host | 127.0.0.1 |
NODE_ENV |
Environment | development |
DATABASE_URL |
PostgreSQL connection string | - |
JWT_SECRET |
JWT signing secret | - |
JWT_EXPIRES_IN |
JWT expiration time | 15m |
S3_ENDPOINT |
S3 endpoint URL | - |
S3_BUCKET |
S3 bucket name | - |
S3_ACCESS_KEY |
S3 access key | - |
S3_SECRET_KEY |
S3 secret key | - |
MAX_CHAT_PER_CS |
Max concurrent chats per CS | 5 |
Contributions are welcome! If you want to contribute:
- Fork this repository
- Create a new feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Create a Pull Request
If you find a bug or have suggestions, please create an issue on GitHub.
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by Heri Hermawan