Deploy Your First Function
Go from zero to a live serverless function in under 2 minutes.
1.Install & Login
pip install zmesh-cli
zmesh login2. Create a Project
mkdir my-api && cd my-api
zmesh init --name "My API"3. Write a Function
hello.jsJavaScript
exports.handler = async (payload, zmesh) => {
const name = payload.name || "World";
return { message: `Hello, ${name}!` };
};Or in Python:
hello.pyPython
def handler(payload, zmesh):
name = payload.get("name", "World")
return {"message": f"Hello, {name}!"}4. Deploy
zmesh functions deploy ./hello.js
# ✓ Function "hello" deployed successfully
# Slug: hello
# Invoke: zmesh functions invoke hello5. Test It
CLI
zmesh functions invoke hello --payload '{"name": "zMesh"}'
# { "message": "Hello, zMesh!" }cURL (Public API)API Key
curl -X POST https://api.zmesh.in/api/functions/hello \
-H "x-api-key: zb_your_api_key" \
-H "Content-Type: application/json" \
-d '{"name": "zMesh"}'Next Steps
Add database access
Use zmesh.db.query() inside your function to read/write data.
Set environment variables
Use zmesh env --set API_KEY=xxx and access via zmesh.env.API_KEY.