@activityplug/cli
v1.0.2
Published
Command-line server for ActivityPlug.
Maintainers
Readme
@activityplug/cli
@activityplug/cli provides the activityplug-server command. The command
starts an ActivityPlug HTTP, GraphQL, and WebSocket server with the Mastodon,
Misskey, Pleroma, Hollo, and HackersPub adapters.
Node.js 26 or newer is required. The package uses ECMAScript modules.
Usage
Run the server without installing it in a project:
npx @activityplug/cli --allow-origin https://social.exampleThe server listens on 127.0.0.1:4000 by default. Each --allow-origin value
must use HTTPS, and the option can be repeated to allow more than one origin.
Omitting it entirely admits every HTTPS origin, which suits a client that
connects to arbitrary Fediverse servers.
The available options are:
--host HOSTsets the nonempty listener hostname. The default is127.0.0.1.--port PORTsets the listener port to an integer from 1 through 65535. The default is4000.--allow-origin ORIGINallows one HTTPS remote origin. The option can be repeated. Omit it to allow every HTTPS origin.--allow-private-networkspermits requests to private and loopback remote addresses. Those origins must still pass the origin policy.--browser-origin ORIGINenables browser BFF routes for a public HTTPS origin.--browser-memory-storesexplicitly selects process-local browser stores. It is required with--browser-originand is intended for development.--trusted-proxy IPtrusts one exact IPv4 or IPv6 proxy address when resolving the browser client's IP address. The option can be repeated and requires--browser-origin.
Run npx @activityplug/cli --help for the generated command reference.
Browser mode
Browser mode requires ACTIVITYPLUG_BROWSER_COOKIE_SIGNING_KEY. Its value must
be unpadded base64url that decodes to at least 32 bytes. The variable is valid
only with --browser-origin.
export ACTIVITYPLUG_BROWSER_COOKIE_SIGNING_KEY="$(
openssl rand -base64 32 | tr '+/' '-_' | tr -d '='
)"
npx @activityplug/cli \
--allow-origin https://social.example \
--browser-origin https://app.example \
--browser-memory-storesThe command supports process-local stores only. Applications that require
durable browser or session storage should configure
createActivityPlugServer() from @activityplug/server instead.
Installation
Install the command when it should run from a project:
pnpm add @activityplug/cliThen invoke the installed binary:
pnpm exec activityplug-server --allow-origin https://social.exampleLicense
Licensed under Apache-2.0 OR MIT. See LICENSE-APACHE and LICENSE-MIT.
