• Product Introduction
  • Quick Start
    • Importing a Git Repository
    • Starting From a Template
    • Direct Upload
  • Framework Guide
    • Frontends
    • Backends
    • Full-stack
      • Next.js
  • Project Guide
    • Project Management
    • edgeone.json
    • Configuring Cache
    • Error Codes
  • Build Guide
  • Deployment Guide
    • Overview
    • Create Deploys
    • Manage Deploys
    • Deploy Button
    • Use Github Actions
    • Using CNB Plugin
    • Using IDE Plug-In
    • Using CodeBuddy IDE
  • Domain Management
    • Overview
    • Custom Domain
    • Configuring an HTTPS Certificate
    • How to Configure a DNS CNAME Record
  • Pages Functions
    • Overview
    • Edge Functions
    • Node Functions
  • Log Analysis
  • KV Storage
  • Edge AI
  • API Token
  • EdgeOne CLI
  • Pages MCP
  • Integration Guide
    • AI
      • Dialogue Large Models Integration
      • Large Models for Images Integration
    • Database
      • Supabase Integration
      • Pages KV Integration
    • Ecommerce
      • Shopify Integration
      • WooCommerce Integration
    • Payment
      • Stripe Integration
      • Integrating Paddle
    • CMS
      • WordPress Integration
      • Contentful Integration
      • Sanity Integration
    • Authentication
      • Supabase Integration
      • Clerk Integration
  • Best Practices
    • Using General Large Model to Quickly Build AI Application
    • Use the Deepseek-R1 model to quickly build a conversational AI site
    • Building an Ecommerce Platform with WordPress + WooCommerce and GatsbyJS
    • Building a SaaS Site Using Supabase and Stripe
    • Building a Company Brand Site Quickly
    • How to Quickly Build a Blog Site
  • Migration Guides
    • Migrating from Vercel to EdgeOne Pages
    • Migrating from Cloudflare Pages to EdgeOne Pages
    • Migrating from Netlify to EdgeOne Pages
  • Troubleshooting
  • FAQs
  • Contact Us
  • Release Notes

EdgeOne CLI

Overview

The Edgeone CLI provides methods to manage Pages Functions and enables fast deployment. With the aid of the CLI, you can generate, configure, and debug functions in a project. It also allows uploading the build product as a folder or Zip package to the Pages platform.


Preparations

Use a Gmail account to quickly log in to the Tencent Cloud console.
Enable the Pages Service via console activation, create a new Pages Project, and clone it to local.


Quick Start

1. Installing

During the preparation stage, install the CLI through npm in the cloned project.
npm install -g edgeone
Use the edgeone -v command to check whether installed successfully. Use the edgeone -h command to view all commands.


2. Logging In

Execute the login command, select Global (International) or China as prompted. It is recommended to select Global to ensure accurate data and information are obtained, and then complete the login in the pop-up browser window.
edgeone login
After completing login, you can execute edgeone whoami to view the info of the current logged-in account.


3. Initializing

After successful login, execute the initialization command to initialize the basic environment for Edgeone Pages in the project.
edgeone pages init
During initialization, based on the instructions and your needs, the edge-functions or node-functions folder and sample functions will be generated under the project root directory. Subsequently, you can continuously add new and develop functions under this folder. For detailed usage of functions, see the documentation.


Local Development

After initialization, enter the local development stage:
edgeone pages dev
Note:
The CLI dev service automatically reads the devCommand parameter configured in edgeone.json to start the dev service. If there is no such configuration item, it reads the dev command in the project's package.json to start.
Edge Functions debug service has a limit on the number of startups, so try to avoid frequently logging out and starting the dev service (hot update in the dev service will not increase the startup count).
The execution command will by default create a service locally on port 8088. Both the Pages Function service and the Pages project service run on the same port, with no need to use a proxy server for request forwarding to the correct port.

This way you can access the front-end page through http://localhost:8088/, then directly use the Fetch API in the front-end project. Here, the access path is exactly the address path of the function files in the edge-functions/node-functions folder.
// ./node-functions/api/my-functions.js
fetch('/api/my-functions', {
method: 'POST',
body: JSON.stringify({ data: 'example' }),
})


5. Associate Project

If you need to use the KV storage capacity or synchronize environment variables set in the console to local debugging, you can execute the associate project command and enter the project name as required. Here, the project name is the created Pages project name from the preparation work.
edgeone pages link
If you need to link a project that does not exist, you can also create a new project directly under the CLI guide.


6. Submit Deployment

After local development and debugging, push the project code to the Git remote to trigger the Pages backend CI build and deployment, completing the entire development process.


7. Local Deployment

If your project is created via "direct upload", you can also deploy it directly to the Pages platform locally by executing the following command.
edgeone pages deploy [<directoryOrZip>] [-n <projectName>] [-e <env>]
Parameter Description
<directoryOrZip>: Folder or ZIP package path to deploy
-n, --name: Project name to deploy. If the project does not exist, a new project will be created automatically.
-e, --env: Deployment target environment. Available values: production or preview (default production)
Note:
By default, when executing deploy, the CLI will automatically build and package frontend code, node-functions, and edge-functions function code into the .edgeone folder and deploy to Pages.
If you choose to manually build the project, you need to manually copy the related folders of Pages Functions and the project's package.json file to dist (suppose the output directory is dist), then rerun edgeone pages deploy ./dist.

Local Deployment Example
# Production environment deployment
edgeone pages deploy

# Preview environment deployment
edgeone pages deploy -e preview


8. Switching Accounts

If you need to switch to another Tencent Cloud account, execute the following commands and log in again:
edgeone switch


CI/CD Pipeline Integration

Alternatively, you can integrate EdgeOne CLI into the CI/CD pipeline to realize automatic deployment.
Note:
EdgeOne CLI installation method can be found in the "Quick Start - Install" section.


CI Pipeline Deployment Command

deploy command support is independent of Git, deploying folders or ZIP packages directly to EdgeOne Pages via CI/CD pipeline.
edgeone pages deploy [<directoryOrZip>] -n <projectName> -t <token> [-e <env>]
Parameter Description
<directoryOrZip>: Folder or ZIP package path to deploy
-n, --name: project name to be deployed; if the project does not exist, a new project will be created automatically (required)
-t, --token: API Token for CI/CD pipeline (required)
-e, --env: target environment for deployment, value range: production or preview (default production)
Note:
By default, when executing deploy, the CLI will automatically build and package the frontend code, node-functions, and edge-functions code into the .edgeone folder and deploy to Pages.
If you choose to manually build the project, you need to manually copy the Pages Functions related folders and the project's package.json file to dist (suppose the output directory is dist), then rerun edgeone pages deploy ./dist


CI Pipeline Example

# Production environment deployment
edgeone pages deploy -n project-name -t $EDGEONE_API_TOKEN

# Preview environment deployment
edgeone pages deploy -n project-name -e preview -t $EDGEONE_API_TOKEN


API Token Method for Obtaining

Before using the deployment command in the CI/CD pipeline, generate an API Token in the EdgeOne Pages console. For details, see API Token.