A clean ActivityPub implementation in Go [incomplete]
added id property handling
made potential a ServableObject if actual object is servable
added support for inline collection in parseActorInto


browse  log 



You can also use your local clone with git send-email.


This is an experimental project, trying to implement a ActivityPub library for Go, which is more in line with "good" Go style than established implementations.

REMINDER: do not use this library in it's current state! It is neither stable, final, usable or even working.

The following objectives set to make this library easier to use:

  • The ActivityPub specification isn't implemented in a way to make it's use transparent to the library user. For example the Collection struct implements all Collection types from the ActivityStreams specification, toggling being ordered or paged using variables.
  • All AP types should implement the Marshaler interface and the Handler interface. This makes it easy to just serve any object using the default net/http library, but also to implement other protocols.

Using apub, a activity pub server should be easy to implement, without caring too much about the details, or even being able to care about them at all.


REMINDER: These examples do currently not work

var actor = &apub.Actor{
	Type: apub.ActorPerson,
	Name: "Alyssa P. Hacker",
	Outbox: &apub.Collection{Data: myPosts}

http.Handle("/", actor)
http.ListenAndServe(":8080", nil)

This will create a simple Actor named "Alyssa P. Hacker", who's object will be returned when / is requested on the server. Also, all subroutes, such as /inbox and /outbox are automatically created as well.

Note that only the relevant information was specified, such as the actor type, name and the outbox that contains objects from myPosts, which would be some local variable of the type []apub.Object.

Also, the Actor is hostable, meaning that the net/http package recognises it as something that can be requested and that generates a HTTP response.

inbox := make(chan Object)

go func() {
	for obj := range inbox {

http.Handle("/", &apub.Actor{
	Type: apub.ActorOrganization,
	Name: "Example Co.",
	In: inbox
http.ListenAndServe(":8080", nil)

This example differs in that it has no Outbox, but now listens to what it receives from it's inbox. For this purpose, It is using the locally defined inbox channel that is processed in a separate Goroutine. Also "interesting" is that the actor can be passed to http.Handle as a literal object.

// some `actor` exists, as well as `somePostObject`

actor.Do(apub.Create, &apub.Note{
}, apub.FollowersOnly, apub.InReplyTo{somePostObject})

Under the assumption that these variables exist, this provides a easy way to use the Actor-Activity model. We announce that the actor creates a note, and then add a few apub.Option types to modify the action. In this case, the response will only be sent to the followers of actor, and the created note will also contain a response reference.

#To do and issues

  • Finish implementing the structs for all ActivityStreams types
  • Finish implementing all methods for all the structs
  • Finish implementing parsers for all the structs
  • Add tests
  • Make it work