---
title: Workflow
icon: modules
description: Set up, configure, and run the Reloop workflow microservice locally.
---
> For the complete documentation index, see [llms-docs.txt](/llms-docs.txt) or the site index [llms.txt](/llms.txt). Full docs corpus: [llms-full-docs.txt](/llms-full-docs.txt). Prefer markdown URLs (append `.md`) for agent consumption. Product skill: [skill.md](/skill.md).


Marketing automation — drip campaigns, delays, and multi-step journeys via BullMQ.

<Tip>
Run [`bun setup`](/docs/setup) once from the monorepo root. Env files come from `bun setup` / `bun env:setup`.
</Tip>


## Overview

| Property | Value |
| :--- | :--- |
| **Directory** | `apps/backend/workflow` |
| **Port** | `8017` |
| **Local URL** | [https://local.reloop.sh/api/workflow](https://local.reloop.sh/api/workflow) |
| **Swagger UI** | [https://local.reloop.sh/api/workflow/openapi](https://local.reloop.sh/api/workflow/openapi) |
| **Workbench** | [https://local.reloop.sh/api/workflow/jobs](https://local.reloop.sh/api/workflow/jobs) |
| **Stack** | ElysiaJS · PostgreSQL · Redis · NATS · BullMQ |


## Quick start

```bash
bun be:workflow:dev
```

Or `bun backend:dev` / `bun dev`.


## Environment

`apps/backend/workflow/.env` — from `bun setup` / `bun env:setup`.

```bash
PG_URL=postgresql://reloop:reloop123@localhost:5432/reloop
REDIS_URL=redis://:reloop123@localhost:6379
PORT=8017
BASE_URL="https://local.reloop.sh"
NATS_URL=nats://localhost:4222
NODE_ENV=development
# Optional basic-auth for Workbench (/api/workflow/jobs)
# WORKBENCH_USER=admin
# WORKBENCH_PASS=secret
```

| Variable | Required | Default |
| :--- | :--- | :--- |
| `PG_URL` | **YES** | `postgresql://...` |
| `REDIS_URL` | **YES** | `redis://...` |
| `PORT` | **YES** | `8017` |
| `BASE_URL` | **YES** | `https://local.reloop.sh` |
| `NATS_URL` | **YES** | `nats://localhost:4222` |
| `WORKBENCH_USER` | No | empty (open in dev) |
| `WORKBENCH_PASS` | No | empty (open in dev) |


## Commands

| Command | Description |
| :--- | :--- |
| `bun be:workflow:dev` | Start dev server with hot reloading |
| `bun run --filter=be-workflow build` | Compile production bundle |
| `bun run --filter=be-workflow start` | Run compiled production build |
| `bun run --filter=be-workflow check-types` | TypeScript type-check |


## Architecture

| Layer | Detail |
| :--- | :--- |
| **Triggers** | NATS events (e.g. `contacts.created`) start automation journeys |
| **Execution** | BullMQ `workflow-queue` handles delayed steps and transitions |
| **Integrations** | Reads contacts/templates and triggers sends via [mail](/docs/setup/backend/mail) |
| **Monitoring** | [Workbench](https://getworkbench.dev) UI at `/api/workflow/jobs` |


## Next

<CardGroup cols={2}>
  <Card icon="rocket" title="Setup" href="/setup">
    One-command local bootstrap
  </Card>
  <Card icon="globe" title="Port reference" href="/setup/port">
    Gateway routes and ports
  </Card>
  <Card icon="users" title="Contacts" href="/setup/backend/contacts">
    Trigger source for journeys
  </Card>
  <Card icon="mail-single" title="Mail" href="/setup/backend/mail">
    Sends from workflow steps
  </Card>
</CardGroup>
