Official CLI for myCloud — your personal cloud storage
Project description
myCloud
A full-stack personal cloud platform built with Flask + MySQL that supports file storage, folder management, sharing (direct invite + token links + batch sharing), previews, stash/recovery workflows, monitoring dashboards, and optional storage-node workflows.
Table of Contents
- Overview
- Core Features
- Project Structure
- Architecture
- Infrastructure and Runtime Topology
- Data and Schema Evolution
- Environment Configuration
- Local Development Setup
- Production Deployment (Linux VPS)
- Operations and Monitoring
- Security Notes
- Troubleshooting
- Release/Push Checklist
Overview
myCloud is a web application for managing personal cloud files with:
- User auth (username/password and social auth)
- Upload/download and folder operations
- Advanced sharing:
- direct user invites
- token-based share links
- batch share links for mixed files/folders
- Shared library actions (preview, copy to MyCloud, leave share, favorites)
- Stash workflow for temporary removal/recovery
- Node-aware storage metadata and optional node-side GUI tooling
- Monitoring endpoints for system, services, app activity, and product analytics
Core Features
Account and Auth
- Registration, login, logout, password reset, email verification
- Two-factor code flow endpoints
- OAuth providers:
- GitHub
File and Folder Management
- Upload files, create folders
- Rename, move, delete, stash, unstash
- Bulk operations: move/delete/download/share/stash/unstash/remove-share/add-to-mycloud
- Preview support for images/video/audio/PDF/code/docx (web UI behavior)
Sharing
- Direct item sharing with permission updates
- Share links for file/folder
- Batch share link generation and acceptance
- Unified share removal APIs
- Invite response APIs (accept/decline + optional mute sender)
- Muted user management for invite control
UX and Settings
- Preferences APIs and sync endpoints
- Theme/view mode handling in frontend assets
- Profile picture upload/remove
- Notifications API + mark-read/hide
Monitoring and Analytics
- System metrics API (CPU/RAM/disk/network/load)
- Service status/log APIs (nginx/gunicorn/ssh where available)
- Application activity monitor (recent events/endpoints)
- Product analytics overview/trends
Project Structure
.
|- app.py # Main Flask + Socket.IO server
|- services.py # Linux service/log monitoring helpers
|- monitor.py # System monitor abstraction + local implementation
|- app_monitor.py # App-level activity monitoring
|- data_monitor.py # Data/storage monitoring
|- product_analytics.py # Product usage analytics
|- db_update_nodes.py # DB schema updates for storage node support
|- migrate_shares_table.py # Migration to unified shares table
|- setup_batch_sharing_db.py # Batch share schema bootstrap
|- mycloud_node_gui.py # Optional node desktop GUI client
|- deploy_changed_files.ps1 # Incremental deployment helper (scp/ssh)
|- templates/ # Flask templates
|- static/ # Frontend JS/CSS/assets
|- uploads/ # Runtime user uploads (ignored from git)
|- requirements.txt # Python dependencies
|- .env.example # Environment variable template
Architecture
Application Layer
- Framework: Flask
- Real-time channel: Flask-SocketIO
- Reverse-proxy awareness: Werkzeug ProxyFix
- Session + auth logic + routing in a single main server file (
app.py)
Real-time / Socket Layer
Socket handlers are registered in app.py for:
- node registration
- node disconnect
- chunked download transfer
Persistence Layer
- Primary DB: MySQL (
mysql-connector-python) - Schema support scripts:
migrate_shares_table.pycreates/migrates a unifiedsharesmodelsetup_batch_sharing_db.pyprovisionsbatch_share_linksandbatch_share_itemsdb_update_nodes.pyprovisionsstorage_nodesand extendsfileswith node metadata
Frontend Layer
- Server-rendered Jinja templates in
templates/ - Static JS/CSS in
static/ - Rich shared-files interactions include:
- list/grid sort/filter/view
- direct invite modal and muted-users modal
- multi-select action toolbar
Infrastructure and Runtime Topology
Typical production topology:
- Browser clients -> Nginx reverse proxy -> Gunicorn/Eventlet Flask-SocketIO app
- App server -> MySQL database
- Optional storage nodes -> connect/register via Socket.IO events
services.py is designed for Linux hosts with optional systemctl / journalctl access and can inspect:
- nginx
- gunicorn (unit configurable via
MONITOR_GUNICORN_SERVICE) - ssh/sshd
Data and Schema Evolution
Node/Storage schema updates
Run once when enabling node-aware storage metadata:
python db_update_nodes.py
What it does:
- Creates
storage_nodes - Adds
files.storage_mode(defaultcentral) if missing - Adds
files.node_idFK tostorage_nodes(id)if missing
Shares migration
Run once to unify old sharing models:
python migrate_shares_table.py
What it does:
- Creates unified
sharestable if missing - Migrates data from older share tables/links when present
Batch share schema bootstrap
Run once to enable batch share links:
python setup_batch_sharing_db.py
What it does:
- Creates
batch_share_links - Creates
batch_share_itemswith FK cascade
Environment Configuration
Copy the template and fill values:
cp .env.example .env
On Windows PowerShell:
Copy-Item .env.example .env
Key variables
- Flask/runtime:
FLASK_SECRET_KEYFLASK_HOSTFLASK_PORTFLASK_DEBUGAPP_BASE_URL
- Session hardening:
SESSION_COOKIE_SECURESESSION_COOKIE_SAMESITESESSION_LIFETIME_HOURS
- Database:
DB_HOSTDB_USERDB_PASSWORDDB_NAME
- OAuth/API:
GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETGOOGLE_API_KEYGITHUB_CLIENT_IDGITHUB_CLIENT_SECRETMONITOR_API_KEY
- SMTP:
SMTP_SENDER_EMAILSMTP_SENDER_PASSWORD
- Storage and sockets:
UPLOAD_FOLDERACCOUNT_STORAGE_LIMIT_GBSOCKETIO_CORS_ORIGINS
- Monitoring/services:
MONITOR_GUNICORN_SERVICE
Local Development Setup
1) Create virtual environment
python -m venv .venv
Windows PowerShell:
.\.venv\Scripts\Activate.ps1
2) Install dependencies
pip install -r requirements.txt
3) Configure .env
Set a strong FLASK_SECRET_KEY and valid DB credentials.
4) Optional DB setup/migrations
python db_update_nodes.py
python migrate_shares_table.py
python setup_batch_sharing_db.py
5) Run app
python app.py
Server binds to:
- host:
FLASK_HOST(default0.0.0.0) - port:
FLASK_PORT(default5000)
Production Deployment (Linux VPS)
Recommended stack
- Nginx (reverse proxy)
- Gunicorn + eventlet worker class for Socket.IO compatibility
- systemd service for app process
- MySQL reachable from app host
Example command:
gunicorn -k eventlet -w 1 -b 0.0.0.0:5000 app:app
Note: For Flask-SocketIO apps, eventlet/gevent-compatible deployment is recommended.
Incremental deploy helper
deploy_changed_files.ps1 can:
- detect changed deployable files from git status
- fallback to
changed_files.txtwhen needed - upload files via
scpand pre-create remote directories viassh - optionally restart systemd service
Example:
.\deploy_changed_files.ps1 -RestartService -ServiceName mycloud
Before using in another environment, adjust script parameters:
KeyPathUserServerHostRemoteRootServiceName
Operations and Monitoring
Monitoring routes are exposed in the app for:
- system metrics
- service status/logs
- app-level statistics and recent endpoint activity
- product analytics summaries/trends
For protected monitoring APIs, provide configured MONITOR_API_KEY where required by your runtime policy.
Security Notes
- Never commit
.env, private keys, or runtime upload content. - Rotate any credentials that were ever hardcoded/shared.
- Keep
FLASK_SECRET_KEYlong and random. - Enforce HTTPS in production and keep
SESSION_COOKIE_SECURE=true. - Restrict CORS origins via
SOCKETIO_CORS_ORIGINS.
Troubleshooting
App fails at startup with secret key error
- Ensure
FLASK_SECRET_KEYis set in.env.
DB connection/migration errors
- Verify
DB_HOST,DB_USER,DB_PASSWORD,DB_NAME - Ensure MySQL user has schema alter/create permissions
Socket issues behind proxy
- Ensure proxy supports websocket upgrade
- Use an eventlet-compatible Gunicorn setup
Monitoring service status unavailable
- Confirm Linux host has
systemctl/journalctl - Verify service names (
MONITOR_GUNICORN_SERVICE)
Release/Push Checklist
.envexcluded from gituploads/,build/,dist/,__pycache__/,.venv/excluded from gitrequirements.txtup to date.env.examplepresent and current- Run schema scripts on target environment before first production run
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 mycloudctl-1.0.0.tar.gz.
File metadata
- Download URL: mycloudctl-1.0.0.tar.gz
- Upload date:
- Size: 29.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c6a06803bedccf42ad54af0ecc3105a2733629037c5d44f9f7abf779e39c681
|
|
| MD5 |
40bf1d409632c672be117932d0097d07
|
|
| BLAKE2b-256 |
745de67ef52316da61f5928c6a26a18fcc59c3acb4e8a42c0f2cae4838c5212f
|
File details
Details for the file mycloudctl-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mycloudctl-1.0.0-py3-none-any.whl
- Upload date:
- Size: 34.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f29432e2473a93c48a97fa5f3646ce13b544123ed1b32736c0f7463a6a43ae3
|
|
| MD5 |
1a7d83283e7155e54edfec2d993c9245
|
|
| BLAKE2b-256 |
d8a5db35cb77a4b2354e745582d2af11c3f021c05412e3e287babf2cb270c3c2
|