nongrata081 / devkit

development kit for dev workflow optimisation
0 stars 0 forks source link

study graphql #126

Open nongrata081 opened 5 years ago

nongrata081 commented 5 years ago

Youtube talks

Takeouts:

  1. Was developed @Facebook in order to make mobile (and web) apps faster
    • by reducing amount of http calls to be made (an average time for a roundtrip to a rest resource was ~12 sec, multiplied by number of nested levels for nested requests), since on mobile phones given the mobile networks making nested http requests could take up to ~60 seconds and more.

Benefits:

  1. Speed Get all data client needs with 1 request (same dome with REST with multiple requests only, which means the app is slower & less responsive to the user - since more time of awaiting for data, while multiple http roundtrips are done via rest).
  2. Static types (type system on client) (enables static code analysis & type checks in code edit time). While TS doesn't give type safety, as is only applicable to client, not what server sends.
  3. Clean syntax Much cleaner & intuitively understandable syntax compared to other query languages (e.g. SQL). With gql you specify query which is a data tree you want to get, and get json object in response. Compare a complex SQL query to a complex GQL query.
  4. Flexibility with which data you get (every field is a function, which can have arguments) composition of types with ... notation
  5. Freedom aliases - you can specify an alias under which you will get fields, which might be specified as functions with arguments
  6. Agility With GQL models are being stored on the client, what drops the need for syncing the local and remote state (data on the client & on the server). Previously models were stored on the server, and client had to fetch them first. Then, after changing the data anyhow, client had to update server with the new changed data.
  7. Auto-documented code (documentation generated from type system).
  8. Code generation (generate model objects from types)
  9. IDE integration (syntax highlighting, context-sensitive type-aheads, validation)

GraphQL concepts

36 Concepts Every GraphQL Developer Should Know

Specs

Server

Client

Best Practices

nongrata081 commented 5 years ago

Study apollo vs relay

nongrata081 commented 5 years ago

study apollo pagination

nongrata081 commented 5 years ago

study graphql subscriptions

nongrata081 commented 5 years ago

graphql codegen & others

extract items & convert into issues to this repo from

https://habr.com/ru/company/ruvds/blog/456340/

nongrata081 commented 5 years ago

existing graphql apis

https://github.com/APIs-guru/graphql-apis

nongrata081 commented 5 years ago

consider adding swagger-to-graphql

https://github.com/yarax/swagger-to-graphql

https://github.com/IBM/openapi-to-graphql

nongrata081 commented 5 years ago

add graphql related schematics

https://apis.guru/

nongrata081 commented 5 years ago

add schematics for graphql stuff

https://nordicapis.com/10-awesome-tools-and-extensions-for-graphql-apis/

nongrata081 commented 5 years ago

study & consider cf workers + gql on the edge

https://github.com/alber70g/cloudflare-graphql-ts https://workers.cloudflare.com/ https://cloudflareworkers.com/#12a9195720fe4ed660949efdbd9c0219:https://tutorial.cloudflareworkers.com

  1. less waterfall queries from the frontend. This is especially useful for mobile devices or emerging markets where internet connections aren’t as good as in the west
  2. with this approach, anyone can make a /graphql endpoint for a third-party api without exposing api-keys to the frontend (which would be the case when you implement graphqljs=schema+resolvers in the client)
  3. since GraphQL works with POST method, you cannot cache this with a regular CDN. With CF workers you can create a cache based on this
nongrata081 commented 5 years ago

https://stackblitz.com/@kamilkisiela

https://medium.com/the-guild/loona-state-management-graphql-77baf6734f1

https://stackblitz.com/edit/angular-loona-sample

https://stackblitz.com/edit/loona-angular-example

https://www.youtube.com/watch?v=479WD8OCTfs

nongrata081 commented 5 years ago

https://github.com/Soluto/graphql-to-mongodb

nongrata081 commented 5 years ago
nongrata081 commented 5 years ago
nongrata081 commented 5 years ago

REST Star Wars API

GraphQL Star Wars API:

GraphQL schema and server wrapping SWAPI

Angular Apollo Client with NestJs Graphql Server

nongrata081 commented 5 years ago

Build a GraphQL Server with NestJS and MongoDB

nongrata081 commented 5 years ago

study https://github.com/nongrata081/devkit/issues/142