|
| 1 | +# Effect DevTools TUI |
| 2 | + |
| 3 | +A terminal user interface (TUI) for Effect DevTools. View traces, spans, metrics, and inspect your Effect applications directly from your terminal! |
| 4 | + |
| 5 | +Built with [OpenTUI](https://github.com/opentui/opentui) and inspired by the [Effect DevTools VS Code extension](../vscode-extension/), but with a more limited feature set focused on observability rather than debugging. |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- 🔍 **Real-time Span Viewer** - View and navigate span traces with expandable tree structure |
| 10 | +- 📊 **Metrics Dashboard** - Monitor counters, gauges, histograms, frequencies, and summaries |
| 11 | +- 👥 **Multi-Client Support** - Connect multiple Effect applications simultaneously |
| 12 | +- ⌨️ **Keyboard Navigation** - Vim-style navigation (j/k) with intuitive shortcuts |
| 13 | +- 🎨 **Split Panel Layout** - Side-by-side view of data and detailed information |
| 14 | +- 🚀 **Lightweight** - Runs in any terminal, no GUI required |
| 15 | + |
| 16 | +## Setup |
| 17 | + |
| 18 | +To use Effect DevTools TUI with your Effect project, first install the required dependency: |
| 19 | + |
| 20 | +```bash |
| 21 | +pnpm install @effect/experimental |
| 22 | +``` |
| 23 | + |
| 24 | +Then add the `DevTools` layer to your Effect application: |
| 25 | + |
| 26 | +```ts |
| 27 | +import { DevTools } from "@effect/experimental"; |
| 28 | +import { NodeRuntime, NodeSocket } from "@effect/platform-node"; |
| 29 | +import { Effect, Layer } from "effect"; |
| 30 | + |
| 31 | +const program = Effect.log("Hello!").pipe( |
| 32 | + Effect.delay(2000), |
| 33 | + Effect.withSpan("Hi", { attributes: { foo: "bar" } }), |
| 34 | + Effect.forever, |
| 35 | +); |
| 36 | + |
| 37 | +program.pipe( |
| 38 | + Effect.provide(DevTools.layer()), |
| 39 | + NodeRuntime.runMain |
| 40 | +); |
| 41 | +``` |
| 42 | + |
| 43 | +### Custom Server URL |
| 44 | + |
| 45 | +If you need to connect to a different host or port: |
| 46 | + |
| 47 | +```ts |
| 48 | +const DevToolsLive = DevTools.layer("ws://your-host:34437"); |
| 49 | +``` |
| 50 | + |
| 51 | +### Docker Setup |
| 52 | + |
| 53 | +When running your Effect app in Docker and connecting to the DevTools TUI on your host machine: |
| 54 | + |
| 55 | +1. Add extra host to your `docker-compose.yml`: |
| 56 | + |
| 57 | +```yaml |
| 58 | +services: |
| 59 | + effect-backend: |
| 60 | + extra_hosts: |
| 61 | + - host.docker.internal:host-gateway |
| 62 | +``` |
| 63 | +
|
| 64 | +2. Configure the DevTools layer to use the Docker host: |
| 65 | +
|
| 66 | +```ts |
| 67 | +const DevToolsLive = DevTools.layer("ws://host.docker.internal:34437"); |
| 68 | +``` |
| 69 | + |
| 70 | +### OpenTelemetry Integration |
| 71 | + |
| 72 | +If you're using `@effect/opentelemetry`, provide the `DevTools` layer **before** your tracing layers to ensure the tracer is patched correctly. |
| 73 | + |
| 74 | +## Comparison with VS Code Extension |
| 75 | + |
| 76 | +This TUI is a lightweight alternative focused on **observability**, not a full replacement for the VS Code extension. |
| 77 | + |
| 78 | +### What's Implemented |
| 79 | + |
| 80 | +- ✅ View Spans/Traces |
| 81 | +- ✅ Span Tree Navigation |
| 82 | +- ✅ Span Details (IDs, attributes, events) |
| 83 | +- ✅ Metrics Viewing |
| 84 | +- ✅ Multi-Client Support |
| 85 | + |
| 86 | +### What's NOT Implemented ❌ |
| 87 | + |
| 88 | +The TUI does **not** support these VS Code extension features: |
| 89 | + |
| 90 | +| Feature | Why Not Available | |
| 91 | +| -------------------------------------- | -------------------------------------------- | |
| 92 | +| **DAP (Debug Adapter Protocol)** | | |
| 93 | +| Fiber Debugging | Requires VS Code DAP integration | |
| 94 | +| Breakpoints on Defects | Requires VS Code DAP integration | |
| 95 | +| Pause/Resume Fibers | Requires VS Code DAP integration | |
| 96 | +| Thread Stopped/Continued Events | Requires VS Code DAP integration | |
| 97 | +| Context Inspection (during debugging) | Requires VS Code DAP integration | |
| 98 | +| Stack Frame Navigation | Requires VS Code DAP integration | |
| 99 | +| Variable Inspection | Requires VS Code DAP integration | |
| 100 | +| **IDE Integration** | | |
| 101 | +| Layer Hover Provider | Requires VS Code Language Server integration | |
| 102 | +| Layer Mermaid Diagrams | Requires VS Code webview + Mermaid extension | |
| 103 | +| Code Navigation (Go to Definition) | Terminal limitation | |
| 104 | +| Interactive Webview Tracer | Requires VS Code webview + React UI | |
| 105 | +| File Reveal/Navigation | Terminal limitation (no clickable links) | |
| 106 | +| **Advanced Features** | | |
| 107 | +| Node.js Instrumentation Injection | Requires VS Code launch configuration | |
| 108 | +| TypeScript Language Server Integration | VS Code specific | |
| 109 | + |
| 110 | + |
| 111 | +## Related Projects |
| 112 | + |
| 113 | +- [Effect](https://effect.website/) - The Effect TypeScript framework |
| 114 | +- [OpenTUI](https://github.com/opentui/opentui) - Terminal UI framework |
| 115 | +- [Effect DevTools VS Code Extension](../vscode-extension/) - VS Code version |
0 commit comments