Show HN: Graphweaver – Instant GraphQL API on Postgres, MySQL, SQLite and More (github.com)
Graphweaver is an open-source GraphQL API Server that can connect many data sources to create a single API. Create a headless CMS, API Gateway, BaaS or use it as a BFF.
48 comments
[ 11.0 ms ] story [ 114 ms ] threadhttps://github.com/exogee-technology/graphweaver/tree/main/s...
We have also added the OpenAPI spec on the roadmap however, every REST API we have integrated so far has been custom.
The REST connector allows you to have full-control over how it connects to the API:
https://github.com/exogee-technology/graphweaver/blob/main/s...
We have also needed to connect to a 2nd or 3rd data source on every project. So the power is when you combine these data sources.
- Graphweaver is not just Postgres, you can run it connected to only MySQL - Graphweaver can connect to one or more datasources. You can even connect both MySQL and Postgres together. Sounds crazy but could be good for a migration. - Graphweaver has two layers the API layer and the Data layer. Both of these are represented by coding classes in Typescript. You have full control over how these are exposed and defined in the entity files. - Graphweaver does not automatically reflect the database. Instead you run an import command in our CLI tool that creates Typescript class files for your database. From there you can edit them as needed.
Looks like you went for the ORM equivalent of the Shadcn/ui approach. "We generate your code so you can customize it" instead of the more traditional "You use a library and can provide options to it to customize it". I like it!
Postgraphile has a bunch of very cool filtering/grouping capabilities (with plugins), would be nice to have that at some point
https://github.com/graphile-contrib/postgraphile-plugin-conn...
and
https://github.com/graphile/pg-aggregates
https://graphweaver.com/docs/filters-and-operators
The aggregates package looks very interesting, we would love to see something similar for Graphweaver.
Not like this varchar can only be these values, but like if this field is X, then field Y can only by these values, and field Z is now required.
Or, if this date has changed, then it must be a week or more in the future.
I will make sure we get this documented.
Is this thing any relevant if I’m using React Server Components to fetch the data from the db directly?
Both great projects, different philosophies.
- We are 100% open source. - Written in Typescript. - We support any data source directly in the server process, either with pre-built data providers or build your own. - We support cross data source filtering (get orders from database with CRM username)
https://discourse.haskell.org/t/hasura-migrating-to-rust/662...
(Disclaimer: Work at Hasura)
https://graphweaver.com/docs/graphql-entities-and-resolvers#...
https://graphweaver.com/docs/adding-local-authentication
https://graphweaver.com/docs/implementing-authorization
https://graphweaver.com/docs/column-level-security
We have deployed Graphweaver using serverless and lambda be interesting to see how we could convert it to multi-tenant.
To some extent, this is kind of reverting to "old times". Back in the day, client applications connected directly to the database and the database handled auth. There is no real reason to not let Javascript apps running in the browser to do that, modulo implementation details (hello popular database with a 100 connection limit out of the box). With that said, I remain unconvinced about whether the modern SPA architecture is the right thing. In a day and age where everyone has gigabit fiber or 5G running over HTTP/3 to a replica of your website hosted in the same city as your ISP, is downloading HTML on every click really that bad compared to making power-savvy devices parse and compile your application every time they visit it?
Compute is the big factor , unless your app needs fast load times to make money like e-commerce, cmses etc the trade off of paying for additional compute on the server side is not worth it .[1]
Today the browser handles most of the app and Auth state token refreshes, inflating data into an UI, a lot of the validations , all these components on the server costs more compute cycles which someone has to pay for.
If is always cheaper for the user than application developer , the app developer is renting every cycle compared to the user who has already bought a powerful device
Same reason Stadia and similar stacks have hard time proving their economic viability, if they are not able to create a large enough market of users who will not buy a high end device but will be ready to pay for a sub for somewhat poorer experience then they fail .
Also from development point of view you would need to likely maintain a separate API anyway for your native mobile apps , building a server rendered [1] app and API is not worth the development cost usually.
[1] SSR and various hydration tooling blur this line ever in favor of SPAs but I am ignoring that to keep the point simple
[2] hardly everyone has always on 5G or fiber access in developed G-20 economies let alone the world , YouTube and dozens app charge for downloading for a reason
We are looking to add more on documentation on this soon and maybe a tutorial series on exactly this.
https://graphweaver.com/docs/implementing-authorization
The auth is at the access control is at the API layer.
https://wundergraph.com/
Graphweaver also generate types and react hooks for the front end, when running `graphweaver watch`. But Graphweaver is a GraphQL API and that is deployed into production. We wrap GraphQL Codegen and also do our own datasource introspection. More on that in this article:
https://dev.to/tnodell/exploring-the-benefits-of-graphql-cod...
There is always more to do and we do accept PRs for improvements!
I'll give this a go with a toy project and see if I can find the edges.
Do you have any performance benchmarks available to compare to other similar tools?
I will add this to the list for us to do.