|
| 1 | +# Conductor UI v2 |
| 2 | + |
| 3 | +The open-source React UI for [Conductor](https://github.com/conductor-oss/conductor). It ships as both a **standalone web application** and an **npm library** that enterprise packages can extend via a plugin system. |
| 4 | + |
| 5 | +## Running locally |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +- Node.js 22+ |
| 10 | +- [pnpm](https://pnpm.io/) 10.32.0 (`corepack use pnpm@10.32.0`) |
| 11 | +- A running Conductor server (default: `http://localhost:8080`) |
| 12 | + |
| 13 | +### Setup |
| 14 | + |
| 15 | +```bash |
| 16 | +pnpm install |
| 17 | +``` |
| 18 | + |
| 19 | +Configure the backend URL in `.env` (see `.env` for defaults): |
| 20 | + |
| 21 | +```bash |
| 22 | +VITE_WF_SERVER=http://localhost:8080 |
| 23 | +``` |
| 24 | + |
| 25 | +### Start the dev server |
| 26 | + |
| 27 | +```bash |
| 28 | +pnpm dev |
| 29 | +``` |
| 30 | + |
| 31 | +The app will be available at `http://localhost:1234`. |
| 32 | + |
| 33 | +### Runtime configuration |
| 34 | + |
| 35 | +The app reads runtime config from `public/context.js`, which is loaded at startup (not bundled). Copy the example and edit as needed: |
| 36 | + |
| 37 | +```bash |
| 38 | +cp public/context.js.example public/context.js |
| 39 | +``` |
| 40 | + |
| 41 | +This file sets feature flags (`window.conductor`) and auth config (`window.authConfig`) without requiring a rebuild. |
| 42 | + |
| 43 | +## Available scripts |
| 44 | + |
| 45 | +| Script | Description | |
| 46 | +| --------------------- | ------------------------------- | |
| 47 | +| `pnpm dev` | Start dev server with HMR | |
| 48 | +| `pnpm build` | Build standalone app to `dist/` | |
| 49 | +| `pnpm build:lib` | Build npm library to `dist/` | |
| 50 | +| `pnpm build:all` | Build both app and library | |
| 51 | +| `pnpm lint` | Run ESLint | |
| 52 | +| `pnpm lint:fix` | Run ESLint with auto-fix | |
| 53 | +| `pnpm prettier:check` | Check formatting | |
| 54 | +| `pnpm prettier:write` | Auto-format all files | |
| 55 | +| `pnpm typecheck` | Type-check without emitting | |
| 56 | +| `pnpm test` | Run unit tests | |
| 57 | +| `pnpm test:watch` | Run tests in watch mode | |
| 58 | +| `pnpm test:coverage` | Run tests with coverage report | |
| 59 | + |
| 60 | +## Using as an npm library |
| 61 | + |
| 62 | +Install the package: |
| 63 | + |
| 64 | +```bash |
| 65 | +npm install conductor-ui |
| 66 | +``` |
| 67 | + |
| 68 | +Import styles in your app entry point: |
| 69 | + |
| 70 | +```tsx |
| 71 | +import "conductor-ui/styles.css"; // component styles |
| 72 | +import "conductor-ui/global.css"; // global body/font styles (optional) |
| 73 | +``` |
| 74 | + |
| 75 | +### Extending with plugins |
| 76 | + |
| 77 | +The plugin system lets you register additional routes, sidebar items, task forms, auth providers, and more without modifying the core package. |
| 78 | + |
| 79 | +```tsx |
| 80 | +import { pluginRegistry, App } from "conductor-ui"; |
| 81 | + |
| 82 | +// Register a custom sidebar item |
| 83 | +pluginRegistry.registerSidebarItem({ |
| 84 | + position: { target: "root", after: "definitionsSubMenu" }, |
| 85 | + item: { |
| 86 | + id: "myFeature", |
| 87 | + title: "My Feature", |
| 88 | + icon: <MyIcon />, |
| 89 | + linkTo: "/my-feature", |
| 90 | + shortcuts: [], |
| 91 | + hidden: false, |
| 92 | + position: 350, |
| 93 | + }, |
| 94 | +}); |
| 95 | + |
| 96 | +// Register a custom route |
| 97 | +pluginRegistry.registerRoutes([ |
| 98 | + { |
| 99 | + path: "/my-feature", |
| 100 | + element: <MyFeaturePage />, |
| 101 | + }, |
| 102 | +]); |
| 103 | + |
| 104 | +// Render the app |
| 105 | +function Root() { |
| 106 | + return <App />; |
| 107 | +} |
| 108 | +``` |
| 109 | + |
| 110 | +### Plugin extension points |
| 111 | + |
| 112 | +| Extension | Method | Description | |
| 113 | +| --------------- | ------------------------------ | -------------------------------------------------- | |
| 114 | +| Routes | `registerRoutes(routes)` | Add authenticated routes | |
| 115 | +| Public routes | `registerPublicRoutes(routes)` | Add unauthenticated routes | |
| 116 | +| Sidebar items | `registerSidebarItem(reg)` | Inject items into the sidebar | |
| 117 | +| Task forms | `registerTaskForm(reg)` | Custom forms for task types in the workflow editor | |
| 118 | +| Task menu items | `registerTaskMenuItem(reg)` | Add task types to the "Add Task" menu | |
| 119 | +| Auth provider | `registerAuthProvider(reg)` | Replace the auth implementation | |
| 120 | +| Search provider | `registerSearchProvider(reg)` | Add results to global search | |
| 121 | + |
| 122 | +### Sidebar item positioning |
| 123 | + |
| 124 | +Sidebar items use numeric positions so plugins can inject between core items without collisions. The core OSS positions are exported for reference: |
| 125 | + |
| 126 | +```tsx |
| 127 | +import { CORE_SIDEBAR_POSITIONS } from "conductor-ui"; |
| 128 | + |
| 129 | +// CORE_SIDEBAR_POSITIONS.ROOT: |
| 130 | +// executionsSubMenu: 100 |
| 131 | +// runWorkflow: 200 |
| 132 | +// definitionsSubMenu:300 |
| 133 | +// helpMenu: 400 |
| 134 | +// swaggerItem: 500 |
| 135 | + |
| 136 | +pluginRegistry.registerSidebarItem({ |
| 137 | + position: { target: "root" }, |
| 138 | + item: { |
| 139 | + id: "myItem", |
| 140 | + position: 350, // between definitionsSubMenu (300) and helpMenu (400) |
| 141 | + // ... |
| 142 | + }, |
| 143 | +}); |
| 144 | +``` |
| 145 | + |
| 146 | +## Project structure |
| 147 | + |
| 148 | +``` |
| 149 | +src/ |
| 150 | +├── components/ # Shared UI components |
| 151 | +│ └── Sidebar/ # Sidebar with plugin-injectable menu |
| 152 | +├── pages/ # Route-level page components |
| 153 | +├── plugins/ # Plugin registry and fetch utilities |
| 154 | +├── shared/ # Auth state machine and context |
| 155 | +├── theme/ # MUI theme provider |
| 156 | +├── types/ # Shared TypeScript types |
| 157 | +└── utils/ # Feature flags, constants, helpers |
| 158 | +public/ |
| 159 | +├── context.js # Runtime config (gitignored, not bundled) |
| 160 | +└── context.js.example |
| 161 | +``` |
| 162 | + |
| 163 | +## Peer dependencies |
| 164 | + |
| 165 | +When consuming as a library, the following must be provided by the host app: |
| 166 | + |
| 167 | +- `react` ^18 |
| 168 | +- `react-dom` ^18 |
| 169 | +- `react-router` / `react-router-dom` ^7 |
| 170 | +- `@mui/material`, `@mui/icons-material`, `@mui/system`, `@mui/x-date-pickers` |
| 171 | +- `@emotion/react`, `@emotion/styled` |
0 commit comments