Skip to main content

The AI-first Backend as a Service — Database, Edge Functions, Storage, AI Gateway from your terminal.

Project description

⚡ zMesh

The AI-First Backend as a Service — From Your Terminal

PyPI version Python License: MIT Downloads

Database • Edge Functions • Storage • AI Gateway • Auth — One CLI.

Website · Docs · Dashboard


What is zMesh?

zMesh is an AI-first Backend as a Service that gives you a full backend — PostgreSQL database, serverless edge functions, file storage, AI gateway, authentication — without writing a single line of infrastructure code.

This CLI lets you manage everything from your terminal.

pip install zmesh-cli

Quick Start

# Authenticate
zmesh login

# Create a new project
zmesh init --name "My App"

# Create a table
zmesh database query "CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  name TEXT NOT NULL,
  email TEXT UNIQUE
)"

# Deploy an edge function
zmesh functions deploy ./api.js

# Upload a file
zmesh storage upload ./logo.png --path assets/logo.png

That's it. Your backend is live.


Features

🗄️ Database

Full PostgreSQL — create tables, run queries, migrate schemas, seed data.

zmesh database tables
zmesh database query "SELECT * FROM users"
zmesh database migrate ./schema.sql
zmesh database seed ./data.json

⚡ Edge Functions

Deploy JavaScript or Python functions with built-in DB access.

zmesh functions deploy ./handler.js
zmesh functions invoke my-func --payload '{}'
zmesh functions logs my-func

📦 Storage

Upload, download, and manage files on Cloudflare R2.

zmesh storage upload ./image.png
zmesh storage list --prefix photos/
zmesh storage download photos/img.png

🤖 AI Gateway

Multi-provider AI — OpenAI, Anthropic, Google, Groq, Mistral, DeepSeek.

# Manage via Dashboard or API
# Chat, Embeddings, Vector Store (pgvector)
# Schema & RLS generation from prompts

Commands

Authentication & Projects

Command Description
zmesh login Authenticate with email/password
zmesh logout Clear stored credentials
zmesh whoami Show current user & linked project
zmesh projects List all your projects
zmesh init --name "App" Create & link a new project
zmesh link <project-id> Link to an existing project
zmesh unlink Unlink current directory

Database

Command Description
zmesh database tables List all tables
zmesh database query "<sql>" Execute raw SQL
zmesh database query --file schema.sql Run SQL from file
zmesh database migrate <file> Run a migration script
zmesh database seed <file> Seed data from JSON

Edge Functions

Command Description
zmesh functions list List all deployed functions
zmesh functions deploy <file> Deploy a JS or Python function
zmesh functions invoke <slug> Invoke with optional --payload
zmesh functions logs <slug> View invocation history
zmesh functions delete <slug> Remove a function

Deploy with options:

zmesh functions deploy ./send-email.js \
  --name send-email \
  --description "Transactional email sender" \
  --entry-point handler \
  --env SMTP_HOST=smtp.example.com \
  --timeout 10000

Storage

Command Description
zmesh storage list List files (with --bucket, --prefix)
zmesh storage upload <file> Upload with --path and --bucket
zmesh storage download <path> Download to --output
zmesh storage delete <path> Remove a file

Environment Variables

Command Description
zmesh env --list List all env vars
zmesh env --set KEY=value Set an env var
zmesh env --unset KEY Remove an env var

Edge Functions

zMesh's edge functions run in a custom-built sandboxed runtime — no AWS Lambda, no third-party FaaS. Each function gets isolated subprocess execution with OS-level resource limits and a pre-injected zmesh SDK with direct database access.

JavaScript

// get-users.js
exports.handler = async (payload, zmesh) => {
  const users = await zmesh.db.query(
    'SELECT * FROM users WHERE active = $1', [true]
  );

  const newLog = await zmesh.db.insert('audit_log', {
    action: 'list_users',
    count: users.length
  });

  const secret = zmesh.env.API_SECRET;

  return { users, logged: true };
};

Python

# get-users.py
def handler(payload, zmesh):
    users = zmesh.db.query(
        "SELECT * FROM users WHERE active = %s", (True,)
    )

    zmesh.db.insert("audit_log", {
        "action": "list_users",
        "count": len(users)
    })

    return {"users": users}

SDK Reference

Method Description
zmesh.db.query(sql, params) Execute SQL, return rows
zmesh.db.queryOne(sql, params) Execute SQL, return single row
zmesh.db.insert(table, data) Insert a record
zmesh.db.select(table, where, params) Select with conditions
zmesh.db.update(table, data, where, params) Update matching rows
zmesh.db.remove(table, where) Delete matching rows
zmesh.env.KEY Access environment variable
zmesh.projectId Current project ID

End-to-End Example

Build a complete blog API in under 2 minutes:

# 1. Create project
zmesh init --name "Blog API"

# 2. Create schema
zmesh database query "
CREATE TABLE posts (
  id SERIAL PRIMARY KEY,
  title TEXT NOT NULL,
  body TEXT,
  author TEXT,
  created_at TIMESTAMP DEFAULT NOW()
)"

# 3. Write a function
cat > get-posts.js << 'EOF'
exports.handler = async (payload, zmesh) => {
  const posts = await zmesh.db.query(
    'SELECT * FROM posts ORDER BY created_at DESC LIMIT $1',
    [payload.limit || 10]
  );
  return { posts };
};
EOF

# 4. Deploy
zmesh functions deploy ./get-posts.js

# 5. Test
zmesh functions invoke get-posts --payload '{"limit": 5}'

# 6. Call from your app
curl -X POST https://api.zmesh.in/api/functions/get-posts \
  -H "x-api-key: zb_your_key" \
  -H "Content-Type: application/json" \
  -d '{"limit": 5}'

Configuration

Location Purpose
~/.zmesh/config.json Global — API URL, auth token
.zmesh/config.json Local — linked project & org
.zmesh/.env Function environment variables

Self-Hosted

zmesh login --api-url https://api.yourdomain.com/v1

Requirements

  • Python 3.11+
  • A zMesh account

Links

🌐 Website zmesh.in
📖 Docs zmesh.in/docs
🖥️ Dashboard app.zmesh.in
📧 Support hello@zmesh.in

Built by Zyora

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zmesh_cli-0.1.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zmesh_cli-0.1.0-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file zmesh_cli-0.1.0.tar.gz.

File metadata

  • Download URL: zmesh_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for zmesh_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5c25c84eb38b4a7ced22227f2a15940c8241f6a40ec6f0dc081b59c4c3d7ea4d
MD5 b9ebf40d1c0a674dbaed680a4fb96328
BLAKE2b-256 7aa866238672f2a2f8fe6bd0ad069c18622b7422e557f48fcf824ceb6207b097

See more details on using hashes here.

File details

Details for the file zmesh_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zmesh_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for zmesh_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d95374dab90359bb0e1f9bdb7de9e1951d6fda22dab5fe4a7b4c8f948306d2ba
MD5 13631d0f6e5bc22a63ddeb02929bdcf8
BLAKE2b-256 0997f735bb344fc0c6c15f680dd6cd2f3aebcb5bd0a04ee48db198a17a168106

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page