Skip to content

Latest commit

 

History

History
573 lines (507 loc) · 22.8 KB

File metadata and controls

573 lines (507 loc) · 22.8 KB

EdgeOne Pages Ecosystem — Relational Knowledge Graph (as of Mar 30, 2026)

This document is the master reference for understanding the entire EdgeOne Pages ecosystem. It maps every product, runtime, CLI command, API, and service — how they relate, when to use each, and which bundled skills provide deeper guidance.


Legend

  • [PRODUCT] — An EdgeOne Pages product or capability
  • → depends on — Runtime or build-time dependency
  • ↔ integrates with — Bidirectional integration
  • ⇢ alternative to — Can substitute for
  • ⊃ contains — Parent/child relationship
  • ⤳ skill: — Link to a bundled skill for detailed guidance
  • 📖 docs: — Link to official documentation

1. Core Platform

EDGEONE PAGES                              📖 docs: https://edgeone.ai/products/pages
├── Deployment Engine (CI/CD, Preview URLs, Production)
│   → Git Provider (GitHub, GitLab, Gitee)
│   → Build System (auto-detect framework, custom build commands)
│   ↔ EdgeOne CLI (`edgeone pages deploy`)
│   ⤳ skill: edgeone-cli
│   ⤳ skill: edgeone-pages-deploy
│
├── Edge Network (Tencent Global CDN, 2800+ PoPs)
│   ⊃ Edge Functions (V8 isolates, Web Standard APIs)
│   ⊃ Cloud Functions — Node.js (Node.js v20+, full npm)
│   ⊃ Cloud Functions — Go (Go 1.26+, Go modules)
│   ⊃ Cloud Functions — Python (Python 3.10, pip)
│   ⊃ Middleware (request interception at edge)
│   ⊃ KV Storage (global key-value, edge-accessible)
│   ⤳ skill: edge-functions
│   ⤳ skill: node-functions
│   ⤳ skill: go-functions
│   ⤳ skill: python-functions
│   ⤳ skill: middleware
│   ⤳ skill: kv-storage
│
├── Hosting (Static & Full-Stack)
│   ⊃ Static site hosting (HTML/CSS/JS)
│   ⊃ SPA hosting (React, Vue, Angular, Svelte)
│   ⊃ SSR hosting (Next.js, Nuxt, SvelteKit, Astro)
│   ⊃ Custom build output directory
│   → Deployment Engine
│   ⤳ skill: frameworks
│
├── Custom Domains & SSL
│   ⊃ Automatic HTTPS (free SSL certificates)
│   ⊃ Custom domain binding
│   ⊃ DNS configuration
│   → Edge Network (CDN-accelerated)
│
├── Preview Deployments
│   ⊃ Per-commit preview URLs
│   ⊃ Auth-protected preview links (query parameter auth)
│   → Git Provider (auto-trigger on push)
│   → Deployment Engine
│
├── Environment Variables                        ⤳ skill: env-vars
│   ⊃ Console-managed key-value pairs
│   ⊃ `edgeone pages env pull` (sync to local .env)
│   ⊃ Available in Edge Functions via `context.env`
│   ⊃ Available in Cloud Functions (Node.js: `context.env`, Go: `os.Getenv`, Python: `os.environ`)
│   ↔ EdgeOne CLI
│
├── Console Management
│   ⊃ China site: https://console.cloud.tencent.com/edgeone/pages
│   ⊃ Global site: https://console.intl.cloud.tencent.com/edgeone/pages
│   ⊃ Project settings, deployment history, logs
│   ⊃ KV namespace management (enable per project)
│   ⊃ API token management
│
└── Project Configuration (edgeone.json)
    ⊃ Project linking (`edgeone pages link`)
    ⊃ Build settings (framework, build command, output dir)
    ⊃ Function routing configuration
    ↔ EdgeOne CLI

2. Frameworks (Auto-Detected)

