Technology Stack
Backend
- Frappe Framework: Python-based full-stack web application framework
- Python: 3.14+ with type annotations
- MariaDB: 10.8+ for relational data storage
- Redis: Caching, background jobs, and real-time updates
- Socket.IO: WebSocket server for real-time communication
Frontend
- Vue 3: Progressive JavaScript framework with Composition API
- TypeScript: Type-safe development
- Vite: Fast build tool and dev server
- Frappe UI: Vue-based UI component library
- Tailwind CSS: Utility-first CSS framework
- Pinia: State management
- Vue Router: Client-side routing
Additional Technologies
- Textblob: Natural language processing for text analysis
- Socket.IO Client: Real-time updates in the frontend
- Tiptap: Rich text editor based on ProseMirror
- Lucide Icons: Modern icon system via unplugin-icons
High-Level Architecture
Project Structure
Backend Structure (helpdesk/)
Frontend Structure (desk/)
Core Components
DocTypes (Data Models)
Frappe uses DocTypes as the foundation for data modeling. Key DocTypes in Helpdesk:- HD Ticket: Core ticket entity with subject, description, status, priority
- HD Agent: Agent profiles and permissions
- HD Customer: Customer information and contact details
- HD Article: Knowledge base articles
- HD Service Level Agreement: SLA definitions and tracking
- HD Ticket Comment: Conversation threads
- HD Notification: User notifications
- HD Saved Reply: Templated responses
- HD Assignment Rule: Auto-assignment configuration
- Field schema and validation
- Permissions and access control
- Server-side business logic
- Database structure
API Layer
API endpoints are Python functions decorated with@frappe.whitelist() located in helpdesk/api/:
- Data validation
- Business logic execution
- Permission checks
- Database operations
Frontend Data Fetching
The frontend uses Frappe UI’s resource composables for data fetching:Real-Time Updates
Socket.IO enables real-time features: Backend (helpdesk/utils.py):
desk/src/socket.ts):
Key Design Patterns
Frappe ORM
Frappe provides an ORM for database operations:Permission System
Frappe’s role-based permission system is extended inhelpdesk/hooks.py:
Component Composition
Vue components follow the Composition API pattern:State Management
Pinia stores manage global state:Search Architecture
Frappe Helpdesk implements full-text search using SQLite FTS5: Backend (helpdesk/search.py):
- Index building for tickets and articles
- Natural language query processing
- Relevance ranking
- Background index updates
helpdesk/hooks.py):
Background Jobs
Frappe’s scheduler handles background tasks:Build and Deploy Pipeline
Development Build
Production Build
Configured indesk/vite.config.js:
- Static assets to
helpdesk/public/desk/ - HTML entry point to
helpdesk/www/helpdesk/index.html
Security Considerations
Authentication
- Session-based authentication via Frappe Framework
- Custom auth hooks in
helpdesk/auth.py - JWT support for API access
Authorization
- Role-based access control (RBAC)
- Document-level permissions
- Field-level permission rules
- Custom permission handlers
Data Validation
- Server-side validation in DocType controllers
- Frontend validation using Zod schemas
- SQL injection prevention via ORM
- XSS protection with sanitize-html
Performance Optimization
Backend
- Redis caching for frequently accessed data
- Database query optimization with indexes
- Background job processing for heavy tasks
- Connection pooling for database
Frontend
- Code splitting with Vite
- Lazy loading of routes
- Virtual scrolling for large lists
- Debounced search inputs
- Progressive Web App (PWA) support
Extensibility
Custom DocTypes
Create new DocTypes through the Frappe UI or JSON definition.API Extensions
Add new endpoints inhelpdesk/api/ or helpdesk/extends/.
Frontend Plugins
Register custom components and routes:Hooks
Extend behavior viahelpdesk/hooks.py:
Testing Strategy
Backend Tests
Frappe’s unittest-based testing:Frontend Tests
Not currently implemented in the repository, but can be added with Vitest.Next Steps
- Set up a Local Development Environment
- Try the Docker Setup for quick starts
- Explore the API Reference for available endpoints
- Review Contributing Guidelines on GitHub