Loading...
Loading...
Guide development on EdgeOne Pages — Edge Functions, Node Functions, Middleware, and local dev workflows. Use when the user wants to create APIs, serverless functions, middleware, WebSocket endpoints, or full-stack features on EdgeOne Pages — e.g. "create an API", "add a serverless function", "write middleware", "build a full-stack app", "add WebSocket support", or "set up edge functions".
npx skill4agent add edgeone-pages/edgeone-pages-skills edgeone-pages-devedgeone-pages-deploymiddleware.jsfspathcryptoResponseres.send()[[default]].jsedgeone pages devedgeone pages devdevCommandedgeone.jsondevpackage.jsonmiddleware.jsmiddleware.tsNextRequestNextResponsemiddleware.jsUser needs request interception / redirect / rewrite / auth guard / A/B test?
→ Middleware → read middleware.md
User needs a lightweight API with ultra-low latency (simple logic, no npm)?
→ Edge Functions → read edge-functions.md
User needs KV persistent storage? (⚠️ must enable KV in console first)
→ Edge Functions + KV Storage → read kv-storage.md
User needs complex backend logic / npm packages / database / WebSocket?
→ Node Functions → read node-functions.md
User needs Express or Koa framework?
→ Node Functions with [[default]].js entry → read node-functions.md
User has a pure static site with no server-side logic?
→ No functions needed — just deploy static files
Need a project structure template?
→ read recipes.md| Feature | Edge Functions | Node Functions | Middleware |
|---|---|---|---|
| Runtime | V8 (like Cloudflare Workers) | Node.js v20.x | V8 (edge) |
| npm packages | ❌ Not supported | ✅ Full npm ecosystem | ❌ Not supported |
| Max code size | 5 MB | 128 MB | Part of edge bundle |
| Max request body | 1 MB | 6 MB | N/A (passes through) |
| Max CPU / wall time | 200 ms CPU | 120 s wall clock | Lightweight only |
| KV Storage | ✅ Yes (global variable) | ❌ No | ❌ No |
| WebSocket | ❌ No | ✅ Yes | ❌ No |
| Use case | Lightweight APIs, edge compute | Complex APIs, full-stack | Request preprocessing |
| Task | Read |
|---|---|
| Edge Functions (lightweight APIs, V8 runtime, KV Storage) | edge-functions.md |
| KV Storage (persistent key-value storage on edge) | kv-storage.md |
| Node Functions (npm, database, Express/Koa, WebSocket) | node-functions.md |
| Middleware (redirects, rewrites, auth guards, A/B testing) | middleware.md |
| Project structure templates and common recipes | recipes.md |
| Debugging and troubleshooting | troubleshooting.md |
edgeone pages initedge-functions/node-functions/my-project/
├── edge-functions/ # Edge Functions (V8 runtime)
│ └── api/
│ ├── hello.js # → /api/hello
│ ├── users/
│ │ ├── list.js # → /api/users/list
│ │ ├── [id].js # → /api/users/:id (dynamic)
│ │ └── index.js # → /api/users
│ └── [[default]].js # → /api/* (catch-all)
├── node-functions/ # Node Functions (Node.js runtime)
│ └── api/
│ ├── data.js # → /api/data
│ ├── ws.js # → /api/ws (WebSocket)
│ └── [[default]].js # → /api/* (Express/Koa entry)
├── middleware.js # Middleware (runs before all requests)
├── edgeone.json # Project config (auto-generated)
├── package.json
├── index.html # Static frontend
└── ...edgeone pages devhttp://localhost:8088/console.log()edgeone pages linkedgeone pages env ls # List all
edgeone pages env pull # Pull to local .env
edgeone pages env pull -f .env.prod # Pull to specific file
edgeone pages env add KEY value # Add
edgeone pages env rm KEY # Removecontext.env.KEY