Guide · 01

Run Flower in five minutes.

Build the server, start one node, deploy an app and call it.

Before you beginNode.js 22.18+Rust 1.96+A C compiler

1. Build Flower

Clone and build the SDK and server.

Terminal · repository root
git clone https://github.com/flower-js-org/runtime.git
cd runtime
npm ci
npm run build
cargo build --release --bin flower

2. Start a node

Pick an operator token and use it in every terminal.

Terminal 1
export FLOWER_ADMIN_TOKEN='local-development-secret'
./target/release/flower \
  --id 1 \
  --listen 127.0.0.1:7101 \
  --data .flower/node1

3. Initialize and deploy

In a second terminal, initialize, check for a leader, and deploy the example app.

Terminal 2
export FLOWER_ADMIN_TOKEN='local-development-secret'
node sdk/cli.ts init --members 1=127.0.0.1:7101

# Check that the initial election has produced a leader.
curl -fsS -H "Authorization: Bearer $FLOWER_ADMIN_TOKEN" \
  http://127.0.0.1:7101/raft/metrics

node sdk/cli.ts deploy examples/orders.ts
  • Deploy once metrics show state: "Leader". UNAVAILABLE means the election is still settling; retry.
  • Run init only on a fresh cluster, never on a restarted data directory.
  • Callers of your methods don't need the operator token.

4. Call a method

Create an order, read it, change it and watch it.

Terminal 2
node sdk/cli.ts call order.create @examples/orders.create.json \
  --request-id create-order-42
node sdk/cli.ts call order.get '"order-42"'
# value: { order: { shippingCents: 500 }, subtotal: 3200, total: 3700 }

node sdk/cli.ts mutate order.updateLine @examples/orders.update.json \
  --request-id update-line-2
node sdk/cli.ts query order.get '"order-42"'
# value: { order: { shippingCents: 500 }, subtotal: 4600, total: 5100 }

node sdk/cli.ts watch order.get '"order-42"'
  • If a mutation times out, retry with the same --request-id.
  • watch prints the value, then each change. It can skip intermediate commits. Stop it with Ctrl+C.

Next: try the terrarium

With the node still running, deploy the app from the homepage walkthrough and run its client:

Terminal 2 · repository root
node sdk/cli.ts deploy docs/terrarium.ts --initialization static
node docs/terrarium-client.ts

It plants a seed in a shared, public garden (twelve spots) and watches it. Timers bloom the seed after 5 seconds and remove it after 35; timers mean “not before”, so downtime can delay them. Source: application and client.

Next: write an application, call and retry methods, read and watch, or run a three-node cluster.