SUPPORTED FRAMEWORKS                       ⤳ skill: frameworks
├── Next.js (v13–16)                       📖 docs: https://nextjs.org/docs
│   ⊃ App Router / Pages Router
│   ⊃ SSR, SSG, ISR support on EdgeOne Pages
│   ⊃ API Routes → auto-deployed as Cloud Functions
│   ↔ EdgeOne Pages Deployment Engine
│
├── Vue / Nuxt                             📖 docs: https://nuxt.com/docs
│   ⊃ Nuxt 3 SSR/SSG/ISR
│   ⊃ Vue 3 SPA
│   ↔ EdgeOne Pages Deployment Engine
│
├── React (Vite / CRA)
│   ⊃ SPA mode (Vite preferred)
│   ⊃ Client-side routing (SPA fallback)
│   ↔ EdgeOne Pages Static Hosting
│
├── Astro                                  📖 docs: https://docs.astro.build
│   ⊃ Static / SSR / Hybrid rendering
│   ↔ EdgeOne Pages Deployment Engine
│
├── SvelteKit                              📖 docs: https://kit.svelte.dev/docs
│   ⊃ SSR / SSG / SPA
│   ↔ EdgeOne Pages Deployment Engine
│
├── Remix                                  📖 docs: https://remix.run/docs
│   ⊃ SSR with loaders and actions
│   ↔ EdgeOne Pages Deployment Engine
│
├── Angular                                📖 docs: https://angular.io/docs
│   ⊃ SPA / SSR (Angular Universal)
│   ↔ EdgeOne Pages Deployment Engine
│
├── Solid / Gatsby / Hugo / Jekyll / Hexo
│   ⊃ Static output frameworks
│   ↔ EdgeOne Pages Static Hosting
│
└── Static HTML/CSS/JS
    → Direct deploy (no build step)

3. Edge Functions

EDGE FUNCTIONS (V8 Isolates)               ⤳ skill: edge-functions  📖 docs: https://edgeone.ai/document/162227
├── Runtime
│   ⊃ V8 engine (same as Cloudflare Workers)
│   ⊃ Web Standard APIs (fetch, Request, Response, Headers, URL, crypto)
│   ⊃ NOT Node.js — no `fs`, `path`, `http`, `process`, npm packages
│   ⊃ Max 5 MB code size, 1 MB request body, 200 ms CPU time
│
├── File-Based Routing (`functions/` directory)
│   ⊃ `functions/api/hello.js` → `GET /api/hello`
│   ⊃ `functions/api/users/[id].js` → `GET /api/users/:id`
│   ⊃ Dynamic params: `[param]`, catch-all: `[...path]`
│   ⊃ Handler export: `export function onRequest(context) { ... }`
│
├── Context Object
│   ⊃ `context.request` — incoming Request object
│   ⊃ `context.params` — dynamic route parameters
│   ⊃ `context.env` — environment variables
│   ⊃ `context.next()` — call next handler in chain
│
├── KV Storage Integration                  ⤳ skill: kv-storage
│   ⊃ Global variable injected at runtime (e.g., `const kv = MY_KV_NAMESPACE`)
│   ⊃ Must be enabled per project in console first
│   ⊃ get / put / delete / list operations
│   ⊃ Eventual consistency across edge nodes
│
└── Use When
    ⊃ Lightweight APIs (JSON responses, redirects, rewrites)
    ⊃ Edge-side data transformation
    ⊃ KV-backed counters, feature flags, A/B routing
    ⊃ Auth token validation at the edge

4. Cloud Functions

CLOUD FUNCTIONS                             📖 docs: https://edgeone.ai/document/162227
├── Node.js Runtime                         ⤳ skill: node-functions
│   ⊃ Node.js v20.x, full npm ecosystem
│   ⊃ 128 MB max code size, 6 MB request body, 120s wall clock
│   ⊃ Directory: `cloud-functions/` (each subfolder = route)
│   ⊃ Handler mode: `export function onRequest(context) → Response`
│   ⊃ Framework mode: Express/Koa via `[[default]].js` catch-all
│   ⊃ WebSocket support (Node.js only)
│   ⊃ Full database access (MySQL, PostgreSQL, MongoDB, Redis)
│
├── Go Runtime                              ⤳ skill: go-functions
│   ⊃ Go 1.26+, Go modules support
│   ⊃ 128 MB max code size, 6 MB request body, 120s wall clock
│   ⊃ Handler mode: `func Handler(w http.ResponseWriter, r *http.Request)`
│   ⊃ Framework mode: Gin / Echo / Chi / Fiber (auto port & path adaptation)
│   ⊃ Entry file: `*.go` in `cloud-functions/<route>/`
│   ⊃ Dependencies: `go.mod` (auto-managed)
│
├── Python Runtime                          ⤳ skill: python-functions
│   ⊃ Python 3.10, pip packages
│   ⊃ 128 MB max code size (incl. deps), 6 MB request body, 120s wall clock
│   ⊃ Handler mode: `class handler(BaseHTTPRequestHandler)`
│   ⊃ Framework mode: Flask / FastAPI / Django / Sanic
│   ⊃ Dependencies: `requirements.txt` (auto-detected & installed)
│   ⊃ Entry detection: by class/app pattern in `.py` files
│
├── Shared Properties
│   ⊃ File-based routing (directory name = URL path)
│   ⊃ Environment variables accessible
│   ⊃ Automatic dependency installation on deploy
│   ⊃ Cold start possible on first invocation
│
└── Use When
    ⊃ Complex business logic requiring npm/Go/Python packages
    ⊃ Database operations (CRUD, ORM)
    ⊃ WebSocket real-time features (Node.js only)
    ⊃ Existing Express/Koa/Gin/Flask/FastAPI migration
    ⊃ ML inference, data processing (Python)

5. Middleware

MIDDLEWARE (Edge Request Interception)      ⤳ skill: middleware
├── Location
│   ⊃ `middleware.js` or `_worker.js` at project root
│   ⊃ Runs at the edge before any other handler
│   ⊃ V8 runtime (same restrictions as Edge Functions)
│
├── Capabilities
│   ⊃ Request interception and modification
│   ⊃ URL redirects and rewrites
│   ⊃ Auth guards (token validation, session checks)
│   ⊃ A/B testing (cookie-based routing)
│   ⊃ CORS header injection
│   ⊃ Geographic routing
│   ⊃ Response header modification
│
├── Handler Signature
│   ⊃ `export default { async fetch(request, env, ctx) { ... } }`
│   ⊃ Return `new Response(...)` to intercept
│   ⊃ Return `fetch(request)` to pass through
│
├── ⚠️ NOT for Framework Projects
│   ⊃ Next.js → use `middleware.ts` (Next.js native)
│   ⊃ Nuxt → use `server/middleware/` (Nuxt native)
│   ⊃ Platform middleware overrides framework middleware
│
└── Use When
    ⊃ Cross-cutting concerns (auth, logging, headers)
    ⊃ URL-level routing logic
    ⊃ Request filtering and rate limiting
    ⊃ NOT for heavy computation or database calls

6. KV Storage

KV STORAGE (Edge Key-Value)                 ⤳ skill: kv-storage  📖 docs: https://edgeone.ai/document/162227
├── Properties
│   ⊃ Global key-value store accessible from Edge Functions
│   ⊃ Eventual consistency across edge nodes
│   ⊃ Must be enabled per project in EdgeOne console
│   ⊃ Linked via `edgeone pages link`
│
├── API
│   ⊃ `await kv.get(key)` — read value
│   ⊃ `await kv.put(key, value)` — write value
│   ⊃ `await kv.delete(key)` — delete key
│   ⊃ `await kv.list()` — list all keys
│   ⊃ Optional: expiration, metadata
│
├── Setup
│   ⊃ 1. Enable KV in console for project
│   ⊃ 2. `edgeone pages link` to bind locally
│   ⊃ 3. Access via global variable in Edge Functions
│   ⊃ 4. Use `edgeone pages dev` for local dev (simulated KV)
│
└── Use When
    ⊃ Page view counters, rate limiting
    ⊃ Feature flags, A/B test configurations
    ⊃ Session/token storage at edge
    ⊃ Caching API responses

7. CLI & Development

