CLI Commands
Complete reference for all zMesh CLI commands.
Authentication
| Command | Description |
|---|---|
| zmesh login | Authenticate with email/password |
| zmesh login --api-url <url> | Login to self-hosted instance |
| zmesh logout | Clear stored credentials |
| zmesh whoami | Show current user & linked project |
Projects
| Command | Description |
|---|---|
| zmesh projects | List all projects |
| zmesh init --name "App" | Create & link a new project |
| zmesh link <project-id> | Link existing project to current dir |
| zmesh unlink | Unlink current directory |
Database
| Command | Description |
|---|---|
| zmesh database tables | List all tables in the project |
| 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 file |
Examples
# Create a table
zmesh database query "CREATE TABLE posts (
id SERIAL PRIMARY KEY,
title TEXT NOT NULL,
body TEXT,
created_at TIMESTAMP DEFAULT NOW()
)"
# Query data
zmesh database query "SELECT * FROM posts LIMIT 10"
# Run migration file
zmesh database migrate ./migrations/001_add_users.sql
# Seed from JSON
zmesh database seed ./seeds/users.json
# JSON format: { "table": "users", "data": [{ "name": "Alice" }] }Edge Functions
| Command | Description |
|---|---|
| zmesh functions list | List all deployed functions |
| zmesh functions deploy <file> | Deploy a .js or .py function |
| zmesh functions invoke <slug> | Invoke with --payload JSON |
| zmesh functions logs <slug> | View invocation logs |
| zmesh functions delete <slug> | Remove a function |
Deploy with options
zmesh functions deploy ./send-email.js \
--name send-email \
--description "Send transactional emails" \
--entry-point handler \
--env SMTP_HOST=smtp.sendgrid.net \
--timeout 10000Storage
| Command | Description |
|---|---|
| zmesh storage list | List files (--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 |
Examples
# Upload an image
zmesh storage upload ./logo.png --path images/logo.png --bucket assets
# List files in a folder
zmesh storage list --bucket assets --prefix images/
# Download a file
zmesh storage download images/logo.png --output ./downloaded.pngEnvironment Variables
| Command | Description |
|---|---|
| zmesh env --list | List all environment variables |
| zmesh env --set KEY=value | Set an environment variable |
| zmesh env --unset KEY | Remove an environment variable |