Skip to content

About

Simple VPSManager

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

VPS Monitoring System

A complete VPS monitoring solution with a Node.js backend API and Flutter mobile dashboard app.

📁 Project Structure

VPSsManager/
├── backend/                 # Node.js API Server
│   ├── server.js           # Express server with /stats endpoint
│   ├── ecosystem.config.js # PM2 deployment config
│   ├── .env.example        # Environment template
│   └── package.json        # Dependencies
│
└── vps_monitor_app/         # Flutter Mobile App
    └── lib/
        ├── main.dart                    # App entry point
        ├── models/server_model.dart     # Data models
        ├── services/api_service.dart    # HTTP client
        ├── providers/stats_provider.dart # State management
        ├── screens/dashboard_screen.dart # Main UI
        └── widgets/stats_card.dart      # Stats widget

🖥️ Backend Installation (On each VPS)

Prerequisites

  • Node.js 16+
  • PM2 (optional, for production)

Setup

  1. Copy the backend folder to your VPS:

    scp -r backend/ user@your-vps-ip:/opt/vps-monitor/
  2. Install dependencies:

    cd /opt/vps-monitor
    npm install
  3. Configure environment:

    cp .env.example .env
    nano .env

    Edit .env:

    PORT=7777
    AUTH_TOKEN=your_secure_random_token
  4. Start the server:

    Development:

    node server.js

    Production (with PM2):

    pm2 start ecosystem.config.js
    pm2 save
    pm2 startup
  5. Open firewall port:

    # Ubuntu/Debian
    sudo ufw allow 7777
    
    # CentOS/RHEL
    sudo firewall-cmd --add-port=7777/tcp --permanent
    sudo firewall-cmd --reload

API Endpoints

Endpoint Method Auth Description
/stats GET Bearer Token System statistics
/health GET None Health check

Example Request:

curl http://your-vps-ip:7777/stats \
  -H "Authorization: Bearer your_token"

Response:

{
  "cpu": { "load": 25.5 },
  "ram": { "total": 8192, "used": 4096, "free": 4096 },
  "disk": { "total": 100, "used": 45, "free": 55 },
  "timestamp": "2024-01-01T00:00:00.000Z"
}

📱 Mobile App Installation

Prerequisites

  • Flutter 3.0+
  • Android Studio / Xcode

Setup

  1. Navigate to the Flutter project:

    cd vps_monitor_app
  2. Get dependencies:

    flutter pub get
  3. Run the app:

    flutter run
  4. Build for release:

    # Android
    flutter build apk --release
    
    # iOS
    flutter build ios --release

Configuration

By default, the app has 2 demo servers configured in lib/providers/stats_provider.dart.

You can:

  • Add servers via the + button in the app
  • Remove servers by swiping left on a server card
  • Modify default servers by editing the StatsProvider constructor

🔒 Security Notes

  1. Never commit .env files - They contain sensitive tokens
  2. Use strong, random tokens - Generate with: openssl rand -hex 32
  3. Use HTTPS in production - Set up SSL/TLS with nginx or similar
  4. Restrict firewall access - Only allow your IP ranges to port 7777

📊 Features

Backend

  • ✅ Real-time CPU, RAM, Disk monitoring
  • ✅ Bearer token authentication
  • ✅ CORS enabled for mobile access
  • ✅ PM2 ready for production

Mobile App

  • ✅ Dark mode UI
  • ✅ Auto-refresh every 5 seconds
  • ✅ Circular gauges for CPU/RAM
  • ✅ Progress bar for disk usage
  • ✅ Online/Offline status indicators
  • ✅ Add/Remove servers dynamically
  • ✅ Swipe to delete servers

About

Simple VPSManager

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages