Ask HN: How can I design a generic library that provides its own endpoints?

1 points by WesSouza ↗ HN
I like how ActivityPub can be implemented on any website and provide a good set of endpoints to enable rich, social-media-like content interactions. I'd love to enable my current website to respond to those requests, but I don't want to either use "activitypub-express" or install a full Mastodon (or any other) server just for myself.

My idea was to implement the protocol myself, which would be a nice way to learn it and its problems. But I would also love to make it a library that can be applied by others on their own, already existing websites.

The problem that I am having is that the current methods to implement this kind of pluggable extension involve connecting to one specific back end framework, such as creating an Express middleware.

What I was thinking was: - Use TypeScript (to leverage the large JS community) - Make it as vanilla as possible - Use fetch standards such as the Request and Response objects, which are available natively since Node 18 - Provide multiple adapters for common frameworks such as Express, Fastify, Next.js, Astro, etc

Is this solved elegantly on any other language or framework?

0 comments

[ 3.2 ms ] story [ 10.2 ms ] thread

No comments yet.