A Self-Hosted VPS Manager Dashboard
AlphaPanel is a modern, full-stack Node.js application that provides a comprehensive web-based dashboard for managing AWS EC2 VPS instances. Built with scalability and ease of use in mind, it offers a complete solution for VPS hosting providers and system administrators.
AlphaPanel is a full-stack Node.js application that allows users to manage AWS EC2 VPS instances from a browser-based dashboard. The platform provides:
- User Management: Account creation and authentication system
- Credit-Based Provisioning: Server provisioning using a credit system
- Instance Control: Start, stop, and reboot EC2 instances with real-time status updates
- Admin Panel: Comprehensive administrative tools for logs, users, and payment management
- Theme Support: EJS template-based theming system with TailwindCSS
- Modular Architecture: Clean, maintainable routing and component structure
- Payment Integration: Razorpay integration for credit purchases
- Real-time Updates: Live server status monitoring and updates
- Node.js + Express.js - Server framework
- MySQL - Database for users, servers, and payments
- AWS SDK - EC2 instance management
- Razorpay - Payment processing for credit purchases
- EJS - Server-side templating
- TailwindCSS - Utility-first CSS framework
- Theme System - Customizable UI themes
- NGINX - Reverse proxy and load balancing
- Certbot - SSL certificate management
- PM2 - Process management (recommended)
- Gotty - Optional browser-based SSH access
- Node.js v16 or higher
- MySQL 8.0+
- AWS Account with EC2 access
- Git
git clone https://github.com/yourname/AlphaPanel.git
cd AlphaPanel
npm install
Create a new MySQL database:
CREATE DATABASE alphapanel;
Run the SQL schema:
mysql -u root -p alphapanel < alphapanel.sql
Configure database credentials in db.js
:
module.exports = {
host: "localhost",
user: "root",
password: "yourpassword",
database: "alphapanel"
};
Create a settings.json
file in the project root with the following configuration:
{
"port": 3000,
"theme": "default",
"aws": {
"accessKeyId": "YOUR_AWS_ACCESS_KEY_ID",
"secretAccessKey": "YOUR_AWS_SECRET_ACCESS_KEY",
"region": "ap-south-1"
},
"plans": {
"small": {
"instanceType": "t2.micro",
"price": 5,
"storage": 20,
"ram": "1GB",
"cpu": "1 vCPU"
},
"medium": {
"instanceType": "t2.small",
"price": 10,
"storage": 40,
"ram": "2GB",
"cpu": "1 vCPU"
},
"large": {
"instanceType": "t2.medium",
"price": 20,
"storage": 80,
"ram": "4GB",
"cpu": "2 vCPU"
}
},
"creditPackages": {
"starter": {
"credits": 50,
"price": 5,
"bonus": 0
},
"pro": {
"credits": 100,
"price": 9,
"bonus": 10
},
"enterprise": {
"credits": 250,
"price": 20,
"bonus": 50
}
},
"paymentMethods": {
"razorpay": {
"key_id": "rzp_test_your_key_id",
"key_secret": "your_secret_key"
}
},
"security": {
"sessionSecret": "your-secret-session-key",
"bcryptRounds": 10
},
"features": {
"autoBackup": true,
"sshAccess": true,
"monitoring": true
}
}
npm run dev
# or
node app.js
npm install -g pm2
pm2 start app.js --name "alphapanel"
pm2 startup
pm2 save
The application will be available at: http://localhost:3000
Create an admin user manually in the database:
INSERT INTO users (username, email, password, type, credits, created_at)
VALUES ('admin', 'admin@yourdomain.com', '$2b$10$hashedpassword', 1, 1000, NOW());
Or use the built-in admin creation endpoint (development only):
curl -X POST http://localhost:3000/create-admin \
-H "Content-Type: application/json" \
-d '{"username":"admin","email":"admin@yourdomain.com","password":"securepassword"}'
Admin Panel Features:
- Dashboard overview at
/admin-panel
- User management at
/admin-users
- Payment logs at
/admin-payments
- System monitoring at
/admin-system
- Live configuration at
/admin-config
- System logs at
/admin-logs
sudo apt update && sudo apt install nginx
Create NGINX configuration:
sudo nano /etc/nginx/sites-available/alphapanel
Add the following configuration:
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
# Main proxy
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
proxy_read_timeout 300s;
proxy_connect_timeout 75s;
}
# Static files
location /public {
alias /path/to/AlphaPanel/public;
expires 1y;
add_header Cache-Control "public, immutable";
}
}
Enable the configuration:
sudo ln -s /etc/nginx/sites-available/alphapanel /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
sudo certbot renew --dry-run
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
AlphaPanel/
βββ π routes/ # Express route modules
β βββ auth.js # Authentication routes
β βββ dashboard.js # User dashboard
β βββ admin.js # Admin panel routes
β βββ api.js # API endpoints
β βββ payments.js # Payment processing
βββ π views/ # EJS templates
β βββ π themes/ # Theme directories
β β βββ default/ # Default theme
β β βββ dark/ # Dark theme
β βββ π partials/ # Reusable components
β βββ π layouts/ # Layout templates
βββ π public/ # Static assets
β βββ π css/ # Stylesheets
β βββ π js/ # Client-side JavaScript
β βββ π images/ # Images and icons
βββ π core/ # Core system modules
β βββ logger.js # Logging system
β βββ broadcast.js # Real-time updates
β βββ aws-manager.js # AWS EC2 operations
β βββ auth-middleware.js # Authentication middleware
βββ π config/ # Configuration files
β βββ db.js # Database configuration
β βββ aws.js # AWS SDK configuration
βββ π models/ # Data models
β βββ User.js # User model
β βββ Server.js # Server model
β βββ Payment.js # Payment model
βββ π utils/ # Utility functions
βββ π app.js # Main application file
βββ π settings.json # Application settings
βββ π alphapanel.sql # Database schema
βββ π package.json # Dependencies and scripts
Feature | Endpoint | Description |
---|---|---|
Dashboard | /admin-panel |
System overview and statistics |
User Management | /admin-users |
View, edit, and manage user accounts |
Payment Logs | /admin-payments |
Transaction history and payment analytics |
System Monitor | /admin-system |
Server uptime, performance metrics |
Configuration | /admin-config |
Live edit settings.json |
System Logs | /admin-logs |
View, filter, and download logs |
Server Management | /admin-servers |
Manage all EC2 instances |
- π₯ User Management: Create, suspend, or delete user accounts
- π° Credit Management: Add/remove credits from user accounts
- π Analytics: View system usage and financial reports
- βοΈ System Configuration: Hot-reload application settings
- π§ Maintenance Mode: Enable/disable system-wide maintenance
- π Audit Logs: Track all administrative actions
AlphaPanel includes a comprehensive logging system:
- Logs are stored in the
system_logs
MySQL table - Automatic log rotation and cleanup
- Configurable log levels (ERROR, WARN, INFO, DEBUG)
const { logSystemEvent } = require('./core/logger');
// Log system events
logSystemEvent('INFO', 'Server started successfully');
logSystemEvent('ERROR', 'Database connection failed', { error: err.message });
logSystemEvent('WARN', 'High memory usage detected', { usage: '85%' });
- View Logs:
/admin-logs
- Filter by Level: ERROR, WARN, INFO, DEBUG
- Search: Text-based log searching
- Export: Download logs as CSV/JSON
- Real-time: Live log streaming (WebSocket)
All API endpoints require authentication via session cookies or API tokens.
GET /api/servers # List user servers
POST /api/servers # Create new server
GET /api/servers/:id # Get server details
POST /api/servers/:id/start # Start server
POST /api/servers/:id/stop # Stop server
POST /api/servers/:id/reboot # Reboot server
DELETE /api/servers/:id # Delete server
GET /api/user/profile # Get user profile
PUT /api/user/profile # Update profile
GET /api/user/credits # Get credit balance
POST /api/user/credits # Purchase credits
GET /api/status # System health
GET /api/plans # Available server plans
GET /api/regions # Available AWS regions
- Password Hashing: bcrypt with configurable rounds
- Session Management: Secure session handling
- CSRF Protection: Cross-site request forgery prevention
- Input Validation: Comprehensive input sanitization
- Rate Limiting: API endpoint protection
- Security Headers: XSS, CSRF, and clickjacking protection
- Audit Logging: Complete action tracking
- 2FA Support: Two-factor authentication (optional)
AlphaPanel supports multiple themes:
- Create a new directory in
views/themes/
- Copy the default theme structure
- Customize CSS and EJS templates
- Update
settings.json
to use the new theme
- Default: Clean, professional design
- Dark: Dark mode theme
- Minimal: Simplified interface
- Custom: Your branded theme
# Database backup
mysqldump -u root -p alphapanel > backup_$(date +%Y%m%d_%H%M%S).sql
# Application backup
tar -czf alphapanel_backup_$(date +%Y%m%d_%H%M%S).tar.gz AlphaPanel/
# Restore database
mysql -u root -p alphapanel < backup_20250710_120000.sql
# Restore application
tar -xzf alphapanel_backup_20250710_120000.tar.gz
- Node.js Cluster Mode: Utilize all CPU cores
- Database Connection Pooling: Optimize MySQL connections
- Caching: Redis for session and data caching
- CDN: CloudFlare for static asset delivery
- Monitoring: Prometheus + Grafana for metrics
// ecosystem.config.js
module.exports = {
apps: [{
name: 'alphapanel',
script: 'app.js',
instances: 'max',
exec_mode: 'cluster',
env: {
NODE_ENV: 'production',
PORT: 3000
},
error_file: './logs/err.log',
out_file: './logs/out.log',
log_file: './logs/combined.log',
time: true
}]
};
npm test # Run all tests
npm run test:unit # Unit tests only
npm run test:integration # Integration tests
npm run test:coverage # Coverage report
tests/
βββ unit/ # Unit tests
βββ integration/ # Integration tests
βββ fixtures/ # Test data
βββ helpers/ # Test utilities
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes and test thoroughly
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Submit a Pull Request
- Follow ESLint configuration
- Write tests for new features
- Update documentation
- Use convent
- Documentation: Wiki
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Discord: Join our community
See CHANGELOG.md for a detailed history of changes.
This project is licensed under the MIT License - see the LICENSE file for details.
AlphaPanel Β© 2025 β Developed with β€οΈ by CRI
- AWS SDK team for excellent documentation
- Express.js community for the robust framework
- All contributors who help improve AlphaPanel
β Star this repository if it helped you! β
Report Bug β’ Request Feature β’ Contribute