A modern, responsive dashboard for managing and analyzing chat conversations. Built with Next.js 14, TypeScript, and SQLite.
- Secure login system with role-based access control (Admin/User roles)
- User management interface for administrators
- Password hashing using bcrypt
- Cookie-based authentication with middleware protection
- Real-time chat session viewing
- Message history with timestamps
- Conversation grouping by session ID
- Support for both AI and human messages
- Message distribution visualization (AI vs Human messages)
- Timeline analysis of chat activity
- Message volume trends
- Interactive filters and sorting options
- User management (Create, Delete, Reset Password)
- Role assignment (Admin/User)
- System settings configuration
- Webhook URL management for data integration
- Clean, responsive design using Tailwind CSS
- Dark/Light theme support
- Loading states and error handling
- Mobile-friendly interface
- Frontend: Next.js 14, React, TypeScript
- Styling: Tailwind CSS, DaisyUI
- Database: SQLite
- Authentication: Custom auth with bcrypt
- State Management: React Context
- Data Visualization: Chart.js, react-chartjs-2
- API: Next.js API Routes
- Cookie Management: js-cookie
- Node.js 18+
- Yarn package manager
- SQLite3
-
Clone the repository:
git clone https://github.com/yourusername/chat-dashboard.git cd chat-dashboard
-
Install dependencies:
yarn install
-
Create the database and admin user:
mkdir -p data node scripts/create-admin.js
-
Start the development server:
yarn dev
-
Clone the repository:
git clone https://github.com/yourusername/chat-dashboard.git cd chat-dashboard
-
Create a
.env
file for Docker:cp .env.local .env
-
Build and start the container:
docker-compose up -d
-
View logs (optional):
docker-compose logs -f
The application will be available at http://localhost:3000
- Start the application:
docker-compose up -d
- Stop the application:
docker-compose down
- View logs:
docker-compose logs -f
- Rebuild the container:
docker-compose up -d --build
- Remove volumes:
docker-compose down -v
For production deployment, make sure to:
- Set a strong
NEXTAUTH_SECRET
in your environment - Configure your webhook URL through
NEXT_PUBLIC_DEFAULT_WEBHOOK_URL
- Update
NEXTAUTH_URL
to match your domain - Use proper SSL/TLS termination
- Consider using a reverse proxy (e.g., Nginx)
Example production docker-compose command:
NEXTAUTH_URL=https://your-domain.com \
NEXTAUTH_SECRET=your-secure-secret \
NEXT_PUBLIC_DEFAULT_WEBHOOK_URL=https://your-webhook-url \
docker-compose up -d
chat-dashboard/
├── src/
│ ├── app/ # Next.js app router pages
│ ├── components/ # React components
│ ├── contexts/ # React contexts
│ ├── lib/ # Utility functions and database
│ └── types/ # TypeScript type definitions
├── public/ # Static assets
├── scripts/ # Utility scripts
└── data/ # SQLite database
POST /api/auth/login
- User authenticationGET /api/users
- List all users (admin only)POST /api/users
- Create new user (admin only)DELETE /api/users/:id
- Delete user (admin only)POST /api/users/:id/reset-password
- Reset user password (admin only)GET /api/chat-sessions
- Get chat sessionsGET /api/settings
- Get system settingsPOST /api/settings
- Update system settings (admin only)
- All passwords are hashed using bcrypt
- Protected routes using Next.js middleware
- Role-based access control
- Cookie-based authentication
- SQL injection protection through parameterized queries
- Fork the repository
- Create your 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
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Next.js team for the amazing framework
- Tailwind CSS for the styling system
- DaisyUI for the component library
- Chart.js for data visualization
For support, please open an issue in the GitHub repository or contact the maintainers.