Collector Configuration
Customize the port, database path, and startup behavior of the collector.
Architecture
Agent (SDK)
POST /events→
Collector
SSE /stream→
Dashboard
Collector↔
SQLite
CLI flags
npx @useaop/collector start [options]| Flag | Default | Description |
|---|---|---|
--port | 4317 | Port to listen on for events, SSE stream, and dashboard |
--db-path | ~/.aop/events.db | Path to the SQLite database file |
--no-open | opens browser | Disable auto-opening the dashboard in the browser on start |
Examples
# Run on a custom port
npx @useaop/collector start --port 9090
# Use a project-local database
npx @useaop/collector start --db-path ./aop-events.db
# Headless mode (no browser)
npx @useaop/collector start --no-open
# Combine options
npx @useaop/collector start --port 9090 --db-path ./data/aop.db --no-openProgrammatic usage
Import and call startCollector() to embed the collector in your own Node.js process:
import { startCollector } from '@useaop/collector'
const server = await startCollector({
port: 4317, // Port to listen on
dbPath: '~/.aop/events.db', // SQLite database path
openBrowser: true // Auto-open dashboard in browser
})Options
| Option | Type | Default | Description |
|---|---|---|---|
port | number | 4317 | Port to listen on |
dbPath | string | ~/.aop/events.db | Path to the SQLite database file |
openBrowser | boolean | true | Whether to open the dashboard in the default browser on start |
Server object
The returned server object exposes:
server.close() // Gracefully shut down the collector
server.port // The actual port the server is listening on
server.dbPath // The resolved database pathEnvironment variables
You can also configure the collector via environment variables. CLI flags take precedence.
AOP_PORT=9090
AOP_DB_PATH=./my-events.db
AOP_NO_OPEN=trueRelated
- Collector overview — what the collector does and how to install it
- API reference — all HTTP endpoints
- AOPClient — configuring the SDK endpoint to point to your collector