EDGEONE CLI (edgeone)                       ⤳ skill: edgeone-cli  📖 docs: https://edgeone.ai/document/162227
├── Installation
│   ⊃ `npm install -g edgeone@latest`
│   ⊃ Minimum version: 1.2.30
│   ⊃ Verify: `edgeone -v`
│
├── Authentication
│   ⊃ Browser login: `edgeone login --site china|global`
│   ⊃ Token login: `-t <token>` flag on deploy commands
│   ⊃ Check status: `edgeone whoami`
│   ⊃ Token management: save to `.edgeone/.token` for reuse
│
├── Pages Commands
│   ⊃ `edgeone pages deploy` — deploy to production
│   ⊃ `edgeone pages deploy -e preview` — deploy to preview
│   ⊃ `edgeone pages deploy -n <name>` — create new project
│   ⊃ `edgeone pages dev` — local development server (port 8088)
│   ⊃ `edgeone pages init` — scaffold new project
│   ⊃ `edgeone pages link` — link to existing project
│   ⊃ `edgeone pages env pull` — sync env vars from console
│
├── Local Development
│   ⊃ `edgeone pages dev` serves everything on http://localhost:8088/
│   ⊃ Static files + Edge Functions + Cloud Functions + Middleware
│   ⊃ Hot reload for functions
│   ⊃ KV Storage simulation in dev mode
│   ⊃ ⚠️ Never set `edgeone pages dev` as `devCommand` or `npm run dev` — causes recursion
│
└── Deploy Output
    ⊃ `EDGEONE_DEPLOY_URL=<url>` — full access URL (⚠️ include query params!)
    ⊃ `EDGEONE_PROJECT_ID=pages-xxx` — project identifier
    ⊃ Console link for deployment details

DEPLOYMENT WORKFLOW                         ⤳ skill: edgeone-pages-deploy
├── Flow
│   ⊃ 1. Check CLI installed (≥ 1.2.30)
│   ⊃ 2. Check login status (`edgeone whoami`)
│   ⊃ 3. Check project linked (`edgeone.json`)
│   ⊃ 4. Deploy (`edgeone pages deploy`)
│   ⊃ 5. Parse output (⚠️ full URL with query params)
│
├── Site Selection
│   ⊃ China — console.cloud.tencent.com
│   ⊃ Global — console.intl.cloud.tencent.com
│   ⊃ ⚠️ Always ask user before first login
│
└── Auth Methods
    ⊃ Desktop IDE → Browser login (preferred)
    ⊃ Remote/SSH/CI → Token login (-t flag)
    ⊃ Saved token → `.edgeone/.token` (auto-used)

8. Development Workflow

LOCAL DEV WORKFLOW                          ⤳ skill: edgeone-pages-dev
├── Standard Flow
│   ⊃ 1. `edgeone pages init` (new project) or `git clone` (existing)
│   ⊃ 2. `npm install` (install dependencies)
│   ⊃ 3. `edgeone pages link` (bind to console project — required for KV & env vars)
│   ⊃ 4. `edgeone pages env pull` (sync env vars to local .env)
│   ⊃ 5. `edgeone pages dev` (local dev on :8088)
│   ⊃ 6. `edgeone pages deploy` (push to production)
│
├── Project Structure
│   ⊃ `functions/` — Edge Functions (V8 runtime)
│   ⊃ `cloud-functions/` — Cloud Functions (Node.js / Go / Python)
│   ⊃ `middleware.js` or `_worker.js` — Platform middleware
│   ⊃ `edgeone.json` — Project configuration
│   ⊃ `.env.local` / `.env` — Local environment variables
│   ⊃ `public/` or framework output — Static assets
│
├── File-Based Routing Rules
│   ⊃ Edge: `functions/api/hello.js` → `/api/hello`
│   ⊃ Cloud: `cloud-functions/api/hello/index.js` → `/api/hello`
│   ⊃ Dynamic: `[param]` → `:param`, `[...path]` → wildcard
│   ⊃ `[[default]].js` → catch-all (framework mode)
│
└── Key Conventions
    ⊃ Edge Functions: export `onRequest(context)` → `Response`
    ⊃ Cloud Functions (Node.js): export `onRequest(context)` → `Response`
    ⊃ Cloud Functions (Go): `func Handler(w, r)` or framework `main()`
    ⊃ Cloud Functions (Python): `class handler(BaseHTTPRequestHandler)` or app instance
    ⊃ Middleware: `export default { async fetch(request, env, ctx) { ... } }`

9. Bootstrap & Project Setup

