Cloudflare Pages Deployment
Cloudflare Pages is the recommended deployment method, offering free hosting, global CDN acceleration, and no server maintenance required.
📂 Step 1: Fork the Project
- Visit CloudFlare ImgBed Project
- Click the "Fork" button in the top right corner
- Select your GitHub account
- Confirm the Fork is complete
🏗️ Step 2: Create Pages Project
2.1 Access Cloudflare Dashboard
- Login to Cloudflare Dashboard
- Select "Workers & Pages" from the left menu
- Click "Create application"
- Select the "Pages" tab
- Click "Connect to Git"
2.2 Connect GitHub Repository
- If using for the first time, authorize Cloudflare to access GitHub
- Select your forked
CloudFlare-ImgBed
repository - Click "Begin setup"
2.3 Configure Project Settings
Configuration | Value | Description |
---|---|---|
Project name | cloudflare-imgbed (or custom) | Project identifier |
Production branch | main | Production environment branch |
Build command | npm install | Important: v2.0 new build command |
Build output directory | / | Keep default |
Important Notice
The build command for v2.0 has changed to npm install
. Please ensure you use the correct build command.
2.4 Deploy Project
- Click "Save and Deploy"
- Wait for the first deployment to complete (about 2-3 minutes)
🗄️ Step 3: Configure KV Database
KV database is used to store file metadata and is a required component.
3.1 Create KV Namespace
- In Cloudflare Dashboard, select "Workers & Pages"
- Click "KV"
- Click "Create namespace"
- Enter namespace name:
img_url
(recommended name) - Click "Add"
3.2 Bind KV to Project
- Return to your Pages project
- Select "Settings" → "Bindings"
- Click "Add" → "KV namespace"
- Fill in binding information:
- Variable name:
img_url
(must be this name) - KV namespace: Select the newly created namespace
- Variable name:
- Click "Save"
Important Notice
The variable name must be img_url
, which is used in the code to access the KV database. Do not change this name.
🔄 Step 4: Redeploy
After binding KV, you need to redeploy for it to take effect:
- Go to the project's "Deployments" page
- Find the latest deployment record
- Click the "..." menu on the right
- Select "Retry deployment"
- Wait for deployment to complete
🚀 Next Steps
At this point, you have completed the deployment of the project on Cloudflare Pages, but you have not yet added storage channels. For adding storage channels and other settings, please refer to Configuration Guide.