Select the types of activity you want to include in your feed.
flora is a fast and secure runtime that lets you write discord bots for your servers, with a rich TypeScript SDK, without worrying about running infrastructure. [mirror]
···4455# CLI
6677-The Flora CLI manages deployments, logs, and KV stores against the runtime API.
88-99-## Install or run
1010-1111-From the repo root:
1212-1313-```bash
1414-pnpm --filter @uwu/flora-cli run dev -- --help
1515-```
77+:::info
88+Currently the CLI is unpublished. It will be published soon as `@uwu/flora-cli`.
99+:::
16101717-To build the local CLI:
1818-1919-```bash
2020-pnpm --filter @uwu/flora-cli run build
2121-```
1111+The Flora CLI manages deployments, logs, and KV stores with the Flora Server API.
22122323-## Auth and config
1313+## Login
24142525-- The CLI stores config in a per-user local config file.
2626-- Set `FLORA_API_URL` or pass `--api-url` to point at your runtime.
2727-- Authenticate once with a token:
1515+Generate a API Token at https://app.flora.uwu.network/settings and then login with:
28162917```bash
3018flora login <token>
···34223523### Deploy
36243737-Package a script and deploy to a guild:
2525+To deploy to a guild:
38263927```bash
4040-flora deploy --guild 123456789012345678 path/to/main.ts
2828+flora deploy
4129```
42304343-Deploy with an explicit root (what gets packaged):
4444-4545-```bash
4646-flora deploy --guild 123456789012345678 path/to/main.ts --root path/to
4747-```
3131+- You can add `--guild [guildId]` to specify your guild (it prompts by default).
3232+- A positional arg to specify a custom entrypoint script is also provided if needed.
3333+- Using `--root path/to` allows you to specify a custom root (what gets packaged).
48344935### Get
5036
+3-1
apps/www/docs/examples.md
···4455# Examples
6677-This page covers the common flows end-to-end: prefix commands, slash commands,
77+This page covers the common flows like prefix commands, slash commands,
88subcommands, embeds, KV usage, and deployment via the CLI.
991010## Minimal bot
···168168flora kv get --guild 123456789012345678 --store notes welcome
169169flora kv list-keys --guild 123456789012345678 --store notes
170170```
171171+172172+See the [cli page](/docs/cli) for more info.
+2-2
apps/www/docs/limitations.md
···4455# Limitations
6677-This page documents known limitations and design trade-offs in the flora runtime.
77+This page documents known limitations and design trade-offs you may face in flora's runtime.
8899## Cron Jobs
1010···48484949- **Exactly-once execution** with audit logs
5050- **Catch-up runs** after downtime
5151-- **Non-idempotent side effects** (billing, one-time notifications)
5151+- **Non-idempotent side effects** (webhooks, one-time notifications)
52525353Consider implementing your own persistence layer using the [KV store](/docs/sdk#kv-store) to track execution state:
5454
+1-63
apps/www/docs/runtime.md
···22outline: deep
33---
4455-# Runtime
66-77-Flora Runtime is the Rust service that hosts Discord connectivity, V8 isolates,
88-and the HTTP API that the CLI uses. It bridges Discord events into a single
99-JavaScript runtime per guild and exposes Discord operations to scripts via ops.
1010-1111-## Architecture
1212-1313-Core components:
1414-1515-- Discord client (Serenity) for gateway events and REST calls
1616-- Bot runtime for isolate lifecycle and event dispatch
1717-- Deno Core ops for Discord actions, logging, KV, and command registration
1818-- HTTP API for deployments, logs, KV, and token auth
1919-- Storage: Postgres (deployments, tokens), Redis (sessions/cache), Sled (KV)
2020-2121-## Boot flow
2222-2323-At startup the runtime:
2424-2525-1. Loads config and initializes tracing.
2626-2. Connects to Postgres and runs migrations.
2727-3. Connects to Redis for cache/session storage.
2828-4. Initializes V8 once per process.
2929-5. Loads the SDK bundle into the runtime.
3030-6. Restores cached deployments and starts the Discord client + HTTP server.
3131-3232-## Event flow
3333-3434-1. Discord gateway event arrives.
3535-2. Event payload is serialized and routed to the guild isolate.
3636-3. Handlers registered via `on()` execute.
3737-4. Calls to `ctx.reply`, `ctx.edit`, `registerSlashCommands`, and `kv.*` map to
3838- runtime ops and back to Discord or storage.
3939-4040-## KV store details
4141-4242-KV is scoped per guild and per store name. Stores are backed by Sled on disk
4343-and indexed in Postgres. Runtime constraints:
4444-4545-- Value size max: 1 MB
4646-- Key length max: 512 characters
4747-- Store name max: 64 characters
4848-- List default limit: 100, max 1000
4949-- Optional metadata and expiration per key
5050-- Prefix filtering and cursor-based pagination
5151-5252-## Configuration and services
5353-5454-Required:
5555-5656-- Discord bot token and OAuth client credentials
5757-- Postgres for deployments and tokens
5858-- Redis for cache and auth sessions
5959-6060-Optional:
6161-6262-- KV storage is always available, backed by local disk under `data/kv`
6363-645## Cron scheduler
656667The runtime includes a per-worker cron scheduler that fires every second to check for due jobs. Cron jobs registered via `cron()` in scripts are:
···73147415Cron jobs are cleared automatically when a guild script is redeployed or unloaded.
75167676-## Logs and metrics
7777-7878-The runtime exposes logs via the HTTP API and supports streaming logs via SSE,
7979-which the CLI can follow in real time.
1717+...document others later
+4-5
apps/www/docs/sdk.md
···249249250250- `skipIfRunning`: If `true`, the job won't start a new execution if the previous one is still running. Default: `false`.
251251252252-Cron expressions follow standard 5-field format: `minute hour day-of-month month day-of-week`.
252252+Cron expressions follow the usual standard 5-field format: `minute hour day-of-month month day-of-week`.
253253254254Limits:
255255256256-- Max cron jobs per guild: 32 (configurable via `max_cron_jobs`)
257257-- Handler timeout: 5 seconds (configurable via `cron_timeout_secs`)
256256+- Max cron jobs per guild: 32
257257+- Handler timeout: 5 seconds
258258259259## Utilities
260260···269269270270## Types
271271272272-Types are generated from the Rust runtime and available in the SDK. Use these
273273-when authoring bot scripts and tests outside of the runtime bundle.
272272+Types are automatically generated from the runtime structs using https://github.com/taskylizard/t0x. They are available in the `@uwu/flora-sdk` package, and also globally.