···11-## Configuration
11+## Prerequisites
2233-Run `npx @skyware/labeler setup` to convert an existing account into a labeler.
33+- [Node.js](https://nodejs.org/) 21 or later
44+- [Bun](https://bun.sh/)
55+66+## Setup
77+88+Clone the repo and run `bun i` to install the dependencies. This project uses [Bun](https://bun.sh/) for package management.
99+1010+Run `bunx @skyware/labeler setup` to convert an existing account into a labeler. You can exit after converting the account; there's no need to add the labels with the wizard. We'll do that from code.
411512Copy the `.env.example` file to `.env` and fill in the values:
613714```Dotenv
88-DID = "did:plc:xxx"
99-SIGNING_KEY = "xxx"
1010-BSKY_IDENTIFIER = "xxx"
1111-BSKY_PASSWORD = "xxx"
1212-PORT = 4002
1313-FIREHOSE_URL = "ws://localhost:6008/subscribe"
1515+DID=did:plc:xxx
1616+SIGNING_KEY=xxx
1717+BSKY_IDENTIFIER=xxx
1818+BSKY_PASSWORD=xxx
1919+PORT=4002
2020+METRICS_PORT=4102
2121+FIREHOSE_URL=wss://jetstream.atproto.tools/subscribe
2222+CURSOR_UPDATE_INTERVAL=10000
1423```
15241616-A `cursor.txt` also needs to be present with the time in microseconds. If it doesn't exist, it will be created with the current time.
2525+A `cursor.txt` file containing the time in microseconds also needs to be present. If it doesn't exist, it will be created with the current time.
17261818-You can create/update all labels at once by running `npx tsx src/set-labels.ts` once you filled out `src/constants.ts` with the related post rkeys, label IDs and so on.
2727+Fill out `src/constants.ts` with the related post rkeys ([record keys](https://atproto.com/specs/record-key)), label IDs and so on, then run `bunx tsx src/set-labels.ts` to create/update all labels at once.
19282020-Alternatively, you can use `npx @skyware/labeler label add` and edit `src/constants.ts` after.
2929+Alternatively, use `bunx @skyware/labeler label add` and edit `src/constants.ts` after.
21302222-The server connects to [Jetstream](https://github.com/ericvolp12/jetstream) which provides a WebSocket endpoint that emits ATProto events in JSON. There is a public instance available at `wss://jetstream.atproto.tools/subscribe`.
3131+The server connects to [Jetstream](https://github.com/bluesky-social/jetstream), which provides a WebSocket endpoint that emits ATProto events in JSON. There is a public instance available at `wss://jetstream.atproto.tools/subscribe`.
23322424-The server has to be reachable outside your local network using the URL you provided during the account setup (typically, using a reverse proxy such as [Caddy](https://caddyserver.com/)):
3333+The server needs to be reachable outside your local network using the URL you provided during the account setup (typically using a reverse proxy such as [Caddy](https://caddyserver.com/)):
25342635```Caddyfile
2736labeler.example.com {
···2938}
3039```
31403232-## Installation & Usage
4141+Metrics are exposed on the defined `METRICS_PORT` for [Prometheus](https://prometheus.io/). [This dashboard](https://grafana.com/grafana/dashboards/11159-nodejs-application-dashboard/) can be used to visualize the metrics in [Grafana](https://grafana.com/grafana/).
33423434-```sh
3535-pnpm i
3636-```
3737-3838-```sh
3939-pnpm start
4040-```
4343+Start the project with `bun run start`.