# AniWorld Application Features ## 1. Authentication & Security - Master password authentication (JWT-based) - `POST /auth/login`: Login and receive JWT token - `GET /auth/verify`: Verify JWT token validity - `POST /auth/logout`: Logout (stateless) - Password hashing (SHA-256 + salt) - Configurable session timeout - Secure environment variable management ## 2. Health & System Monitoring - Health check endpoints - `/health`: Basic health status - `/api/health`: Load balancer health - `/api/health/system`: System metrics (CPU, memory, disk) - `/api/health/database`: Database connectivity - `/api/health/dependencies`: External dependencies - `/api/health/performance`: Performance metrics - `/api/health/metrics`: Prometheus metrics - `/api/health/ready`: Readiness probe (Kubernetes) ## 3. Anime & Episode Management - Search anime - `GET /api/anime/search`: Search anime by title (pagination) - Get anime details - `GET /api/anime/{anime_id}`: Anime details - `GET /api/anime/{anime_id}/episodes`: List episodes - `GET /api/episodes/{episode_id}`: Episode details ## 4. Database & Storage Management - Database info and statistics - `GET /api/database/info`: Database stats - Maintenance operations - `/maintenance/database/vacuum`: Vacuum database - `/maintenance/database/analyze`: Analyze database - `/maintenance/database/integrity-check`: Integrity check - `/maintenance/database/reindex`: Reindex database - `/maintenance/database/optimize`: Optimize database - `/maintenance/database/stats`: Get database stats ## 5. Bulk Operations - Bulk download, update, organize, delete, export - `/api/bulk/download`: Start bulk download - `/api/bulk/update`: Bulk update - `/api/bulk/organize`: Organize series - `/api/bulk/delete`: Delete series - `/api/bulk/export`: Export series data ## 6. Performance Optimization - Speed limit management - `/api/performance/speed-limit`: Get/set download speed limit - Cache statistics - `/api/performance/cache/stats`: Cache stats - Memory management - `/api/performance/memory/stats`: Memory usage stats - `/api/performance/memory/gc`: Force garbage collection - Download queue management - `/api/performance/downloads/tasks`: List download tasks - `/api/performance/downloads/add-task`: Add download task - `/api/performance/resume/tasks`: List resumable tasks ## 7. Diagnostics & Logging - Diagnostic report generation - `/diagnostics/report`: Generate diagnostic report - Error reporting and stats - Logging configuration and log file management ## 8. Integrations - API key management - Webhook configuration - Third-party API integrations ## 9. User Preferences & UI - Theme management (light/dark/auto) - Language selection - Accessibility features (screen reader, color contrast, mobile support) - Keyboard shortcuts - UI density and grid/list view options ## 10. CLI Tool - Series scanning and management - Search, download, rescan, display series - Progress bar for downloads - Retry logic for operations ## 11. Miscellaneous - Environment configuration via `.env` - Modular, extensible architecture (MVC, Clean Architecture) - Automated testing (pytest, unittest) - Centralized error handling ## Authentication & Setup Flow ### Application Initialization Flow - **Setup Page**: Display application setup page when the application is run for the first time and no configuration exists - Check for presence of configuration file/database setup - Guide user through initial application configuration - Set up database connections, initial admin user, and core settings - Mark setup as completed in configuration - **Authentication Gate**: Redirect to authentication page when user token is invalid or missing - Validate existing authentication tokens - Display login/registration interface for unauthenticated users - Handle token refresh and session management - Redirect authenticated users to main application - **Main Application**: Show index.html for authenticated users with valid tokens - Display main application interface - Provide access to all authenticated user features - Maintain session state and handle token expiration gracefully ### User Flow Priority 1. Check if application setup is completed → Show setup page if not 2. Check if user is authenticated → Show auth page if not 3. Show main application (index.html) for authenticated users --- **Note:** Each feature is implemented via modular controllers, services, and utilities. See the respective source files for detailed function/class definitions.