# distributed-press-social

> API for the Distributed Press Social Inbox

Latest version **1.0.1** (published 2023-11-24) · AGPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install distributed-press-social
pnpm add distributed-press-social
yarn add distributed-press-social
bun add distributed-press-social
```

Provides the command `distributed-press-social`.

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-11-24 |
| First published | 2023-11-23 |
| Weekly downloads | 0 |
| License | AGPL-3.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.0.0 |
| Dependencies | 30 |
| Unpacked size | 217 KB |
| Known vulnerabilities | 0 (+28 in 7 direct dependencies) |
| Install scripts | no |
| Author | Distributed Press |
| Maintainers | rangermauve |

## Links

- npm: https://www.npmjs.com/package/distributed-press-social
- Repository: https://github.com/hyphacoop/social.distributed.press
- Homepage: https://github.com/hyphacoop/social.distributed.press#readme
- Issues: https://github.com/hyphacoop/social.distributed.press/issues
- npm.io page: https://npm.io/package/distributed-press-social

## Dependencies (30)

- [fs](https://npm.io/package/fs.md) 0.0.1-security
- [cors](https://npm.io/package/cors.md) ^2.8.5
- [dns2](https://npm.io/package/dns2.md) ^2.1.0
- [level](https://npm.io/package/level.md) ^8.0.0
- [yargs](https://npm.io/package/yargs.md) ^17.6.2
- [nanoid](https://npm.io/package/nanoid.md) ^4.0.0
- [express](https://npm.io/package/express.md) ^4.17.1
- [fastify](https://npm.io/package/fastify.md) ^4.10.2
- [fast-jwt](https://npm.io/package/fast-jwt.md) ^2.0.2
- [get-port](https://npm.io/package/get-port.md) ^6.1.2
- [make-dir](https://npm.io/package/make-dir.md) ^3.1.0
- [csv-parse](https://npm.io/package/csv-parse.md) ^5.5.0
- [env-paths](https://npm.io/package/env-paths.md) ^3.0.0
- [csv-parser](https://npm.io/package/csv-parser.md) ^3.0.0
- [prom-client](https://npm.io/package/prom-client.md) ^14.1.0
- [@fastify/jwt](https://npm.io/package/@fastify/jwt.md) ^6.5.0
- [@fastify/auth](https://npm.io/package/@fastify/auth.md) ^4.2.0
- [abstract-level](https://npm.io/package/abstract-level.md) ^1.0.3
- [fastify-plugin](https://npm.io/package/fastify-plugin.md) ^4.4.0
- [fast-xml-parser](https://npm.io/package/fast-xml-parser.md) ^4.3.2
- [fastify-metrics](https://npm.io/package/fastify-metrics.md) ^10.0.0
- [@fastify/swagger](https://npm.io/package/@fastify/swagger.md) ^8.2.0
- [@sinclair/typebox](https://npm.io/package/@sinclair/typebox.md) ^0.25.9
- [activitypub-types](https://npm.io/package/activitypub-types.md) ^1.0.3
- [is-valid-hostname](https://npm.io/package/is-valid-hostname.md) ^1.0.2
- [@fastify/multipart](https://npm.io/package/@fastify/multipart.md) ^7.3.0
- [@fastify/swagger-ui](https://npm.io/package/@fastify/swagger-ui.md) ^1.3.0
- [activitypub-http-signatures](https://npm.io/package/activitypub-http-signatures.md) ^2.0.1
- [@fastify/type-provider-typebox](https://npm.io/package/@fastify/type-provider-typebox.md) ^2.4.0
- [@digitalbazaar/http-digest-header](https://npm.io/package/@digitalbazaar/http-digest-header.md) ^2.0.0

## Recent versions

- 1.0.1 (latest) — 2023-11-24
- 1.0.0 — 2023-11-23

## README

# social.distributed.press
A Social Inbox for Decentralized Publishing and ActivityPub

## How it works

This server runs a minimal implementation of an [ActivityPub Inbox and Outbox](https://activitypub.rocks/).

Here's how to use it:

1. Publish a static site that contains your ActivityPub Actor, Outbox, and Posts. You can fork our [staticpub example](https://github.com/RangerMauve/staticpub.mauve.moe/) or use this [Jekyll Plugin](https://0xacab.org/sutty/jekyll/jekyll-activitypub). Make sure you set up the webfinger endpoint!
1. Generate a keypair using either [OpenSSL](https://blog.joinmastodon.org/2018/06/how-to-implement-a-basic-activitypub-server/#$:~:text=keypair) or `npm run generate-keypair` in this repo
1. Add the public key to your ActivityPub Actor
1. Set up the social inbox server somewhere like `httpa://social.example.com`
1. Note the WebMention compatible format of your account like `@username@social.example.com` which will be used as the `username` in parameters
1. Register your ActorInfo by doing a Signed HTTP POST to `/v1/:username/` with JSON that looks like `{actorURL, publicKeyId, keypair: {publicKeyPEM,privateKeyPem}}` to initialize your inbox. The server will use your keypair to sign HTTP requests for activities you send to your outbox. You can also use the `client.setInfo()` API.
1. Set your Actor's `inbox` property to point at `https://yourserver/v1/:username/inbox`
1. Send any Activities you want to notify your followers with by doing a Signed HTTP POST to `/v1/:username/outbox`

Check out the available API endpoints either in the swagger docs at the `https://yourserver/v1/docs/` or in the JS client API in `/src/client/index.js`.

## Development

This project requires Node.js Version 19.x and NPM.
The code is written using TypeScript in the `src` folder which gets compiled into the `dist` folder.

- Run server right from the source: `npm run dev`
- Lint the code to catch common mistakes and maintain code style: `npm run lint`
- Build JS files to `dist`: `npm run build`
- Build and run server: `npm run start`

## Project structure

- `/scripts`: Scripts for doing tasks like importing blocklists/admins or generating keypairs
- `/src/` Main folder for source code
- `/src/server/` Source code for the inbox server
- `/src/server/api/` HTTP routes
- `/src/client/` Implementation of a JS client to talk to the inbox via `fetch`

---
_Source: https://npm.io/package/distributed-press-social · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
