Skip to content

Local Dev: Run plaid locally with docker compose#272

Open
harry-anderson wants to merge 8 commits intomainfrom
local-dev-setup
Open

Local Dev: Run plaid locally with docker compose#272
harry-anderson wants to merge 8 commits intomainfrom
local-dev-setup

Conversation

@harry-anderson
Copy link
Collaborator

@harry-anderson harry-anderson commented Feb 21, 2026

Adds a local development environment for writing and testing plaid rules. Includes a docker-compose setup that builds the runtime from source, compiles WASM modules, and serves webhooks locally.

The companion examples PR (#273) has been merged — this PR provides the runtime changes and local-dev infrastructure those examples depend on.

What's included

local-dev/ directory:

  • Dockerfile - multi-stage build: runtime builder, module builder (Rust WASM target), final runtime image
  • docker-compose.yml - single service with healthcheck on port 8080
  • docker-compose.dev.yml - variant with external module volume mounts for faster iteration
  • Config files (loading.toml, webhooks.toml, apis.toml, etc.) - minimal working config with cranelift backend
  • rules/hello-world/ - example rule that responds to POST /webhook/hello
  • scripts/build-modules.sh - build WASM modules outside Docker
  • scripts/watch-modules.sh - auto-restart on .wasm changes (inotifywait with polling fallback)
  • scripts/test-webhook.sh - quick smoke test
  • README.md - getting started guide

Runtime changes:

  • Add #[serde(default)] to HashMap/Vec config fields in loader, general APIs, and network config so minimal configs parse without empty TOML table boilerplate
  • Add warn!() when log type inference truncates module names at underscores

CI:

  • LocalDevCheck.yml - builds docker-compose, waits for healthcheck, validates health and hello webhook endpoints, tears down

Quick start

cd local-dev
docker compose up --build
curl -X POST http://localhost:8080/webhook/hello -H "Content-Type: application/json" -d '{"name": "world"}'

Adds a complete local development setup for building and testing Plaid
rules without needing the full production infrastructure. Includes
multi-stage Dockerfile (Cranelift backend, no LLVM), working configs,
hello-world example rule, helper scripts, and documentation covering
both local rule development and testing external rules from plaid-rules
or company repos via volume mounts.

Also fixes chrono pulling in wasm-bindgen on wasm32 targets by disabling
default features in plaid-stl, which caused link errors at runtime.
Add #[serde(default)] to HashMap/Vec config fields so minimal
configs work without empty table boilerplate. Warn when log type
inference truncates at underscores. Add docker-compose.dev.yml
for external module mounts and watch-modules.sh for auto-restart.
@harry-anderson harry-anderson changed the title feat: local-dev config defaults, log type warning, dev tooling Run plaid locally with docker compose Feb 22, 2026
@harry-anderson harry-anderson changed the title Run plaid locally with docker compose Local Dev: Run plaid locally with docker compose Feb 22, 2026
@harry-anderson harry-anderson marked this pull request as ready for review February 25, 2026 06:00
# Stage 3: Minimal runtime image

# ── Stage 1: Build plaid runtime ─────────────────────────────────────────────
FROM rust:1.88.0-slim-bookworm AS runtime-builder
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're moving to 1.93 so would update this

/// The limit's default value
pub default: u64,
/// Override values based on log type
#[serde(default)]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/// The limit's default value
default: LimitValue,
/// Override values based on log type
#[serde(default)]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

@obelisk obelisk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple nits. Also want Michele to double check the limitable amounts default serde flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants