Skip to content

rehmatworks/fastcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

31 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FastCP - Modern PHP Hosting Control Panel

⚠️ WORK IN PROGRESS

FastCP is currently under active development. Features may be incomplete or change without notice. Not recommended for production use yet.

πŸ”΄ SECURITY NOTICE: SHARED PHP ENVIRONMENT

Currently, all websites share the same PHP process (FrankenPHP runs as a single user). This means:

  • A PHP script from one site can access files from other sites
  • Do NOT use for untrusted multi-tenant hosting
  • Safe for: Single user, trusted teams, agencies managing their own sites

Per-user PHP isolation is planned for a future release.

FastCP Logo

A modern, minimalist control panel for deploying PHP websites using FrankenPHP

Features β€’ Installation β€’ Usage β€’ API β€’ WHMCS


Features

  • πŸš€ Multiple PHP Versions - Run PHP 8.2, 8.3, 8.4 simultaneously
  • ⚑ Worker Mode - Keep applications in memory for maximum performance
  • πŸ”’ Auto HTTPS - Automatic SSL certificates via Let's Encrypt
  • 🌐 Modern UI - Beautiful, responsive admin interface
  • πŸ”Œ WHMCS Ready - Built-in API for billing integration
  • πŸ“Š Real-time Stats - Monitor PHP instances and sites
  • πŸ”§ Easy Deployment - WordPress, Laravel, Symfony ready

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    FastCP Control Panel                      β”‚
β”‚                   (Go + React Frontend)                      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                              β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚   β”‚                  Caddy Reverse Proxy                  β”‚  β”‚
β”‚   β”‚                   :80 / :443                          β”‚  β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                              β”‚                               β”‚
β”‚     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
β”‚     β–Ό                        β–Ό                        β–Ό     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚FrankenPHP  β”‚       β”‚FrankenPHP  β”‚       β”‚FrankenPHP  β”‚  β”‚
β”‚  β”‚PHP 8.2     β”‚       β”‚PHP 8.3     β”‚       β”‚PHP 8.4     β”‚  β”‚
β”‚  β”‚:9082       β”‚       β”‚:9083       β”‚       β”‚:9084       β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Installation

One-Line Install (Recommended)

curl -fsSL https://fastcp.org/install.sh | bash

This will:

  1. Download the latest FastCP binary for your platform
  2. Create necessary directories
  3. Set up systemd service (Linux)

Manual Download

# Linux x86_64 (Ubuntu, Debian, CentOS, etc.)
curl -L https://github.com/rehmatworks/fastcp/releases/latest/download/fastcp-linux-x86_64 -o /usr/local/bin/fastcp
chmod +x /usr/local/bin/fastcp

# Linux ARM64 (AWS Graviton, Oracle Ampere, etc.)
curl -L https://github.com/rehmatworks/fastcp/releases/latest/download/fastcp-linux-aarch64 -o /usr/local/bin/fastcp
chmod +x /usr/local/bin/fastcp

Run FastCP

# Run directly
fastcp

# Or with systemd (Linux)
sudo systemctl start fastcp
sudo systemctl enable fastcp

Note: FrankenPHP will be auto-downloaded on first run (~64MB).

Development Setup

# Requirements: Go 1.23+, Node.js 20+

# Clone the repository
git clone https://github.com/rehmatworks/fastcp.git
cd fastcp

# Install dependencies
make install-deps

# Run in development mode
make dev

Development mode (FASTCP_DEV=1) uses local directories:

  • Config: ./.fastcp/config.json
  • Data: ./.fastcp/data/
  • Sites: ./.fastcp/sites/
  • Logs: ./.fastcp/logs/
  • Binary: ./.fastcp/bin/frankenphp
  • Ports: 8000 (HTTP), 8443 (HTTPS)

Environment Variables

