A comprehensive customer service ticketing system built with Django, featuring real-time chat functionality and automated ticket assignment. π
- π₯ User Management: Role-based system with customers and service providers
- π« Ticket Management: Create, track, and manage support tickets with UUID-based identification
- π¬ Real-time Chat: WebSocket-based chat system for ticket communication
- π€ Automated Assignment: Intelligent ticket assignment to least busy service providers
- π RESTful API: Complete API endpoints for all operations
- π³ Containerized: Docker-ready with MySQL and Redis support
- π Backend: Django 5.1.7, Django REST Framework
- ποΈ Database: MySQL 8
- β‘ Cache/Message Broker: Redis
- π WebSockets: Django Channels with Redis channel layer
- π³ Containerization: Docker & Docker Compose
- π Python: 3.13
ConnectDesk/
βββ Customer_Service/ # Main Django project
β βββ settings.py # Django settings
β βββ urls.py # URL configuration
β βββ asgi.py # ASGI configuration for WebSockets
β βββ wsgi.py # WSGI configuration
βββ home/ # Main application
β βββ models.py # Database models
β βββ views.py # API views
β βββ serializers.py # DRF serializers
β βββ consumers.py # WebSocket consumers
β βββ signals.py # Django signals
β βββ urls.py # App URLs
βββ requirements.txt # Python dependencies
βββ Dockerfile # Docker configuration
βββ docker-compose.yml # Multi-container setup
βββ manage.py # Django management script
- Extends Django's AbstractUser
- Role-based system:
CUSTOMERorSERVICE_PROVIDER - Automatic group assignment via signals
- UUID-based primary key
- Status tracking:
OPEN,IN_PROGRESS,RESOLVED,CLOSED - Automatic assignment to least busy service provider
- Links customers with service providers
- One-to-one relationship with tickets
- Real-time messaging capability
- Automatic room code generation
- π³ Docker & Docker Compose
- π Python 3.13 (for local development)
-
π₯ Clone the repository
git clone <repository-url> cd ConnectDesk
-
π¨ Build and run with Docker Compose
docker-compose up --build
-
π Run migrations
docker-compose exec web python manage.py makemigrations docker-compose exec web python manage.py migrate
-
π€ Create superuser
docker-compose exec web python manage.py createsuperuser -
π Access the application
- API: http://localhost:8000/
- Admin: http://localhost:8000/admin/
-
π¦ Install dependencies
pip install -r requirements.txt
-
βοΈ Configure database
- Update
DATABASESinsettings.pyfor local MySQL setup - Or use SQLite for development
- Update
-
π Run migrations
python manage.py makemigrations python manage.py migrate
-
π Start development server
python manage.py runserver
GET /users/- List all usersPOST /users/- Create new userGET /users/{id}/- Get user detailsPUT /users/{id}/- Update userDELETE /users/{id}/- Delete user
GET /tickets/- List all ticketsPOST /tickets/- Create new ticketGET /tickets/{id}/- Get ticket detailsPUT /tickets/{id}/- Update ticketDELETE /tickets/{id}/- Delete ticket
ws://localhost:8000/ws/chat/{room_code}- Connect to chat room
POST /users/
{
"username": "john_doe",
"password": "secure_password",
"role": "CUSTOMER"
}POST /tickets/
{
"customer_id": 1,
"title": "Login Issue",
"description": "Unable to log into my account"
}{
"sender": 1,
"message": "Hello, I need help with my account"
}- New tickets are automatically assigned to the least busy service provider
- Uses Django ORM annotations to count active tickets per provider
- WebSocket-based communication using Django Channels
- Messages are persisted in the database
- Room-based chat linked to specific tickets
- Automatic group assignment based on user role
- Signal-based group management
- Customizable permissions per role
DJANGO_SETTINGS_MODULE: Django settings moduleMYSQL_DATABASE: Database nameMYSQL_USER: Database userMYSQL_PASSWORD: Database password
- web: Django application server
- db: MySQL 8 database
- redis: Redis for caching and channel layer
python manage.py testpython manage.py makemigrations
python manage.py migratepython manage.py shell-
Database Connection Error
- Ensure MySQL service is running
- Check database credentials in settings
-
WebSocket Connection Failed
- Verify Redis is running
- Check channel layer configuration
-
Permission Denied
- Ensure user groups are properly assigned
- Check role-based permissions
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions, please create an issue in the repository or contact the development team.
Note: This is a development setup. For production deployment, ensure you:
- Set
DEBUG = False - Configure proper secret keys
- Use environment variables for sensitive data
- Set up proper logging
- Configure static file serving
- Use a production-grade web server (e.g., Gunicorn with Nginx)