@platformatic/watt-admin 0.6.0-alpha.8 β†’ 0.6.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +162 -34
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -1,72 +1,200 @@
1
- # watt-admin
1
+ # πŸ”Œ Watt Admin
2
2
 
3
- ## CLI Tool
3
+ **Real-time monitoring and administration for your Platformatic applications**
4
4
 
5
- The project includes a command-line interface tool to check available Platformatic runtimes.
5
+ Watt Admin is an open-source developer monitoring tool that provides instant visibility into your Node.js services. Monitor performance, analyze logs, and troubleshoot issuesβ€”all from a single, intuitive dashboard.
6
+
7
+ ![Watt Admin Dashboard](https://blog.platformatic.dev/content/images/2025/01/CleanShot-2025-01-15-at-15.50.54@2x.png)
8
+
9
+ ## ✨ Features
10
+
11
+ ### πŸ“Š **Performance Metrics**
12
+ - **Memory tracking**: RSS, heap usage, new/old space allocation with interactive charts
13
+ - **CPU monitoring**: Real-time CPU and event loop utilization
14
+ - **Latency analysis**: P90, P95, P99 percentiles at a glance
15
+ - **Request rates**: Monitor requests per second across all services
16
+
17
+ ### πŸ“ **Centralized Logging**
18
+ - View logs from all services in one place
19
+ - Filter by service or log level
20
+ - Toggle between formatted and raw JSON views
21
+ - Export logs for further analysis
22
+
23
+ ### 🎯 **Service Management**
24
+ - Monitor service status at a glance
25
+ - Drill down into individual service metrics
26
+ - Compare performance across services
27
+ - Restart services directly from the dashboard
28
+
29
+ ### πŸ”₯ **Profiling & Recording** *(New!)*
30
+ - **CPU profiling**: Capture flame graphs to identify performance bottlenecks
31
+ - **Heap profiling**: Analyze memory allocation patterns
32
+ - **Offline analysis**: Generate self-contained HTML bundles for sharing and review
33
+ - **Recording mode**: Capture metrics and profiles over time for post-mortem analysis
34
+
35
+ ## πŸš€ Quick Start
36
+
37
+ ### Using npx (Recommended)
38
+
39
+ Launch Watt Admin with a single command:
40
+
41
+ ```bash
42
+ npx wattpm admin
43
+ ```
44
+
45
+ The dashboard will automatically discover your running Platformatic runtimes and open at `http://localhost:4042`.
6
46
 
7
47
  ### Installation
8
48
 
9
- After installing the project dependencies, you can run the tool directly:
49
+ Install globally for convenient access:
10
50
 
11
51
  ```bash
12
- ./cli.js
52
+ npm install -g @platformatic/watt-admin
13
53
  ```
14
54
 
15
- To run the CLI on a custom port, you can just pass it as an argument with `./cli.js --port 4321`.
55
+ Then run:
16
56
 
17
- To record a flamegraph session, and choose to profile either the `cpu` or the `heap`, you can run the CLI with `./cli.js --record --profile heap`. Once you will stop the process, an HTML one-file bundle will be auto-generated, and you will be able to navigate (even offline) the `watt-admin` app, looking at the flamegraph and at the metrics stored for the whole time you have run the CLI.
57
+ ```bash
58
+ watt-admin
59
+ ```
18
60
 
19
- The tool is also available as a binary when installed globally or linked:
61
+ ## πŸ’‘ Usage
62
+
63
+ ### Basic Usage
64
+
65
+ When you run `watt-admin`, it automatically discovers all available Platformatic runtimes:
20
66
 
21
67
  ```bash
22
- npm link # Link the package locally
23
- watt-runtime # Run the command
68
+ $ watt-admin
69
+ Select a runtime: (Use arrow keys)
70
+ ❯ my-app (PID: 12345) (Started at 3/10/2025, 10:00:00 AM)
71
+ api-service (PID: 54321) (Started at 3/10/2025, 9:30:00 AM)
24
72
  ```
25
73
 
26
- ### Usage
74
+ If only one runtime is running, it will be selected automatically.
75
+
76
+ ### Custom Port
27
77
 
28
- The tool automatically discovers all available Platformatic runtimes. If multiple runtimes are found, it will prompt you to select one using an interactive menu.
78
+ Run Watt Admin on a different port:
29
79
 
80
+ ```bash
81
+ watt-admin --port 4321
30
82
  ```
31
- $ watt-runtime
32
- Select a runtime: (Use arrow keys)
33
- ❯ runtime-name (PID: 12345) (Started at 3/10/2025, 10:00:00 AM)
34
- another-runtime (PID: 54321) (Started at 3/10/2025, 9:30:00 AM)
83
+
84
+ ### Recording Mode
85
+
86
+ Capture metrics and profiling data for offline analysis:
87
+
88
+ ```bash
89
+ # Profile CPU usage
90
+ watt-admin --record --profile cpu
91
+
92
+ # Profile heap allocation
93
+ watt-admin --record --profile heap
35
94
  ```
36
95
 
37
- If only one runtime is available, it will be automatically selected.
96
+ When recording, press `Ctrl+C` to stop. Watt Admin will:
97
+ 1. Collect all metrics and profiling data
98
+ 2. Generate a self-contained HTML bundle
99
+ 3. Automatically open the bundle in your browser
100
+
101
+ The generated HTML file contains everything you need for offline analysisβ€”perfect for sharing with your team or reviewing later.
102
+
103
+ ## πŸ—οΈ Development
104
+
105
+ ### Prerequisites
38
106
 
39
- ## Project setup
107
+ - Node.js 18 or higher
108
+ - A running Platformatic runtime to monitor
40
109
 
110
+ ### Setup
111
+
112
+ ```bash
113
+ git clone https://github.com/platformatic/watt-admin.git
114
+ cd watt-admin
115
+ npm install
116
+ cp .env.sample .env
41
117
  ```
42
- npm install && cp .env.sample .env
118
+
119
+ ### Development Mode
120
+
121
+ Auto-reload both backend and frontend on changes:
122
+
123
+ ```bash
124
+ npm run dev
43
125
  ```
44
126
 
45
127
  ### Build
46
128
 
47
- ```
129
+ ```bash
48
130
  npm run build
49
131
  ```
50
132
 
51
- ### Start
133
+ ### Run Tests
52
134
 
53
- ```
54
- npm run start
135
+ ```bash
136
+ # Run all tests
137
+ npm test
138
+
139
+ # Run specific test suites
140
+ npm run test:cli # CLI tests
141
+ npm run test:backend # Backend tests
142
+ npm run test:frontend # Frontend tests
143
+ npm run test:e2e # End-to-end tests
55
144
  ```
56
145
 
57
- ### Dev Mode
58
-
59
- This will auto-reload both the backend and frontend when changes are made.
146
+ ### Project Structure
60
147
 
61
148
  ```
62
- npm run dev
149
+ watt-admin/
150
+ β”œβ”€β”€ cli.js # CLI entry point
151
+ β”œβ”€β”€ lib/ # Core CLI functionality
152
+ β”œβ”€β”€ web/
153
+ β”‚ β”œβ”€β”€ backend/ # Fastify API server
154
+ β”‚ β”œβ”€β”€ frontend/ # React dashboard
155
+ β”‚ └── composer/ # Platformatic Gateway
156
+ β”œβ”€β”€ watt.json # Wattpm configuration
157
+ └── test/ # Test suites
63
158
  ```
64
159
 
65
- ### Navigate the app
160
+ ## 🎯 Use Cases
161
+
162
+ ### Development Workflow
163
+ Monitor your application while developing locally. Instantly see the impact of code changes on performance.
164
+
165
+ ### Debugging Performance Issues
166
+ Use CPU and heap profiling to identify bottlenecks and memory leaks before they reach production.
167
+
168
+ ### Team Collaboration
169
+ Generate offline HTML bundles to share performance data and profiling results with your team.
170
+
171
+ ### Learning and Optimization
172
+ Understand how your services behave under load and optimize based on real data.
173
+
174
+ ## πŸ”— Related Tools
175
+
176
+ For production monitoring and observability, check out [Platformatic Console](https://platformatic.dev/console)β€”the intelligent command center for Platformatic Cloud deployments.
177
+
178
+ ## πŸ“š Documentation
179
+
180
+ - [Platformatic Documentation](https://docs.platformatic.dev)
181
+ - [Watt Admin Blog Post](https://blog.platformatic.dev/introducing-watt-admin)
182
+ - [Platformatic Wattpm](https://docs.platformatic.dev/docs/guides/wattpm)
183
+
184
+ ## 🀝 Contributing
185
+
186
+ Contributions are welcome! Please check out our [contributing guidelines](CONTRIBUTING.md) to get started.
187
+
188
+ ## πŸ“„ License
189
+
190
+ Apache-2.0 License - see [LICENSE](LICENSE) for details.
191
+
192
+ ## πŸ™‹ Support
193
+
194
+ - [GitHub Issues](https://github.com/platformatic/watt-admin/issues)
195
+ - [Discord Community](https://discord.gg/platformatic)
196
+ - [Twitter](https://twitter.com/platformatic)
197
+
198
+ ---
66
199
 
67
- 0. check you started `watt-admin`
68
- 1. you should now see an info log like `Platformatic is now listening at http://127.0.0.1:{PORT}` (open the local URL)
69
- 2. click on link above to navigate the frontend app
70
- 3. you can call the backend by prefixing the local URL with `/api`
71
- 4. call the `/api/runtimes` endpoint (you should receive the PID)
72
- 5. call the `/api/runtimes/{pid}/metrics` endpoint
200
+ Built with ❀️ by the [Platformatic](https://platformatic.dev) team
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@platformatic/watt-admin",
4
- "version": "0.6.0-alpha.8",
4
+ "version": "0.6.0-alpha.9",
5
5
  "scripts": {
6
6
  "prepublishOnly": "npm run clean && npm run build",
7
7
  "dev": "wattpm dev",
@@ -9,12 +9,12 @@
9
9
  "start": "wattpm start",
10
10
  "typecheck": "cd web/backend && tsc && cd ../frontend && tsc",
11
11
  "client:openapi": "cd web/backend && node --experimental-strip-types utils/client.openapi.ts",
12
- "client:generate": "./node_modules/.bin/massimo ./web/backend/openapi.json --name backend --folder web/frontend/src/client --language ts --frontend --full --skip-config-update --props-optional",
12
+ "client:generate": "massimo ./web/backend/openapi.json --name backend --folder web/frontend/src/client --language ts --frontend --full --skip-config-update --props-optional",
13
13
  "test": "npm run test:cli && npm run test:e2e && npm run test:backend && npm run test:frontend",
14
14
  "test:cli": "node --test --experimental-test-module-mocks --test-timeout 60000 test/*.test.ts",
15
15
  "test:backend": "node --test --experimental-test-module-mocks --test-timeout 60000 --test-concurrency 1 web/backend/**/*.test.ts",
16
16
  "test:frontend": "cd web/frontend && vitest run",
17
- "pretest:e2e": "./node_modules/.bin/playwright install chromium",
17
+ "pretest:e2e": "playwright install chromium",
18
18
  "test:e2e": "cd web/frontend && playwright test",
19
19
  "test:e2e:ui": "npm run test:e2e -- --ui",
20
20
  "clean": "rm -rf ./web/*/dist ./playwright-report ./test-results",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@fastify/websocket": "^11.2.0",
26
26
  "@fastify/type-provider-json-schema-to-ts": "^5.0.0",
27
- "@inquirer/prompts": "^7.8.6",
27
+ "@inquirer/prompts": "^8.0.0",
28
28
  "@platformatic/control": "^3.15.0",
29
29
  "@platformatic/gateway": "^3.15.0",
30
30
  "@platformatic/runtime": "^3.15.0",
@@ -72,6 +72,6 @@
72
72
  "vitest": "^3.2.4"
73
73
  },
74
74
  "bin": {
75
- "watt-admin": "./cli.js"
75
+ "watt-admin": "cli.js"
76
76
  }
77
77
  }