Skip to content

A minimal ActivityPub server intended for demonstrating use-cases of ActivityPub and experimenting with ideas.

License

Notifications You must be signed in to change notification settings

miaEngiadina/minimal-ap

Repository files navigation

A minimal ActivityPub server

A minimal ActivityPub server intended for demonstrating use-cases of ActivityPub and experimenting with ideas.

Starting it

Prerequisites:

All prerequisites can be installed via GNU Guix.

guix environment -l guix.scm
./pre-inst-env guile main.scm

Quick tour

Actor

Actor objects can be retrieved with a GET request to the /actors/actor-name endpoint.

For example we can retrieve the actor object for Alice:

GET http://localhost:8080/actors/alice

Inbox

We can retrieve Alice’s inbox (which is currently empty):

GET http://localhost:8080/actors/alice/inbox

Outbox

We can also retrieve Alice’s outbox (also still empty):

GET http://localhost:8080/actors/alice/outbox

Posting an activity

Alice can post a note by making a POST request to her outbox.

For example she can post a very simple note (addressed to Bob and the special public collection):

POST http://localhost:8080/actors/alice/outbox
Content-type: application/json
{
  "type": "Create",
  "to": [ "http://localhost:8080/actors/bob",
          "https://www.w3.org/ns/activitystreams#Public"],
  "object": {
    "content": "Hello World!",
    "type": "Note"
  }
}

Note that the note was wrapped in a create activity and attributed to Alice.

The activity is now placed in Alice’s outbox:

GET http://localhost:8080/actors/alice/outbox

In Bob’s inbox:

GET http://localhost:8080/actors/bob/inbox

And also in the special public collection:

GET http://localhost:8080/public

The created object can also be access directly by dereferencing the id:

GET http://localhost:8080/objects/1

Liking an activity

Previously Alice has posted a note, which is now accessible as an object:

GET http://localhost:8080/objects/1

Bob can Like this note by posting a “Like” activity refering to the note:

POST http://localhost:8080/actors/bob/outbox
Content-type: application/json
{
  "type": "Like",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "object": "http://localhost:8080/objects/1"
}

GET http://localhost:8080/actors/bob/liked

Limitations

  • There is no authentication or authorization
  • It is not performant
  • It is pretty easy to make it crash

This is mostly intended to explore ideas around how an ActivityPub Server can be implemented and is only suited for experimentaiton and demonstration.

About

A minimal ActivityPub server intended for demonstrating use-cases of ActivityPub and experimenting with ideas.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published