Skip to content
@calycode/cli docs
GitHub Discord

XanoScript in Xano Tools

This guide explains how Xano Tools works with XanoScript and where to find comprehensive XanoScript documentation.

Table of Contents

Overview

XanoScript (.xs files) is Xano's domain-specific language for defining backend logic, including functions, APIs, database tables, and more. It provides a text-based representation of Xano's visual function stacks.

Important: Xano Tools does not define the XanoScript language—it processes and works with XanoScript as defined by Xano. For comprehensive syntax documentation, refer to the official Xano resources below.

Official XanoScript Documentation

For complete XanoScript syntax, features, and usage:

Official Xano Documentation https://docs.xano.com/xanoscript/vs-code#usage

The official documentation covers:

  • XanoScript syntax and grammar
  • Function stack definitions
  • Variable declarations
  • Control flow and conditionals
  • Database operations
  • Input/output handling
  • Built-in functions and operators

How Xano Tools Uses XanoScript

Xano Tools integrates with XanoScript in several ways:

1. Extraction (generate xanoscript)

Extract XanoScript from your Xano workspace for version control:

Bash
# Extract XanoScript from all supported entities
caly-xano generate xanoscript \
  --instance production \
  --workspace main \
  --branch live

This creates .xs files representing your Xano functions, APIs, and other entities.

2. Repository Generation (generate repo)

Include XanoScript in your repository structure:

Bash
# Generate complete repo with XanoScript
caly-xano generate repo \
  --instance production \
  --workspace main \
  --branch live

3. Registry Components

Include XanoScript in reusable registry components:

JSON
{
   "name": "utils/jwt-helper",
   "type": "registry:function",
   "files": [
      {
         "path": "./jwt-helper.xs",
         "type": "registry:function"
      }
   ]
}

4. Component Installation (registry add)

Deploy XanoScript-based components to your Xano instance:

Bash
caly-xano registry add utils/jwt-helper \
  --registry https://registry.example.com/definitions

Supported Entity Types

Xano Tools can process the following XanoScript entity types:

Entity TypeDescriptionCLI Support
addonReusable utility functions✅ Extract, Registry
functionCustom function stacks✅ Extract, Registry
apigroupAPI endpoint groups✅ Extract, Registry
tableDatabase table definitions✅ Extract, Registry
taskScheduled tasks✅ Extract, Registry
middlewareRequest/response middleware✅ Extract, Registry
triggerWorkspace-level triggers✅ Extract, Registry
table/triggerTable-level triggers✅ Extract, Registry
agentAI agents✅ Extract, Registry
agent/triggerAgent triggers✅ Extract, Registry
toolAI tools for agents✅ Extract, Registry
mcp_serverMCP server definitions✅ Extract, Registry
mcp_server/triggerMCP server triggers✅ Extract, Registry
realtime/channelRealtime WebSocket channels✅ Extract, Registry
realtime/channel/triggerChannel triggers✅ Extract, Registry
workflow_testWorkflow test definitions✅ Extract

Extracting XanoScript

Basic Extraction

Bash
# Extract from current context
caly-xano generate xanoscript

# Extract from specific instance/workspace/branch
caly-xano generate xanoscript \
  --instance my-instance \
  --workspace my-workspace \
  --branch main

Output Structure

Extracted files are organized by entity type:

Code
{output-dir}/
├── addons/
│   ├── utility-addon.xs
│   └── helper-addon.xs
├── functions/
│   ├── auth/
│   │   ├── login.xs
│   │   └── verify-token.xs
│   └── utils/
│       └── format-date.xs
├── apis/
│   ├── user-api/
│   │   ├── _group.xs
│   │   ├── get-users.xs
│   │   └── create-user.xs
│   └── product-api/
│       └── ...
├── tables/
│   ├── user.xs
│   └── product.xs
├── tasks/
│   └── daily-cleanup.xs
└── ...

Including in Repo Generation

XanoScript is automatically included when generating a repository:

Bash
caly-xano generate repo --instance production --workspace main --branch live

Using XanoScript in Registries

File Reference

Reference XanoScript files in your registry item definitions:

JSON
{
   "name": "auth/jwt-verify",
   "type": "registry:function",
   "files": [
      {
         "path": "./jwt-verify.xs",
         "type": "registry:function"
      }
   ]
}

Inline Content

Or include XanoScript content directly:

JSON
{
   "name": "utils/simple-helper",
   "type": "registry:function",
   "files": [
      {
         "content": "// XanoScript content here\n...",
         "type": "registry:function"
      }
   ]
}

Multiple Files

Components can include multiple XanoScript files:

JSON
{
   "name": "auth/complete-auth",
   "type": "registry:function",
   "files": [
      {
         "path": "./login.xs",
         "type": "registry:function"
      },
      {
         "path": "./register.xs",
         "type": "registry:function"
      },
      {
         "path": "./verify.xs",
         "type": "registry:function"
      }
   ]
}

Development Workflow

Recommended Setup

  1. Use the Xano VS Code Extension - Best experience for XanoScript development
  2. Extract existing code - Use caly-xano generate xanoscript to get your current code
  3. Develop in VS Code - Edit XanoScript with syntax highlighting
  4. Package in registries - Create reusable components
  5. Deploy via CLI - Use caly-xano registry add to install

VS Code Extension

The official Xano VS Code extension provides:

  • Syntax highlighting for .xs files
  • IntelliSense and autocompletion
  • Direct sync with your Xano instance
  • Error checking and validation

Note: The Xano VS Code extension is the preferred solution for XanoScript development. The CLI's generate xanoscript command is useful for extraction and version control, but the VS Code extension offers a more complete development experience.

Version Control

XanoScript files are text-based and work well with Git:

Bash
# Generate XanoScript for version control
caly-xano generate xanoscript --instance prod --workspace main --branch live

# Commit changes
git add .
git commit -m "Extract latest XanoScript from production"

Resources

Official Xano Documentation

Xano Tools Documentation

Community