InsForge CLI: Manage Your Backend from the Terminal and Let AI Agents Do It Too

24 Feb 20263 minute
Junwen Feng

Junwen Feng

Engineer

InsForge CLI

We just published @insforge/cli on npm. It's a single command-line tool that gives you full control over your InsForge backend: databases, edge functions, storage, deployments, secrets, and documentation — all from the terminal.

But here's the part we're most excited about: when you set up a project with the CLI, it automatically installs Agent Skills that teach AI coding assistants how to build on InsForge. That means Claude Code, Cursor, Cline, Windsurf, and 11 other AI agents can configure your backend and write SDK integration code — guided by structured, up-to-date documentation.

bash
npm install -g @insforge/cli

Getting Started

Three commands to go from zero to a fully linked project:

bash
# 1. Authenticate via browser OAuth
insforge login

# 2. Create a new project (or link an existing one)
insforge create
# or
insforge link

# 3. You're ready — check your context
insforge current

When you run insforge create or insforge link, the CLI does something extra behind the scenes: it installs InsForge Agent Skills into your project directory. More on that below — it's a game changer for AI-assisted development.

What You Can Do

The CLI covers every InsForge service. Here's a quick tour.

Database

Query your database directly, inspect schema, and manage imports/exports:

bash
# Run any SQL query
insforge db query "SELECT * FROM posts ORDER BY created_at DESC LIMIT 10"

# Explore your schema
insforge db tables
insforge db indexes
insforge db policies
insforge db triggers
insforge db functions

# Call a database function
insforge db rpc calculate_stats --data '{"user_id": "abc-123"}'

# Export and import
insforge db export --output backup.sql
insforge db import schema.sql

Edge Functions

List, inspect, deploy, and invoke serverless functions:

bash
# See all deployed functions
insforge functions list

# Read the source code
insforge functions code cleanup-expired

# Deploy or update a function
insforge functions deploy my-function --file ./handler.ts

# Invoke it
insforge functions invoke my-function --data '{"action": "process"}'

Storage

Full bucket and object management:

bash
# List buckets and objects
insforge storage buckets
insforge storage list-objects images --prefix "avatars/"

# Create and delete buckets
insforge storage create-bucket uploads
insforge storage delete-bucket temp-files

# Upload and download files
insforge storage upload ./photo.png --bucket images --key "avatars/user-1.png"
insforge storage download avatars/user-1.png --bucket images

Deployments

Deploy frontend applications with automatic build polling:

bash
# Deploy the current directory (waits up to 2 minutes for build to finish)
insforge deployments deploy

# Deploy with environment variables
insforge deployments deploy ./my-app --env '{"VITE_API_URL": "https://my-project.us-east-1.insforge.app"}'

# Check deployment status
insforge deployments list
insforge deployments status abc-123

Secrets

Manage environment secrets for your project:

bash
# List active secrets
insforge secrets list

# Add and update secrets
insforge secrets add STRIPE_KEY sk_live_xxx
insforge secrets update STRIPE_KEY --value sk_live_new_xxx

# View a secret's value
insforge secrets get STRIPE_KEY

# Delete (soft delete — can be restored)
insforge secrets delete OLD_KEY

Documentation

Browse InsForge SDK docs right from the terminal — by feature and language:

bash
# List all available docs
insforge docs

# View setup instructions
insforge docs instructions

# Feature-specific, language-specific docs
insforge docs db typescript
insforge docs auth swift
insforge docs storage rest-api

Supported features: db, storage, functions, auth, ai, realtime Supported languages: typescript, swift, kotlin, rest-api

Built for AI Agents

Every command in the CLI is designed to work in non-interactive, machine-readable mode:

  • --json on any command returns structured JSON instead of formatted tables
  • -y skips all confirmation prompts
  • Semantic exit codes tell agents exactly what went wrong (0 = success, 2 = auth failure, 3 = project not linked, etc.)
  • Environment variable auth for CI/CD pipelines — no interactive login needed
bash
# CI-friendly: login, link, and query — all non-interactive
INSFORGE_EMAIL=$EMAIL INSFORGE_PASSWORD=$PASSWORD insforge login --email --json
insforge link --project-id $PROJECT_ID --org-id $ORG_ID -y
insforge db query "SELECT count(*) FROM users" --json | jq '.rows[0].count'

CLI + Agent Skills: Teaching AI How to Build on InsForge

This is where it gets interesting.

When you run insforge create or insforge link, the CLI automatically runs:

bash
npx skills add insforge/agent-skills

This installs a set of structured documentation files — Agent Skills — into your project's .agents/skills/insforge/ directory. These skills are compatible with multiple AI coding platforms.

What Skills Teach the Agent

The skills are organized into 9 feature modules, each with two types of guidance:

ModuleBackend ConfigurationSDK Integration
DatabaseCreate tables, RLS policies, triggers, indexesCRUD, filters, pagination
AuthConfigure providers, user managementSign up/in, OAuth, sessions
StorageCreate and manage bucketsUpload, download, delete files
FunctionsDeploy and manage functionsInvoke functions
AIConfigure models and creditsChat, images, embeddings
Real-timeChannel patterns, triggersConnect, subscribe, publish
SchedulesCron jobs, HTTP triggers
DeploymentsDeploy frontend apps
LogsFetch container logs

The key distinction: Backend Configuration guides the agent to use HTTP API calls (e.g., POST /api/database/advance/rawsql to create a table), while SDK Integration guides it to write application code using @insforge/sdk.

With InsForge CLI and Agent Skills, the entire flow — from empty project to deployed app — happens with AI assistance, guided by structured skills that the CLI installed automatically.