洪 民憙 (Hong Minhee)'s avatar
洪 民憙 (Hong Minhee)

@hongminhee@hollo.social

I've been thinking about client-server interactions in the . isn't widely used, and most clients rely on Mastodon-compatible APIs instead.

What if we created a new standardized API based on GraphQL + Relay for client-server communication, while keeping ActivityPub for server-to-server federation?

The Mastodon-compatible API lacks formal schema definitions for code generation and type checking, which hurts developer productivity. And ActivityPub C2S is honestly too cumbersome to use directly from client apps.

would give us type safety, efficient data fetching (only get what you need), and the ability to evolve the API without breaking clients. 's features for pagination, caching, and optimistic updates seem perfect for social apps.

Would this be valuable to our community? What challenges do you see? How might we handle backward compatibility? And should this be formalized as an FEP?

Curious what others think about this approach.

Nik | Klampfradler 🎸🚲's avatar
Nik | Klampfradler 🎸🚲

@nik@toot.teckids.org · Reply to 洪 民憙 (Hong Minhee)'s post

@hongminhee If you are as far as using a graph query language, just use the query standards for Berners-Lee's sake.

@reiver ⊼ (Charles) :batman:'s avatar
@reiver ⊼ (Charles) :batman:

@reiver@mastodon.social · Reply to 洪 民憙 (Hong Minhee)'s post

@hongminhee

Is GraphQL common outside of JavaScript and TypeScript?

.

charlag's avatar
charlag

@charlag@birb.site · Reply to 洪 民憙 (Hong Minhee)'s post

@hongminhee I feel like graphql did not really deliver. it is also generally hard to predict the load with graphql and it adds a bunch of complexity.

it would be great if client API was not just half-documented masto API but something else but it also is preeeetty stable and the schemas were written many times over

Emelia 👸🏻's avatar
Emelia 👸🏻

@thisismissem@hachyderm.io · Reply to 洪 民憙 (Hong Minhee)'s post

@hongminhee I think it goes beyond that: if C2S was actually useful for building applications & didn't require heavy processing on the client, then it'd likely be more used.

But it doesn't define like "give me a chronological feed of all incoming posts" or "give me a chronological feed of all my notifications" or "give me all my follow requests that I haven't accepted or rejected"

Those are application concerns, which to implement with current C2S would mean fetching the entire inbox and/or outbox collection and filtering/reducing that dataset.

The consequence is that you inherently end up with either a backend for frontend (custom API / AppView) or a very heavy and potentially slow client application.

Max Desiatov's avatar
Max Desiatov

@maxd@mastodon.social · Reply to 洪 民憙 (Hong Minhee)'s post

@hongminhee why not OpenAPI? There numerous problems with GraphQL that AFAIR are quite fundamental bessey.dev/blog/2024/05/24/why

marius's avatar
marius

@mariusor@metalhead.club · Reply to 洪 民憙 (Hong Minhee)'s post

@hongminhee I wrote a FEP for wrapping a mechanism similar to graphql (only without all the complexity) on top of C2S for improving collection filtering: codeberg.org/fediverse/fep/src