# Backup Tool A modern backup management application with a FastAPI backend and React frontend. ## Features - **Multiple Source Types**: Local filesystem, SSH/SFTP, and database (PostgreSQL, MySQL) - **Backup Strategies**: Full and incremental backups - **Scheduled Backups**: Cron-based scheduling with APScheduler - **Retention Policies**: Count-based and days-based backup retention - **Web Dashboard**: React-based UI for managing backups - **REST API**: Full REST API for programmatic access ## Architecture ``` backup-tool/ ├── backend/ # FastAPI backend │ ├── app/ # FastAPI application │ │ ├── routers/ # API endpoints │ │ ├── models.py # SQLAlchemy models │ │ ├── schemas.py # Pydantic schemas │ │ └── main.py # Application entry point │ ├── backup/ # Backup engine │ │ ├── adapters/ # Source adapters (local, SSH, database) │ │ ├── engine.py # Backup execution engine │ │ ├── scheduler.py # Job scheduler │ │ └── retention.py # Retention policies │ └── requirements.txt # Python dependencies ├── frontend/ # React frontend │ ├── src/ # Source code │ └── package.json # Node dependencies └── docs/ # Documentation ``` ## Quick Start ### Prerequisites - Python 3.11+ - Node.js 18+ - PostgreSQL or MySQL (for database backups) ### Backend Setup ```bash cd backend python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt # Run the server uvicorn app.main:app --reload --port 8000 ``` ### Frontend Setup ```bash cd frontend npm install npm run dev ``` ### Production Build ```bash cd frontend npm run build cd ../backend uvicorn app.main:app --host 0.0.0.0 --port 8000 ``` ## API Documentation Once the backend is running, visit: - Swagger UI: http://localhost:8000/docs - ReDoc: http://localhost:8000/redoc ## Configuration Environment variables: - `DATABASE_URL`: Database connection string (default: sqlite+aiosqlite:///./backup_tool.db) - `CORS_ORIGINS`: Comma-separated list of allowed CORS origins - `SQL_ECHO`: Enable SQL query logging (true/false) ## Development ### Running Tests ```bash cd backend pytest ``` ### Database Migrations ```bash cd backend alembic revision --autogenerate -m "Description" alembic upgrade head ``` ## License MIT