Code Monkey home page Code Monkey logo

activitypods's Introduction

SemApps Chat

activitypods-small

ActivityPods

Check out our website or these slides (french version) for more information about this project !

Note: the next version of ActivityPods, currently in alpha stage, is available in the next branch.

Frontends using ActivityPods

Pods providers

Available bots

Utilities

Getting started

Launch the triple store

docker-compose up -d fuseki

Launch the boilerplate

yarn install
yarn run bootstrap
cd boilerplate
yarn run dev

Launch the frontend

cd frontend
yarn install
yarn start

Quick guide

Create an actor with a POD

POST /auth/signup HTTP/1.1
Host: localhost:3000
Content-Type: application/json

{
    "name": "Alice",
    "username": "alice",
    "email": "[email protected]",
    "password": "test"
}

This will create an ActivityPub actor on http://localhost:3000/alice (viewable by everyone) and a Solid POD on http://localhost:3000/alice/data.

You will receive in return a JWT token to authenticate the newly-created user on subsequent requests.

{
    "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
    "webId": "http://localhost:3000/alice",
    "newUser": true
}

If you need to login again with the same user, you can use the /auth/login endpoint with the username and password.

Post a resource in a container

Upon actor creation, several LDP containers have been automatically created on the http://localhost:3000/alice/data POD: /profiles, /events, /places.

You can now post an event on the /events container, following the LDP specification.

POST /alice/data/events HTTP/1.1
Host: localhost:3000
Content-Type: application/ld+json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...

{
    "@context": "https://www.w3.org/ns/activitystreams",
    "type": "Event",
    "name": "Birthday party !"
}

The URL of the newly-created event will be returned in the Location header of the response.

Location: http://localhost:3000/alice/data/events/61a0f897e5b88b06f85b1190
Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"

By default, this event is only visible by yourself (you can do a GET with the JWT token).

Post an activity in the outbox

The created actor has everything needed to exchange with other ActivityPub actors.

You can announce the new event using the ActivityPub outbox:

POST /alice/outbox HTTP/1.1
Host: localhost:3000
Content-Type: application/ld+json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...

{
    "@context": "https://www.w3.org/ns/activitystreams",
    "type": "Announce",
    "actor": "http://localhost:3000/alice",
    "object": "http://localhost:3000/alice/data/events/61a0f897e5b88b06f85b1190",
    "to": "https://www.w3.org/ns/activitystreams#Public"
}

Since this activity is public, anyone will be able to view it on the outbox. But you could of course have sent it only to selected users, in which case it will have been sent to their inboxes.

GET /alice/outbox?page=1 HTTP/1.1
Host: localhost:3000
Accept: application/ld+json

{
    "@context": "http://localhost:3000/_system/context.json",
    "id": "http://localhost:3000/alice/outbox?page=1",
    "type": "OrderedCollectionPage",
    "partOf": "http://localhost:3000/alice/outbox",
    "orderedItems": [{
        "id": "http://localhost:3000/alice/data/activities/61b72a9cc7ff2f4bbb85606b",
        "type": "Announce",
        "actor": "http://localhost:3000/alice",
        "object": "http://localhost:3000/alice/data/events/61a0f897e5b88b06f85b1190",
        "published": "2021-12-13T11:12:28.943Z",
        "to": "as:Public"
    }],
    "totalItems": 1
}

Linking to SemApps packages

To modify packages on the SemApps repository and see the changes before they are published, we recommend to use yarn link.

Linking middleware packages

cd /SEMAPPS_REPO/src/middleware
yarn run link-all
cd /ACTIVITYPODS_REPO
yarn run link-semapps-packages

Linking frontend packages

cd /SEMAPPS_REPO/src/frontend
yarn run link-all
cd /ARCHIPELAGO_REPO/frontend
yarn run link-semapps-packages

Additionally, frontend packages need to be rebuilt, or your changes will not be taken into account by Archipelago. You can use yarn run build to build a package once, or yarn run dev to rebuild a package on every change.

Deployment to production

Follow the guide here.

Integration tests

yarn install
yarn run bootstrap
docker-compose up -d fuseki_test
cd tests
yarn run test

Funding

This project is funded through the NGI0 Entrust Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet program, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 101069594. Learn more on the NLnet project page.

NLNet foundation logo NGI Zero Entrust Logo

activitypods's People

Contributors

srosset81 avatar thieflord06 avatar laurin-w avatar andreipopa-who avatar danielegobbetti avatar lawhacknifemi avatar arriette avatar

Stargazers

Damon O avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.