Edge Developer Platform
  • Pages
    • Product Introduction
    • Quick Start
      • Importing a Git Repository
      • Starting From a Template
      • Direct Upload
    • Framework Guide
    • Project Guide
      • Project Management
      • edgeone.json
      • Configuring Cache
      • Error Codes
    • Build Guide
    • Deployment Guide
      • Overview
      • Create Deploys
      • Manage Deploys
      • Deploy Button
      • Use Github Actions
    • Domain Management
      • Overview
      • Custom Domain Name
      • Configuring an HTTPS Certificate
      • How to Configure a DNS CNAME Record
    • Pages Functions
    • KV Storage
    • Edge AI
    • API Token
    • EdgeOne CLI
    • Pages MCP
    • Integration Guide
      • 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
      • 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
Unlock 1 Year of EdgeOne + 1TB CDN: Join Our Developer Journey
Get Started Now !

Pages KV Integration

Pages KV storage is a powerful distributed Key-Value storage system provided by EdgeOne.


Overview

KV storage can be used for dynamic feature enhancement in static websites, lightweight data storage, serverless application support, and data caching. Compared with traditional databases, it is more suitable for read-heavy and write-light scenarios, serving as a lightweight storage solution.


Getting Started

If it is your first-time use of Pages' KV storage service, we recommend using the template we provide to try it out. The overall operation steps consist of three steps: enabling the KV storage service, associating the Pages project with the KV space, and using the KV storage in the project. The following will introduce the relevant content in detail.


Enabling Pages KV Service

Enter the Pages console, click KV Storage in the header navigation bar, and click Apply now to start enabling.

Complete the following steps to apply for enabling the KV storage service:

1. Fill in the application reason - Please provide a detailed description of the usage scenario and purpose based on your actual business needs.
2. Submit application - After completing the application form, click the Submit button to formally submit for review.
3. Wait for approval - The system will notify related staff to evaluate and handle.

If you have urgent development needs, you can contact the administrator for processing.


4. Create Namespace
Once activated, click the Create Namespace option in the console.
Assign a name with business significance to the namespace
Click Confirm to complete the creation

5. Initialize KV Storage
Navigate to the Data Management section.
Click Create Record to start configuring key-value pair data.
Set key names (Key) and corresponding values (Value) based on business requirements
After completing all required field configurations, submit.

Note: After KV storage initialization is completed, you can perform data read and write operations via API. It is advisable to plan key name naming specifications and data storage structures in advance.


Create a Pages Project and Associate It with KV Storage

Deploying a Pages KV Template

On the Pages Project page in the console, click Create project -> Start from template. In the left sidebar, find Database -> Pages KV, and select.
Pages functions for KV template.

Open the template. On the deployment page, directly click Create. The deployment will take approximately twenty seconds. Before deployment, if there is no association with an online Git, you need to complete Git authorization (supports Github/Gitee).


Bind a Namespace to a Pages Project

After deployment, click KV Storage in the left sidebar, and click Bind Namespace on the page.

In the Bind Namespace window, select the Namespace created in the previously applied and enabled KV service, then fill in the Variable Name. The Variable Name will be used in code to access variables in the Namespace.


Implementing KV Operations in Code

For specific usage, you can check the /functions/visit/index.js in the Pages functions for KV template code. The following is a simple request access example.
// Get the variable
const visitCount = await my_kv.get('visitCount');
let visitCountInt = Number(visitCount);
visitCountInt += 1;

// Modify variable
await my_kv.put('visitCount', visitCountInt.toString());

const res = JSON.stringify({
visitCount: visitCountInt,
});
For more detailed information, you can view the operation document.


Developing Locally

EdgeOne CLI provides developers with a powerful command line interface tool that can significantly improve your development efficiency and code quality. With this tool, you can:

Perform intuitive operations on various edge computing capabilities, simplify the configuration process
Efficiently debug code: Detect and optimize code performance in real time within a local environment
Synchronize online data: Easily import production environment data into the local development environment to ensure reliable testing
Quickly identify and solve performance bottlenecks in edge computing

Whether you are an experienced developer or a beginner exposed to edge computing, EdgeOne CLI can help you build more stable and efficient applications. To learn more about advanced functions and best practices, please visit our operation document.


More Related Content

Learn about EdgeOne CLI usage: EdgeOne CLI Instructions
Learn about KV Storage: KV Storage Operation Instructions
Learn more about Edge Function usage: Edge Function Usage Documentation