Variable Description Default (Dev) Default (Prod)
FASTCP_DEV Enable dev mode - -
FASTCP_DATA_DIR Data directory ./.fastcp/data /var/lib/fastcp
FASTCP_SITES_DIR Sites directory ./.fastcp/sites /var/www
FASTCP_LOG_DIR Log directory ./.fastcp/logs /var/log/fastcp
FASTCP_CONFIG_DIR Config directory ./.fastcp /etc/fastcp
FASTCP_BINARY FrankenPHP path ./.fastcp/bin/frankenphp /usr/local/bin/frankenphp
FASTCP_PORT Proxy HTTP port 8000 80
FASTCP_SSL_PORT Proxy HTTPS port 8443 443
FASTCP_LISTEN Admin panel address :8080 :8080

Usage

  1. Open https://localhost:8080 in your browser
  2. Login with default credentials:
    • Username: admin
    • Password: fastcp2024!
  3. Create your first site!

Configuration

Configuration file: /etc/fastcp/config.json

{
  "admin_user": "admin",
  "admin_password": "fastcp2024!",
  "jwt_secret": "change-this-in-production",
  "data_dir": "/var/lib/fastcp",
  "sites_dir": "/var/www",
  "log_dir": "/var/log/fastcp",
  "listen_addr": ":8080",
  "php_versions": [
    {
      "version": "8.4",
      "port": 9084,
      "admin_port": 2084,
      "binary_path": "/usr/local/bin/frankenphp-8.4",
      "enabled": true
    }
  ]
}

API

Authentication

# Login
curl -X POST https://localhost:8080/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"username": "admin", "password": "fastcp2024!"}'

# Use token in subsequent requests
curl https://localhost:8080/api/v1/sites \
  -H "Authorization: Bearer YOUR_TOKEN"

Sites

# List sites
GET /api/v1/sites

# Create site
POST /api/v1/sites
{
  "name": "My Site",
  "domain": "example.com",
  "php_version": "8.4",
  "worker_mode": true
}

# Get site
GET /api/v1/sites/{id}

# Update site
PUT /api/v1/sites/{id}

# Delete site
DELETE /api/v1/sites/{id}

PHP Instances

# List instances
GET /api/v1/php

# Start instance
POST /api/v1/php/{version}/start

# Stop instance
POST /api/v1/php/{version}/stop

# Restart instance
POST /api/v1/php/{version}/restart

# Restart workers
POST /api/v1/php/{version}/restart-workers

WHMCS Integration

FastCP includes built-in WHMCS integration for automated provisioning.

Endpoints

# Provision (create/suspend/unsuspend/terminate)
POST /api/v1/whmcs/provision
X-API-Key: your-api-key

{
  "action": "create",
  "service_id": "12345",
  "username": "customer",
  "domain": "customer-site.com",
  "php_version": "8.4"
}

# Check status
GET /api/v1/whmcs/status/{service_id}?domain=example.com
X-API-Key: your-api-key

Actions

  • create - Create new site
  • suspend - Suspend site
  • unsuspend - Reactivate site
  • terminate - Delete site

Directory Structure

fastcp/
β”œβ”€β”€ cmd/fastcp/          # Main entry point
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ api/             # REST API handlers
β”‚   β”œβ”€β”€ auth/            # Authentication
β”‚   β”œβ”€β”€ caddy/           # Caddyfile generation
β”‚   β”œβ”€β”€ config/          # Configuration
β”‚   β”œβ”€β”€ middleware/      # HTTP middleware
β”‚   β”œβ”€β”€ models/          # Data models
β”‚   β”œβ”€β”€ php/             # PHP instance management
β”‚   └── sites/           # Site management
β”œβ”€β”€ web/                 # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   └── lib/
β”‚   └── package.json
β”œβ”€β”€ data/                # Runtime data
β”œβ”€β”€ templates/           # Caddyfile templates
β”œβ”€β”€ go.mod
└── Makefile

Roadmap

  • Unix user authentication
  • File manager
  • SSL certificate management
  • Backup & restore
  • Email integration
  • Database management (MySQL/PostgreSQL)
  • DNS management
  • Let's Encrypt wildcard support

License

MIT License - see LICENSE for details.

Credits

  • FrankenPHP - The amazing PHP application server
  • Caddy - The web server that powers FrankenPHP
  • Go-Chi - Lightweight router for Go