BOOTSTRAP                                   ⤳ skill: bootstrap
├── New Project Scaffolding
│   ⊃ `edgeone pages init` — interactive project creation
│   ⊃ Framework auto-detection from existing code
│   ⊃ Template selection (static, React, Vue, Next.js, etc.)
│
├── Existing Project Migration
│   ⊃ Add `edgeone.json` configuration
│   ⊃ Move functions to `functions/` or `cloud-functions/`
│   ⊃ Convert existing middleware to EdgeOne format
│
├── Setup Checklist
│   ⊃ 1. Install CLI: `npm i -g edgeone@latest`
│   ⊃ 2. Login: `edgeone login --site china|global`
│   ⊃ 3. Init or link project
│   ⊃ 4. Configure env vars (if needed)
│   ⊃ 5. Start dev: `edgeone pages dev`
│
└── CI/CD Integration
    ⊃ Token-based auth: `edgeone pages deploy -t $EDGEONE_TOKEN`
    ⊃ GitHub Actions / GitLab CI compatible
    ⊃ No interactive login needed in CI

10. Decision Matrix — When to Use What

Runtime Selection

Need Use Why
Lightweight API, no npm, ultra-low latency Edge Functions V8 isolates, <1ms cold start, global edge
Complex API with npm packages, database Cloud Functions (Node.js) Full Node.js v20, 120s timeout, npm ecosystem
High-performance compiled API Cloud Functions (Go) Gin/Echo/Chi/Fiber, compiled speed, Go modules
Data science, ML, Python ecosystem Cloud Functions (Python) Flask/FastAPI/Django, pip packages, Python 3.10
Request interception, auth, redirects Middleware Edge-level, runs before all handlers
Edge-side key-value storage KV Storage + Edge Functions Global, eventual consistency, low latency
WebSocket real-time features Cloud Functions (Node.js) Only runtime supporting WebSocket
Static site, no server logic Direct deploy (no functions) Fastest, CDN-served globally

Runtime Comparison

Feature Edge Functions Node.js Go Python Middleware
Engine V8 Node.js v20 Go 1.26+ Python 3.10 V8
npm/packages ✅ npm ✅ Go modules ✅ pip
Max code size 5 MB 128 MB 128 MB 128 MB Edge bundle
Max body 1 MB 6 MB 6 MB 6 MB Pass-through
Timeout 200ms CPU 120s 120s 120s Lightweight
KV Storage
WebSocket
Framework Express/Koa Gin/Echo/Chi/Fiber Flask/FastAPI/Django

Framework Projects

Framework SSR/SSG API Routes Deploy
Next.js ✅ SSR/SSG/ISR ✅ (auto Cloud Functions) edgeone pages deploy
Nuxt ✅ SSR/SSG ✅ server routes edgeone pages deploy
Astro ✅ Static/SSR/Hybrid Via Edge/Cloud Functions edgeone pages deploy
SvelteKit ✅ SSR/SSG/SPA ✅ endpoints edgeone pages deploy
React (Vite) SPA only Via Edge/Cloud Functions edgeone pages deploy
Vue (Vite) SPA only Via Edge/Cloud Functions edgeone pages deploy
Angular SPA/SSR Via Edge/Cloud Functions edgeone pages deploy
Static HTML N/A Via Edge/Cloud Functions edgeone pages deploy

Data Storage

Need Use Where
Simple key-value at edge KV Storage Edge Functions only
Relational database MySQL/PostgreSQL via Cloud Functions Node.js / Go / Python
Document database MongoDB via Cloud Functions Node.js / Go / Python
Cache Redis via Cloud Functions Node.js / Go / Python
File storage Third-party (S3/COS) via Cloud Functions Any Cloud Function runtime

11. Common Workflows

1. Deploy a Static Site

1. npm install -g edgeone@latest
2. edgeone login --site china|global
3. cd my-project && edgeone pages deploy -n my-project
4. Get EDGEONE_DEPLOY_URL (⚠️ include full query params)

2. Build a Full-Stack App (React + API)

1. Create React frontend (Vite recommended)
2. Add Edge Functions: functions/api/hello.js → export function onRequest(ctx) { ... }
3. Add Cloud Functions (if complex): cloud-functions/api/data/index.js
4. edgeone pages dev (local dev on :8088)
5. edgeone pages deploy

