2.5 KiB
2.5 KiB
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
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
cd frontend
npm install
npm run dev
Production Build
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 originsSQL_ECHO: Enable SQL query logging (true/false)
Development
Running Tests
cd backend
pytest
Database Migrations
cd backend
alembic revision --autogenerate -m "Description"
alembic upgrade head
License
MIT