This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Development Environment Setup:
cd backend && ./dev.shThis sets up a Python virtual environment, installs dependencies with Tsinghua mirror, configures pre-commit hooks, and starts the development server on port 7892.
Run Application:
cd backend/src && python main.pyFrontend Development:
cd webui && pnpm install && pnpm run dev # Development server
cd webui && pnpm run build # Production build
./build-frontend.sh # Build and move to backend/src/distLinting and Formatting:
cd backend && ./venv/bin/ruff check .
cd backend && ./venv/bin/ruff format .
cd backend && ./venv/bin/black .
cd webui && pnpm run lint # Frontend linting
cd webui && pnpm run format # Frontend formattingTesting:
cd backend && ./venv/bin/pytest
cd backend && ./venv/bin/pytest test/test_specific_module.py # Run specific test
cd webui && pnpm run test # Frontend tests
cd webui && pnpm run test:build # TypeScript type checkingAuto_Bangumi is an RSS-based automatic anime downloading and organization tool with a FastAPI backend and Vue.js frontend.
Backend Structure (Python FastAPI):
main.py: FastAPI application entry point with poster serving and static file mountingmodule/core/: Core async application frameworkaiocore.py: AsyncApplicationCore manages service lifecycle and task schedulingservices/: Service implementations extending BaseService (RSS, Download, Renamer)monitors/: Background monitors for downloads, notifications, and renamingtask_manager.py: TaskManager handles async task scheduling and execution
module/api/: REST API endpoints organized by feature (auth, bangumi, config, etc.)module/parser/: Content parsing system for RSS feeds, torrents, and metadatamodule/downloader/: Download client abstractions (qBittorrent, Aria2, Transmission)module/manager/: File management (collection, renaming) and torrent handlingmodule/rss/: RSS feed processing and analysismodule/database/: SQLModel-based database layer for bangumi, RSS, and torrent datamodule/network/: HTTP client abstractions with proxy and caching support
Frontend Structure (Vue.js + TypeScript):
- Located in
webui/with Vite build system - Uses UnoCSS for styling, Naive UI for components
- Auto-import configuration for Vue Composition API
- API client in
src/api/matching backend endpoints - Pinia for state management
- Vue Router with file-based routing
Key Data Flow:
- RSS feeds are parsed and analyzed for anime information
- TMDB/Bangumi APIs provide metadata enrichment
- Download clients handle torrent/magnet downloads
- File renamer organizes downloads into media library structure
- Web UI provides management interface via REST API
Service Architecture: The application uses an async service-based architecture where:
- Each service (RSS, Download, Renamer) extends BaseService
- AsyncApplicationCore manages service lifecycle
- TaskManager schedules periodic service execution
- Services communicate via events system
- Monitors handle background tasks like download tracking
Configuration:
- Main config in
config/config.json - Search providers in
config/search_provider.json - Environment variables for runtime settings
Branch Strategy:
main: Stable releases only<version>-dev: Development branches for each minor version (e.g.,3.1-dev)- Bug fixes go to current version dev branch
- New features go to next version dev branch
Code Style:
- Backend: Ruff + Black formatting, Python 3.10+ target
- Frontend: ESLint + Prettier, TypeScript strict mode
- Pre-commit hooks enforce formatting