Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/tailor-platform/sdk/llms.txt

Use this file to discover all available pages before exploring further.

TailorDB ERD features are currently in beta and may introduce breaking changes in future releases.
The tailordb erd commands help you generate Entity Relationship Diagrams (ERDs) from your TailorDB schema using Liam ERD. These commands export schema artifacts, serve ERDs locally, and deploy them as static websites.

Commands

tailordb erd export

Export Liam ERD distribution files from your applied TailorDB schema.
tailor-sdk tailordb erd export [options]

Options

--workspace-id
string
default:"-w"
Workspace ID for the operation
--profile
string
default:"-p"
Workspace profile to use
--config
string
default:"tailor.config.ts"
Path to SDK config file
--namespace
string
default:"-n"
TailorDB namespace name (optional if only one namespace is defined in config)
--output
string
default:".tailor-sdk/erd"
Output directory path for tbls-compatible ERD JSON (writes to <outputDir>/<namespace>/schema.json)
--json
boolean
default:"false"
Output results as JSON

How It Works

  1. Fetches the applied TailorDB schema from your workspace
  2. Converts the schema to tbls-compatible JSON format
  3. Runs the Liam CLI (liam erd build) to generate static ERD files
  4. Outputs the built ERD distribution to <outputDir>/<namespace>/dist

Examples

# Export ERD for all namespaces
tailor-sdk tailordb erd export

# Export for a specific namespace
tailor-sdk tailordb erd export --namespace myNamespace

# Export to custom directory
tailor-sdk tailordb erd export --output ./erd-output

# Get JSON output
tailor-sdk tailordb erd export --json

Output

The command generates the following structure:
.tailor-sdk/erd/
└── <namespace>/
    ├── schema.json          # tbls-compatible schema
    └── dist/                # Liam ERD static files
        ├── index.html
        ├── assets/
        └── ...

tailordb erd serve

Generate and serve ERD locally (combines liam build + serve dist).
tailor-sdk tailordb erd serve [options]

Options

--workspace-id
string
default:"-w"
Workspace ID for the operation
--profile
string
default:"-p"
Workspace profile to use
--config
string
default:"tailor.config.ts"
Path to SDK config file
--namespace
string
default:"-n"
TailorDB namespace name (uses first namespace in config if not specified)

How It Works

  1. Exports ERD artifacts (same as erd export)
  2. Starts a local development server using the serve package
  3. Opens the ERD in your browser (typically at http://localhost:3000)
If multiple namespaces are found, the command serves the first one and displays commands to serve the others.

Examples

# Serve ERD for default/first namespace
tailor-sdk tailordb erd serve

# Serve ERD for specific namespace
tailor-sdk tailordb erd serve --namespace myNamespace

# Serve with custom workspace
tailor-sdk tailordb erd serve --workspace-id my-workspace-id

Requirements

The serve package must be installed:
npm install serve
# or
pnpm add serve

tailordb erd deploy

Deploy ERD static website for TailorDB namespace(s) to the Tailor Platform.
tailor-sdk tailordb erd deploy [options]

Options

--workspace-id
string
default:"-w"
Workspace ID for the operation
--profile
string
default:"-p"
Workspace profile to use
--config
string
default:"tailor.config.ts"
Path to SDK config file
--namespace
string
default:"-n"
TailorDB namespace name (optional - deploys all namespaces with erdSite if omitted)
--json
boolean
default:"false"
Output deployment results as JSON

How It Works

  1. Builds ERD artifacts for the specified namespace(s)
  2. Uploads the static files to the configured static website
  3. Returns the deployed URL

Configuration

Configure erdSite in tailor.config.ts for each namespace you want to deploy:
export default defineConfig({
  db: {
    myNamespace: {
      files: ["./tailordb/*.ts"],
      erdSite: "my-erd-site-name", // Static website name for ERD deployment
    },
  },
});
The erdSite value must match a static website name defined in your workspace.

Examples

# Deploy ERD for all namespaces with erdSite configured
tailor-sdk tailordb erd deploy

# Deploy ERD for a specific namespace
tailor-sdk tailordb erd deploy --namespace myNamespace

# Deploy with JSON output
tailor-sdk tailordb erd deploy --json

# Deploy to specific workspace
tailor-sdk tailordb erd deploy --workspace-id my-workspace-id

Output

On success, the command displays:
ERD site "my-erd-site-name" deployed successfully.
https://my-erd-site-name.workspace.tailorplatform.dev

Complete Workflow Example

1. Configure ERD Site

Add erdSite to your TailorDB namespace configuration:
// tailor.config.ts
export default defineConfig({
  name: "my-app",
  db: {
    tailordb: {
      files: ["./tailordb/*.ts"],
      erdSite: "tailordb-erd",
    },
  },
});

2. Preview Locally

Generate and serve the ERD locally:
tailor-sdk tailordb erd serve
This opens a local development server where you can preview your ERD.

3. Deploy to Production

Once satisfied with the ERD, deploy it:
tailor-sdk tailordb erd deploy
Your ERD is now accessible at the provided URL.

Requirements

Dependencies

The ERD commands require the following packages:
{
  "dependencies": {
    "@liam-hq/cli": "latest"
  },
  "devDependencies": {
    "serve": "latest"
  }
}
Install them with:
npm install @liam-hq/cli
npm install -D serve
# or
pnpm add @liam-hq/cli
pnpm add -D serve

Configuration

For deployment, you must:
  1. Define erdSite in your db namespace configuration
  2. Ensure the static website exists in your workspace
  3. Have appropriate permissions to deploy to the workspace

Troubleshooting

”No TailorDB namespaces found”

Cause: No db configuration found in tailor.config.ts. Solution: Add TailorDB configuration:
export default defineConfig({
  db: {
    tailordb: {
      files: ["./tailordb/*.ts"],
    },
  },
});

“No erdSite configured for namespace”

Cause: The erdSite property is missing from the namespace configuration. Solution: Add erdSite to your db config:
db: {
  myNamespace: {
    files: ["./tailordb/*.ts"],
    erdSite: "my-erd-site-name",
  },
}

“Failed to run @liam-hq/cli”

Cause: The @liam-hq/cli package is not installed or not found. Solution: Install the package:
npm install @liam-hq/cli
# or
pnpm add @liam-hq/cli

“serve CLI exited with a non-zero code”

Cause: The serve package is not installed or encountered an error. Solution: Install the package:
npm install -D serve
# or
pnpm add -D serve

See Also

Build docs developers (and LLMs) love