Skip to main content
The flora deploy command packages your TypeScript project and deploys it to a specific Discord guild. The deployment process includes bundling, building, and activating the script on the runtime.

Basic Usage

Deploy a script to a guild:
flora deploy --guild 123456789012345678 src/main.ts
Replace 123456789012345678 with your actual Discord guild ID.

Command Options

Required

  • --guild <guild_id> - Discord guild ID to deploy to
  • <entry_file> - Entry point file (e.g., src/main.ts)

Optional

  • --root <directory> - Project root directory to package (defaults to .)
  • --api-url <url> (or -a) - API URL override

Deployment Process

The CLI performs the following steps:
  1. Package Project - Creates a zip archive of your project files
  2. Upload - Sends the archive to the build service
  3. Build - Bundles and compiles your TypeScript code
  4. Deploy - Activates the new deployment for the guild

Example Output

$ flora deploy --guild 123456789012345678 src/main.ts
Uploading project...
 Upload complete (24 files, 156kb)
Building... (build_abc123)
 Bundling src/main.ts...
 Build completed in 1.2s
 Deployed guild 123456789012345678
 entry: src/main.ts
 updated: 2024-03-15T10:30:45.123Z

Custom Root Directory

By default, the CLI packages the current directory (.). Specify a custom root to package a subdirectory:
flora deploy --guild 123456789012345678 src/main.ts --root packages/bot
This packages files from packages/bot while using src/main.ts as the entry point.

Project Configuration

Avoid repeating options by creating a flora.config.ts file:
flora.config.ts
export default {
  deploy: {
    entry: 'src/main.ts',
    root: '.'
  }
}
With this config, you can deploy with just:
flora deploy --guild 123456789012345678

Build Streaming

The CLI streams build logs in real-time via Server-Sent Events (SSE). If the build takes longer than 60 seconds, the CLI will timeout and provide instructions to follow the build separately.
If the CLI times out during a build, the build continues running on the server. Check the build status manually or wait for the next deployment.

Listing Deployments

View all deployments:
flora list
Example output:
123456789012345678 entry=src/main.ts created=2024-03-15T10:00:00Z updated=2024-03-15T10:30:45Z
987654321098765432 entry=src/bot.ts created=2024-03-14T09:15:00Z updated=2024-03-15T08:20:10Z

Getting Deployment Info

View details for a specific guild deployment:
flora get --guild 123456789012345678
Example output:
Guild 123456789012345678
  entry: src/main.ts
  created: 2024-03-15T10:00:00.000Z
  updated: 2024-03-15T10:30:45.123Z

File Packaging

The CLI automatically packages your project files, excluding:
  • node_modules/
  • .git/
  • Common build artifacts and cache directories
  • Files matching patterns in .gitignore
The packaged zip includes all TypeScript source files and dependencies needed for the runtime to execute your script.

Troubleshooting

Build Failures

If a build fails, the CLI displays the error message:
Error: Build failed: TypeScript compilation error at src/main.ts:42:5
Check your TypeScript code for errors and redeploy.

Authentication Errors

If you see authentication errors, ensure you’ve logged in:
flora login <your_api_token>

Connection Issues

Verify the API URL is correct:
flora --api-url http://localhost:3000/api health

Health Check

Verify the runtime API is accessible:
flora health
This returns the API health status.

Next Steps

View Logs

Monitor runtime logs for your deployments

KV Operations

Store and retrieve data for your bot

Build docs developers (and LLMs) love