Production-grade backup engine for files, PostgreSQL, MySQL, MongoDB and MSSQL — with a built-in web dashboard, login system and pluggable database backends.
Project description
pybackup-engine
Production-grade backup engine for files and databases — with a built-in web dashboard, user login system, and pluggable database backends.
Features
| Feature | Detail |
|---|---|
| Backup engines | Files, PostgreSQL (pg_dump), MySQL (mysqldump), MongoDB (mongodump), MS SQL Server (sqlcmd) |
| Web dashboard | Built-in pure Python HTTP server — no Flask, FastAPI or Django |
| Login system | PBKDF2 password hashing, session tokens, admin/viewer roles |
| User management | Create, list, delete users via CLI or web UI |
| Change password | Users can change their own password in the dashboard |
| Database backends | SQLite (default), PostgreSQL, MySQL, MongoDB, MSSQL — like Django's DATABASES |
| CLI | run, serve, verify, checksum, config-check, user add/list/delete |
| Fonts | Space Grotesk headings · Inter body |
| Theme | Dark / Light toggle |
Install
pip install pybackup-engine
With optional database backend support:
pip install pybackup-engine[postgresql] # psycopg2-binary
pip install pybackup-engine[mysql] # PyMySQL
pip install pybackup-engine[mongodb] # pymongo
pip install pybackup-engine[mssql] # pyodbc
pip install pybackup-engine[all] # all backends
Quick Start
1. Create the first admin user
pybackup user add --username admin --role admin
2. Write a config
# pybackup.yaml
version: 1
global:
backup_root: /backups
retention_days: 7
compress: true
# Internal metadata database (SQLite by default, switch to postgres/mysql/etc)
database:
backend: sqlite
name: /var/lib/pybackup/pybackup.db
postgresql:
enabled: true
jobs:
- name: prod-db
host: localhost
database: myapp
username: backup_user
password: ${PGPASSWORD}
files:
enabled: true
jobs:
- name: configs
source: /etc/myapp
exclude: ["*.log", "*.tmp"]
3. Run backups
pybackup run --config pybackup.yaml
4. Start the dashboard
pybackup serve --port 8200
Open http://localhost:8200 → login with your admin credentials.
CLI Reference
pybackup run -c config.yaml [--dry-run]
pybackup serve [--host 0.0.0.0] [--port 8200] [-c config.yaml]
pybackup verify FILE --checksum SHA256 [--algorithm sha256]
pybackup checksum FILE [--algorithm sha256]
pybackup config-check -c config.yaml
pybackup user add --username USER --role admin|viewer
pybackup user list
pybackup user delete --username USER
pybackup user set-password --username USER
Database Backends
Inspired by Django's DATABASES setting — just change the backend: value:
# SQLite (default, zero config)
database:
backend: sqlite
name: /var/lib/pybackup/pybackup.db
# PostgreSQL
database:
backend: postgresql
host: localhost
port: 5432
name: pybackup
user: pybackup_user
password: ${DB_PASSWORD}
# MySQL / MariaDB
database:
backend: mysql
host: localhost
name: pybackup
user: pybackup_user
password: ${MYSQL_PASSWORD}
# MongoDB
database:
backend: mongodb
host: localhost
name: pybackup
user: pybackup_user
password: ${MONGO_PASSWORD}
# MS SQL Server
database:
backend: mssql
host: localhost
name: pybackup
user: sa
password: ${MSSQL_PASSWORD}
REST API
All endpoints under /api/ — authenticated via Authorization: Bearer <token>:
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/auth/login |
Public | Login, returns session token |
| POST | /api/auth/logout |
Session | Logout |
| GET | /api/auth/me |
Session | Current user info |
| POST | /api/auth/change-password |
Session | Change own password |
| GET | /api/users |
Admin | List all users |
| POST | /api/users |
Admin | Create user |
| DELETE | /api/users/:id |
Admin | Delete user |
| GET | /api/stats |
Session | Dashboard statistics |
| GET | /api/runs |
Session | Paginated run list |
| POST | /api/runs |
Session | Create a run entry |
| GET | /api/runs/:id |
Session | Run detail + files |
| DELETE | /api/runs/:id |
Admin | Delete a run |
| GET | /api/settings |
Session | Get settings |
| POST | /api/settings |
Session | Update settings |
Project Structure
pybackup/
├── cli.py # Click CLI (run/serve/verify/user)
├── auth.py # PBKDF2 passwords, session tokens, UserDB
├── constants.py
├── config/loader.py # YAML + env var expansion
├── engine/
│ ├── base.py # BaseBackupEngine (prepare/run/finalize)
│ ├── files.py # File/dir backup with tar.gz support
│ ├── mongo.py / postgres.py / mysql.py / mssql.py
│ ├── verify.py # SHA-256/512 checksums
│ └── manifest.py # JSON sidecar manifests
├── db/
│ ├── database.py # SQLite implementation
│ └── backends/
│ ├── __init__.py # get_database() factory
│ ├── postgres_backend.py
│ ├── mysql_backend.py
│ ├── mongo_backend.py
│ └── mssql_backend.py
├── server/
│ ├── httpserver.py # Pure stdlib ThreadingHTTPServer + Router
│ └── handlers.py # All REST API handlers
└── static/
├── login.html # Login page
├── index.html # SPA dashboard
├── css/app.css # Space Grotesk + Inter · dark/light
└── js/app.js # Vanilla JS SPA
Security
- Passwords hashed with PBKDF2-HMAC-SHA256 (600,000 iterations, 32-byte salt)
- Session tokens are cryptographically random 32-byte hex strings
- Sessions expire after 8 hours
- Database credentials resolved from environment variables (
${VAR}syntax) - Constant-time password comparison to prevent timing attacks
License
MIT © PyBackup Contributors
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pybackup_engine-2.1.0.tar.gz.
File metadata
- Download URL: pybackup_engine-2.1.0.tar.gz
- Upload date:
- Size: 68.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
757015d7d57ebb8a56541a4daa5a619c059abc5dbe68a52b5f18cb381d2f3747
|
|
| MD5 |
ad081da53c4fbbf4c7ca101da965d994
|
|
| BLAKE2b-256 |
38fef45d95f514a388bc901268e52d3f4ecb726bd8e52898991ed31789d03f18
|
File details
Details for the file pybackup_engine-2.1.0-py3-none-any.whl.
File metadata
- Download URL: pybackup_engine-2.1.0-py3-none-any.whl
- Upload date:
- Size: 72.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c65f94012c00068129e8775fd1d77c1d4407f989037b4671d8e96bdf1d490e44
|
|
| MD5 |
48f33094c8f8fcb3d92e83a6cad98a93
|
|
| BLAKE2b-256 |
aacacb219787af0fc6ad041dcd72d0c1d4ba8e573e14d1b93caea63c4e55b739
|