| name | edgeone-makers-recipes |
| description | Project structure templates and scaffolding recipes for typical EdgeOne Makers applications โ full-stack apps, static sites, API services, and AI agent projects. |
| metadata | {"author":"edgeone","version":"1.0.0"} |
Common Recipes
โ ้ข่ง็ฆไปค๏ผๅผๅๅฎๆๅๅฟ
้กป้่ฟ edgeone makers dev ๅฏๅจ dev server๏ผๅ็จ present_files ๆๅผ http://127.0.0.1:8088/ ้ข่งใไธฅ็ฆ็จ file:// ๅ่ฎฎๆๅผ HTML ๆไปถ๏ผๅณไฝฟ IDE ่ชๅจๆๅผไบไน่ฆๅฟฝ็ฅ๏ผ๏ผไธฅ็ฆ็จ python -m http.serverใnpx serve ็ญ่ชๅปบ serverใNext.js ้กน็ฎ่ฟ้ๅจ next.config ไธญ้
็ฝฎ allowedDevOrigins: ["127.0.0.1"]ใ
Project structure templates for typical EdgeOne Makers applications.
Full-stack app โ Node.js (static + API)
my-app/
โโโ index.html # Frontend
โโโ style.css
โโโ script.js
โโโ cloud-functions/
โ โโโ api/
โ โโโ users.js # GET/POST /api/users
โ โโโ users/[id].js # GET/PUT/DELETE /api/users/:id
โโโ package.json
Frontend calls API:
const res = await fetch('/api/users');
const users = await res.json();
Full-stack app โ Go (Gin framework)
my-app/
โโโ index.html # Frontend
โโโ style.css
โโโ script.js
โโโ cloud-functions/
โ โโโ api.go # Gin app โ all /api/* routes
โโโ go.mod
โโโ package.json
cloud-functions/api.go:
package main
import (
"net/http"
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
r.GET("/users", listUsersHandler)
r.POST("/users", createUserHandler)
r.GET("/users/:id", getUserHandler)
r.Run(":9000")
}
Full-stack app โ Python (Flask)
my-app/
โโโ index.html # Frontend
โโโ style.css
โโโ script.js
โโโ cloud-functions/
โ โโโ api/
โ โโโ index.py # Flask app โ all /api/* routes
โโโ cloud-functions/requirements.txt
โโโ package.json
cloud-functions/api/index.py:
from flask import Flask, jsonify, request
app = Flask(__name__)
@app.route('/users', methods=['GET'])
def get_users():
return jsonify({'users': []})
@app.route('/users', methods=['POST'])
def create_user():
data = request.get_json()
return jsonify({'message': 'Created', 'user': data}), 201
Full-stack app โ Python (FastAPI)
my-app/
โโโ index.html
โโโ cloud-functions/
โ โโโ api/
โ โโโ index.py # FastAPI app โ all /api/* routes
โโโ cloud-functions/requirements.txt
โโโ package.json
cloud-functions/api/index.py:
from fastapi import FastAPI
app = FastAPI()
@app.get('/items')
async def list_items():
return {'items': []}
@app.get('/items/{item_id}')
async def get_item(item_id: int):
return {'item_id': item_id}
Full-stack app โ Go (Handler mode)
my-app/
โโโ index.html
โโโ cloud-functions/
โ โโโ api/
โ โโโ users/
โ โ โโโ list.go # GET /api/users/list
โ โ โโโ [id].go # GET /api/users/:id
โ โโโ hello.go # GET /api/hello
โโโ go.mod
โโโ package.json
Edge API + KV counter
โ ๏ธ Prerequisites: You must enable KV Storage in the console and bind a namespace first. See kv-storage.md (same directory)
my-app/
โโโ index.html
โโโ edge-functions/
โ โโโ api/
โ โโโ visit.js # Edge function with KV
โโโ package.json
edge-functions/api/visit.js:
export async function onRequest() {
let count = await my_kv.get('visits') || '0';
count = String(Number(count) + 1);
await my_kv.put('visits', count);
return new Response(JSON.stringify({ visits: count }), {
headers: { 'Content-Type': 'application/json' },
});
}
Setup steps:
- Log in to the EdgeOne Makers console
- Go to "KV Storage" โ click "Apply Now"
- Create a namespace (e.g.
my-kv-store)
- Bind to project, set variable name to
my_kv
- Deploy or run
edgeone makers dev to test
Express full-stack
my-app/
โโโ index.html
โโโ cloud-functions/
โ โโโ api/
โ โโโ [[default]].js # Express app handles all /api/*
โโโ package.json
Middleware + API combo
my-app/
โโโ middleware.js # Auth guard for /api/*
โโโ cloud-functions/
โ โโโ api/
โ โโโ public.js # No auth needed (matcher excludes it)
โ โโโ data.js # Protected by middleware
โโโ package.json
Multi-language Cloud Functions
You can use different languages in the same cloud-functions/ directory:
my-app/
โโโ index.html
โโโ cloud-functions/
โ โโโ api/
โ โ โโโ users.js # Node.js โ /api/users
โ โ โโโ hello.py # Python โ /api/hello
โ โโโ service.go # Go โ /service
โโโ go.mod
โโโ cloud-functions/requirements.txt
โโโ package.json
Note: Each file is built and deployed as an independent function with its own runtime. The platform detects the language by file extension.