Postgraphql: A GraphQL schema created by reflection over a PostgreSQL schema
github.com
github.com
It ain't GraphQL, and I don't understand GraphQL enough to note functional differences. Postgrest made it extremely easy to serve a more-than-sufficient api for my db though.
Easy to setup, and well documented.
I'm going to start doing some load testing, I'll let you know what I find.
But I don't know how to do it yet.
The real benefit of GraphQL is that it unifies stuff:
- several queries can be masqued as one; - several storages systems can be queried in one shot; - the cache layer can be integrated in the graphql server; - queries can actually no type in any backend and just run code; - the query doesn't hold logic, just data mapping. - queries can propagate events, trigger tasks, etc.
The graphql server is nice because it's an intermediary layer, separating your data manipulation from the rest of the logic in your system.
You definitly don't want you DB to be the only one doing the authentification/permissions nowaday, unless you want to script it to do social auth, OAuth, connect to a ldap, etc.
And you do want to be able to graphql your way into stuff that are not into your db.
GPLv2 was fine. But GPLv3 can make one look for alternatives. AGPL will cause many to simply lose all interest. I suspect GPLv3 is why we see so much MIT/BSD/Apache licensed software these days.
Of course, it's almost impossible to prove IRL, but still, a lot of corporations have problems with that. They want the free open source project to make them earn money, no price to pay.
My use of "real project" was perhaps a little unfair. What I mean is that as soon as you go beyond the simplest requirements of a GraphQL server, a solution like this is going to present more problems than it solves.
I've been thinking about a "Postgres-first" application design for some time, where a thin GraqhQL/REST layer sits on top, and most of the business logic lives in Postgres directly, or operates as a triggered async function (eg; AWS Lambda).
You can setup a cloudfront distribution postgres rds.
Use Postgraphql/postgrest as stateless api layer. I would use a docker container and ECS to keep it horizontally scalable.
Then just whip together a client app that consumes your api.
What you end up with in something like this is the data model is the API. Why not just expose SQL directly at that point? (Rhetorical question)
If you really wanted to get all the comments on a post, for example, you would have to have a flattened "comments" listing (but each comment could have an id and parent id, which you could use to re-build the nested structure on the client)