3. Migrate Express App to EdgeOne Pages

1. Move Express app to cloud-functions/<route>/
2. Create [[default]].js with Express app export
3. Add package.json with dependencies
4. edgeone pages dev (test locally)
5. edgeone pages deploy

4. Add Auth Middleware

1. Create middleware.js at project root
2. export default { async fetch(request, env, ctx) {
     const token = request.headers.get('Authorization');
     if (!token) return new Response('Unauthorized', { status: 401 });
     return fetch(request); // pass through
   }}
3. edgeone pages dev (test locally)

5. Set Up KV Counter

1. Enable KV in EdgeOne console for project
2. edgeone pages link (bind project)
3. Create functions/api/counter.js with KV get/put
4. edgeone pages dev (local test with simulated KV)
5. edgeone pages deploy

6. CI/CD Pipeline

1. Save API token as CI secret: EDGEONE_TOKEN
2. Pipeline: npm ci → npm run build → edgeone pages deploy -t $EDGEONE_TOKEN
3. Parse EDGEONE_DEPLOY_URL from output for preview link

12. Migration Awareness

From To EdgeOne Pages Notes
Cloudflare Pages EdgeOne Pages Similar Edge Functions API (V8), KV compatible
Vercel EdgeOne Pages Convert Serverless Functions → Cloud Functions, middleware.ts → middleware.js
Netlify EdgeOne Pages Convert serverless functions, redirect rules → middleware
Express standalone Cloud Functions (Node.js) Use [[default]].js pattern for catch-all routing
Flask/FastAPI standalone Cloud Functions (Python) Place app entry in cloud-functions/<route>/
Gin/Echo standalone Cloud Functions (Go) Use framework mode with auto port binding

13. ⚠️ Common Pitfalls

  1. Edge Functions ≠ Node.js — No require(), no fs, no npm packages. Use Web Standard APIs only.
  2. Never truncate deploy URLsEDGEONE_DEPLOY_URL includes auth query params. Always output the full URL.
  3. Don't mix platform middleware with framework middleware — Next.js/Nuxt have their own middleware; middleware.js at root overrides them.
  4. edgeone pages dev recursion — Never configure it as devCommand in edgeone.json or as npm run dev.
  5. KV requires console setup first — Must enable KV namespace in the EdgeOne console and edgeone pages link before use.
  6. Cloud Functions directory naming — Each subdirectory under cloud-functions/ maps to a route. cloud-functions/api/users/index.js/api/users.
  7. Go Handler vs Framework mode — Handler uses func Handler(w, r), Framework uses func main() with a router. Don't mix them.
  8. Python entry detection — The platform detects entry files by patterns (class handler, app = Flask(...), app = FastAPI(...)). Other .py files are helpers.
  9. CLI version matters — Always use edgeone@latest (≥ 1.2.30). Older versions may not support all features.
  10. Site selection (China vs Global) — Always ask the user before login. Each site has separate accounts, projects, and consoles.

Conventions

Development Defaults

  • Use edgeone pages dev for all local development — it handles static files, functions, and middleware together.
  • Use file-based routing: directory structure = URL structure.
  • Prefer Edge Functions for lightweight APIs (no npm needed, ultra-low latency).
  • Prefer Cloud Functions for complex logic (npm packages, databases, WebSocket).
  • Use middleware only for cross-cutting request interception.

Deployment Defaults

  • Always check CLI version first (edgeone -v ≥ 1.2.30).
  • Always check login status (edgeone whoami).
  • Always ask for China vs Global site before first login.
  • Always output the full EDGEONE_DEPLOY_URL with query parameters.
  • Use browser login for desktop IDEs, token login for headless/CI.

Code Style

  • Edge Functions & Middleware: Web Standard APIs, ES modules (export function).
  • Cloud Functions (Node.js): ES modules or CommonJS, Response object return.
  • Cloud Functions (Go): Standard Go conventions, go.mod for dependencies.
  • Cloud Functions (Python): PEP 8, requirements.txt for dependencies.
  • Environment variables: access via context.env (Edge/Node.js), os.Getenv (Go), os.environ (Python).