OneCloud is a personal cloud backend that gives you real-time insights and control over your devices.
It acts as the central hub for your personal cloud, enabling system monitoring, AI-assisted queries, and remote operations โ securely accessible from anywhere.
The backend leverages Flask APIs and Cloudflare Tunnel for secure access, even behind NAT or firewalls.
With OneCloud, you can:
- Monitor multiple devices in real time
- View detailed system metrics
- Capture screenshots remotely
- Perform control actions like shutdown/reboot
- Chat with an AI assistant about your system
- Keep your devices safe with token-based authentication
The OneCloud Backend works together with the OneCloud Frontend to give you a full dashboard experience. The frontend is a separate project and can be found here: Frontend Repo โ github.com/Rhishavhere/mydesk.app
OneCloud consists of:
-
Backend API (This Project) Runs on each monitored device, collecting metrics and handling control actions.
-
Frontend Dashboard A separate React/TypeScript project that consumes this API and displays a beautiful dashboard (see link above).
Cloudflare Tunnel securely connects your devices to the internet without opening ports.
When a request is made to your domain (e.g., https://your-domain.com), Cloudflare routes it through a secure outbound-only tunnel to your API.
Benefits:
- ๐ No open ports โ safer by design
- โก Simpler setup โ no complex networking configs
- ๐ TLS by default โ automatic HTTPS
- ๐ก DDoS Protection โ Cloudflare shields your API
OneCloud supports both Windows and Linux (Fedora) environments with separate API scripts:
- Windows โ
api_win.pyโ exposes/desktop/*endpoints - Linux (Fedora) โ
api_linux.pyโ exposes/laptop/*endpoints
Update the exposed endpoints to match your device preferences.
Simply run the script for your OS and tunnel it using Cloudflare Tunnel to your chosen public hostname. Example:
- Desktop:
https://your-domain.com/desktop/system/overview - Laptop:
https://your-domain.com/laptop/system/overview
| Endpoint | Method | Description |
|---|---|---|
| Capture current screen | ||
| Schedule shutdown | ||
| Schedule reboot | ||
| Cancel shutdown/reboot | ||
| Capture image from webcam and return as PNG |
| Endpoint | Method | Description |
|---|---|---|
| MJPEG video stream of the desktop | ||
| Control mouse/keyboard actions |
| Endpoint | Method | Description |
|---|---|---|
| Chat with your devices using Google Gemini AI |
| Endpoint | Method | Description |
|---|---|---|
| API health status |
limit(int) โ number of processes to return (default: 20)sort(string) โ sort bymemory,cpu,name, orpid(default:memory)
Example:
GET /desktop/system/processes?limit=10&sort=cpuwidth(int) โ resize image width before returningheight(int) โ resize image height before returningquality(int) โ image quality (default: 95)
Example:
GET /desktop/system/screenshot?width=800&height=600&quality=80query(string) โ natural language question or commandinclude_screenshot(bool) โ if true, attaches a screenshot for AI context Body: { "query": "Describe the system status", "include_screenshot": true }
---
### `/desktop/livestream` (GET)
- `fps` *(int)* โ frames per second (default: 15, max: 30)
- `quality` *(int)* โ JPEG quality 1-100 (default: 70)
- `scale` *(float)* โ resolution scale 0.1-1.0 (default: 0.5)
- `cursor` *(string)* โ `crosshair`, `simple`, or `none`
**Example:**
```bash
https://your-domain.com/desktop/livestream?fps=20&quality=80&scale=0.75
Control the mouse remotely. Requires Authorization header.
Body (Move):
{
"action": "move",
"x": 0.5, // 0.0 to 1.0 (normalized)
"y": 0.5,
"normalized": true
}Body (Click/Tap):
{
"action": "tap", // or 'doubletap', 'rightclick'
"x": 0.5,
"y": 0.5
}Body (Scroll):
{
"action": "scroll",
"delta": 200 // positive = up, negative = down
}- Python 3.8+
- Cloudflare account +
cloudflaredtunnel - Cloudflare account +
cloudflaredtunnel - Google Gemini API key
- (
mssis recommended for faster screen capture, installed via requirements)
# Create venv & install deps
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Create .env
echo "GEMINI_API_KEY=your_gemini_key" >> .env
echo "CONTROL_TOKEN=your_secure_token" >> .env
# Start API
python api_win.py # for Windows
# or
python api_linux.py # for Linux (Fedora)
----
Install Cloudflare Tunnel CLI (
cloudflared): Installation Guide โ Cloudflare Docs -
Authenticate with Cloudflare:
cloudflared login- Create a tunnel (replace
<YOUR_TUNNEL_NAME>with a name you choose):
cloudflared tunnel create <YOUR_TUNNEL_NAME>- Configure the tunnel by creating
~/.cloudflared/config.yml:
tunnel: <YOUR_TUNNEL_UUID>
credentials-file: /home/user/.cloudflared/<YOUR_TUNNEL_UUID>.json
# Change hostname to your Cloudflare domain/subdomain
hostname: your-domain.com
service: http://localhost:5000- Run the tunnel:
cloudflared tunnel run <YOUR_TUNNEL_NAME>Once the tunnel is running, your API will be available at:
- Desktop:
https://your-domain.com/desktop/* - Laptop:
https://your-domain.com/laptop/*
- Use strong, unique tokens in
.env - Always access via HTTPS (Cloudflare provides this)
- Keep dependencies updated