A modern web dashboard for managing Cloudflare accounts, tunnels, and zones through an intuitive interface. Built with Go and featuring a responsive web UI for streamlined Cloudflare infrastructure management.
- 🔐 Secure Authentication - Admin login with session management
- 🌐 Multi-Account Management - Manage multiple Cloudflare accounts from one dashboard
- 🚇 Tunnel Management - Create, configure, and monitor Cloudflare Tunnels
- 📍 Zone Management - DNS zone configuration and management
- 🔗 Public Hostname Configuration - Easy setup of tunnel public hostnames
- 📊 Real-time Dashboard - Monitor your Cloudflare infrastructure at a glance
- 🎨 Modern UI - Beautiful, responsive web interface built with Corona Bootstrap admin template
cfProxyHub/
├── cmd/server/ # Application entry point
├── internal/
│ ├── config/ # Configuration management
│ ├── handlers/ # HTTP request handlers
│ ├── middleware/ # Authentication middleware
│ ├── models/ # Data models
│ ├── routes/ # Route definitions
│ └── services/ # Business logic
├── pkg/utils/ # Utility functions
├── web/ # Frontend assets and templates
│ ├── assets/ # CSS, JS, images
│ └── templates/ # HTML templates
└── tests/ # Test files
- Go 1.24+ installed
- Cloudflare account with API access
- API Token or API Key + Email
-
Clone the repository
git clone https://github.com/yourusername/cfProxyHub.git cd cfProxyHub
-
Install dependencies
go mod download
-
Configure environment variables
Create a
.env
file in the project root:# Cloudflare Credentials (choose one method) CLOUDFLARE_API_TOKEN=your_api_token_here # OR CLOUDFLARE_API_KEY=your_api_key_here CLOUDFLARE_EMAIL=your_cloudflare_email@example.com # Server Configuration PORT=8080 # Admin Authentication ADMIN_USERNAME=admin ADMIN_PASSWORD=your_secure_password
-
Run the application
go run cmd/server/main.go
-
Access the dashboard
Open your browser and navigate to:
http://localhost:8080
Variable | Description | Required | Default |
---|---|---|---|
CLOUDFLARE_API_TOKEN |
Cloudflare API Token | Yes* | - |
CLOUDFLARE_API_KEY |
Cloudflare API Key | Yes* | - |
CLOUDFLARE_EMAIL |
Cloudflare account email | Yes* | - |
PORT |
Server port | No | 8080 |
ADMIN_USERNAME |
Admin username | No | admin |
ADMIN_PASSWORD |
Admin password | No | password123 |
*Either CLOUDFLARE_API_TOKEN
OR both CLOUDFLARE_API_KEY
and CLOUDFLARE_EMAIL
are required.
- Go to Cloudflare API Tokens
- Click "Create Token"
- Use the "Custom token" template
- Set permissions:
- Zone:Zone:Read
- Zone:DNS:Edit
- Account:Cloudflare Tunnel:Edit
- Go to Cloudflare API Keys
- Copy your Global API Key
- Use your Cloudflare email address
POST /api/auth/login
- Admin loginPOST /api/auth/logout
- Admin logout
GET /api/cloudflare/accounts
- List all accountsGET /api/cloudflare/accounts/:id/tunnels
- Get tunnels for accountPOST /api/cloudflare/accounts/:id/tunnels
- Create new tunnelGET /api/cloudflare/accounts/:id/zones
- Get zones for accountPOST /api/cloudflare/tunnels/:id/hostnames
- Create public hostname
GET /
- Dashboard (requires authentication)GET /login
- Login pageGET /tunnels
- Tunnel management pageGET /accounts
- Account management page
Run the test suite:
go test ./...
Run specific tests:
go test ./tests/
cmd/server/
- Application entry point and main functioninternal/
- Private application codeconfig/
- Configuration loading and validationhandlers/
- HTTP request handlers for different endpointsmiddleware/
- Authentication and other middlewaremodels/
- Data structures and modelsroutes/
- Route definitions and setupservices/
- Business logic and Cloudflare API integration
pkg/
- Public utilities and helpersweb/
- Frontend assets (CSS, JS, images, templates)tests/
- Test files
# Build binary
go build -o cfproxyhub cmd/server/main.go
# Run binary
./cfproxyhub
FROM golang:1.24-alpine AS builder
WORKDIR /app
COPY . .
RUN go mod download
RUN go build -o cfproxyhub cmd/server/main.go
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /app/cfproxyhub .
COPY --from=builder /app/web ./web
EXPOSE 8080
CMD ["./cfproxyhub"]
- Always use strong passwords for admin authentication
- Use API tokens with minimal required permissions
- Run behind a reverse proxy (nginx, Cloudflare) in production
- Keep your Cloudflare credentials secure
- Regularly rotate API tokens
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Cloudflare Go SDK for Cloudflare API integration
- Gin Web Framework for HTTP routing
- godotenv for environment variable management
- Corona Admin Dashboard by ThemeWagon for the beautiful web interface template
If you have any questions or need help, please:
- Check the Issues for existing solutions
- Create a new issue if your problem isn't covered
- Provide detailed information about your setup and the issue
Made with ❤️ for simplified Cloudflare management