pfych / web-mentions

Web mention receiver deployed to AWS with serverless
0 stars 0 forks source link
aws-lambda dynamodb serverless webmention webmentions

Web Mentions

Webmention is an open web standard (W3C Recommendation) for conversations and interactions across the web, a powerful building block used for a growing distributed network of peer-to-peer comments, likes, reposts, and other responses across the web.

Implementation of a Webmention receiver built in Typescript. This project uses the serverless framework for Deployment to AWS & uses two DynamoDB tables for storing data. By using these services we can deploy an extremely fast & extremely cheap webmention receiver that can be easily deployed & integrated into existing sites.

Development

pnpm install
PROFILE="aws-profile-name" REGION="ap-southeast-2" pnpm run start

You may have to restart serverless and rerun pnpm run start after making changes.

Deployment

Ensure you have awscli installed on your system & have configured a profile.

Deploy to development environment

pnpm install
PROFILE="aws-profile-name" REGION="ap-southeast-2" pnpm run deploy:dev

Deploy to production environment

pnpm install
PROFILE="aws-profile-name" REGION="ap-southeast-2" pnpm run deploy:dev

Endpoints

Flow and error handling

When making a request to the webmention endpoint the service will return 201 if the base of your request is ok, this response will include a location header which contains a path to view the status of your request.

The server will then fetch the source and target and confirm that both exist and the source mentions the target. If this is successful the status object will update to have the status of SUCCESS and a mention object will be inserted into the database.

The following errors codes exist in the system: