Abp: GraphQL Integration

Created on 27 Jul 2017  路  13Comments  路  Source: abpframework/abp

Intro

Modules

Create GraphQL endpoints for all modules.

  • [ ] Identity
  • [ ] Tenant management

Resources

abp-framework feature normal

Most helpful comment

Pick a C# GraphQL library.

@hikalkan Hi,

At the moment the GraphQL-Server library and GraphQL-Conventions are the best on the web. Both libraries writes by Joe McBride and Tommy Lillehagen.

The conventions library allows you to automatically wrap your .NET classes into GraphQL schema definitions using existing property getters and methods as field resolvers. Contains attribute based operation registering, that good for easy to use in application level but needs some customize. We can building a module top of this library.

Server library as you can guess from the library name, this package build Server + WebSockets Transport. If you want to have a html based GraphQL UI of all GraphQL's types (contains all modules schema) in application you need that.

All 13 comments

@hikalkan Hi.
Is it must be a part depended on Abp.Ddd.Application? Can you suggest me for package naming? And where is the best place for this package?

Volo.Abp.GraphQL
-GraphQL (original net core library)
-Volo
--Abp
---GraphQL
Volo.Abp.GraphQL.GraphiQL
-Volo
--Abp
---GraphQL
----GraphiQL

Can I use this solution map?

Actually, I haven't worked much about how ABP can integrate to GraphQL. I don't know yet what Volo.Abp.GraphQL package will provide on top of the GraphQL library. But I believe we can provide some base classes and services to create GraphQL endpoints easier.

Do you have an idea? Can it be integrated to IRepository<TEntity, TKey> for instance?

Is it must be a part depended on Abp.Ddd.Application

Not sure about that.

I suggest you to start with the implementation in your mind and we see what you are trying to do :) For now, I will accept what you contribute. I suggest you to contribute it progressively, a basic implementation at first.

@hikalkan

For now I want to add GraphQL as a ABP MiddleWare, to add the GraphQL implementation as a different part of the Application. Like this we're able to use REST based POST and PUT request to add or update the data and to use the GraphQL to query the data.

I also want that the middleware is listening to the own path like old version of ABP.

Can it be integrated to IRepository for instance?

You need to think about what data you wanna provide and you need to think about how you wanna provide that data then you can build your own repositories for query to QL server.
Using IRepository for building queries not answered in my ZERO project because I haven't good idea about ABP basic repository but i'm sure ABP has created by great team. You can make everything possible.

we're able to use REST based POST and PUT request to add or update the data and to use the GraphQL to query the data

I agree on that. Every module has its own REST APIs. In addition, every module will provide a GraphQL API to provide more elastic and powerful querying.

Pick a C# GraphQL library.

@hikalkan Hi,

At the moment the GraphQL-Server library and GraphQL-Conventions are the best on the web. Both libraries writes by Joe McBride and Tommy Lillehagen.

The conventions library allows you to automatically wrap your .NET classes into GraphQL schema definitions using existing property getters and methods as field resolvers. Contains attribute based operation registering, that good for easy to use in application level but needs some customize. We can building a module top of this library.

Server library as you can guess from the library name, this package build Server + WebSockets Transport. If you want to have a html based GraphQL UI of all GraphQL's types (contains all modules schema) in application you need that.

See also graphql-net and GraphQL.EntityFramework for converting GraphQL queries to EF Core IQueryable.

Take a look at graphql-to-mongodb library for integration with MongoDB.

Those are not official libraries (provided by Microsoft and MongoDB Inc.), but efficient translations from GraphQL queries to IQueryable/Mongo query could be one of the biggest "missing links" when using GraphQL APIs.

I think the best solution would be to write a GraphQL gateway which proxies requests to each module's REST API. Keep in mind that one of the benefits of GraphQL is reduced RTT as you only need a single request. If each module defines it's own GraphQL endpoint it would defeat the purpose of GraphQL.

It would need an efficient way to describe how entities and their APIs are related. Assume I have two entities called Order
and Product defined in separate modules. I should be still able to request an order with all of it's products in a single request. This gateway would have to do it similar to how BFFs do it.

Another issue is that while GraphQL is flexible when it comes to breaking changes, REST APIs are usually not.

Is there any update

I think that currently gRPC is more important to Volosoft than GraphQL and therefore no priority before abp v4.0.
Blazor UI option and support for .NET 5 are top goals for abp v4.0).

@leonkosak writes a good answer, thanks :)

BTW, you can always create GraphQL endpoints for your own application, no restriction.

@hikalkan

For now I want to add GraphQL as a ABP MiddleWare, to add the GraphQL implementation as a different part of the Application. Like this we're able to use REST based POST and PUT request to add or update the data and to use the GraphQL to query the data.

I also want that the middleware is listening to the own path like old version of ABP.

Can it be integrated to IRepository for instance?

You need to think about what data you wanna provide and you need to think about how you wanna provide that data then you can build your own repositories for query to QL server.
Using IRepository for building queries not answered in my ZERO project because I haven't good idea about ABP basic repository but i'm sure ABP has created by great team. You can make everything possible.

@hitaspdotnet Good idea.
I did not worked with graphql more.
Share me if you get integration with abp+mongodb app structure..

Is there any update? 馃槉

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hikalkan picture hikalkan  路  3Comments

wakuflair picture wakuflair  路  3Comments

hikalkan picture hikalkan  路  3Comments

ChangYinShung picture ChangYinShung  路  3Comments

hikalkan picture hikalkan  路  3Comments