A monorepo for building and running automated trading workflows. It includes:
- Frontend (
apps/frontend) – React + Vite UI with a canvas (React Flow) to assemble trigger/action nodes, manage workflows, and view executions. - Backend (
apps/backend) – Express API with JWT auth, MongoDB persistence, and Zod validation for workflows, users, and nodes. - Executor (
apps/executor) – Worker that polls workflows, evaluates trigger nodes, and executes action nodes (trading logic stubbed for now). - Shared packages (
packages/common,packages/db) – Zod schemas/types, metadata, and Mongoose models reused across apps.
- Create and visualize workflows composed of trigger and action nodes.
- User signup/signin with JWT-based authorization.
- Persist workflows, nodes, and execution history in MongoDB.
- Executor loop that schedules executions (e.g., timer trigger) and runs action handlers.
- Type-safe contracts across services via shared Zod schemas and Mongoose models.
apps/frontend– React UI (Vite). Scripts:bun run dev,bun run build,bun run lint.apps/backend– Express API server. Entry:index.ts.apps/executor– Background worker. Entry:index.ts.packages/common– Shared types/metadata (e.g., workflow schemas, supported assets).packages/db– Mongoose models for users, workflows, nodes, executions.packages/eslint-config,packages/typescript-config– Shared tooling presets.
- Node.js 18+
- Bun 1.3.x
- MongoDB instance (local or remote)
bun installThe workspace is managed with Bun workspaces (see package.json), so a single install at the repo root resolves all app and package dependencies.
Create a .env in each runtime app (apps/backend, apps/executor, apps/frontend) with the values you need. Typical vars:
Backend / Executor:
MONGO_URL=mongodb://localhost:27017/trading-workflows
JWT_SECRET=super-secret-key
PORT=3000 # optional, backend only (defaults to 3000)Frontend:
VITE_API_URL=http://localhost:3000In separate terminals:
# Backend API
cd apps/backend
bun run index.ts
# Executor worker
cd apps/executor
bun run index.ts
# Frontend (runs on Vite default 5173)
cd apps/frontend
bun run dev -- --hostThen open the frontend (http://localhost:5173 by default) and point it to the backend URL via VITE_API_URL.
POST /signup– create userPOST /signin– login, returns JWT tokenPOST /workflow– create workflow (auth required)PUT /workflow/:workflowId– update workflow (auth required)GET /workflow/:workflowId– fetch workflow (auth required)GET /workflows– list user workflows (auth required)GET /workflow/executions/:workflowId– list executions (auth required)GET /nodes– list available node definitions
Requests are validated with Zod schemas from packages/common/types.
- Connects to MongoDB and fetches workflows.
- Detects trigger nodes (e.g.,
timer) and schedules executions. - Runs
executefor downstream action nodes (e.g.,lighter), where trading logic can be implemented (apps/executor/executors/lighter.tscurrently stubbed). - Records execution status and timestamps in the
Executionscollection.
- Use
bun run formatat the repo root to format Markdown/TS/TSX. - Root scripts (
package.json) also includelint,dev,build, andcheck-typesvia Turbo if you add per-package targets. - Shared schemas/types live in
packages/common; reuse them across services to keep API contracts consistent.
- Implement real trading logic in
apps/executor/executors/lighter.ts(and add more action handlers). - Add secure password hashing for auth.
- Seed node definitions in MongoDB for actions/triggers exposed by the UI.
- Add tests and CI for API and executor flows.