October 2021 Summaries
3 posts from Wundergraph
Filter
Month:
Year:
Post Summaries
Back to Blog
GraphQL file uploads can be a complex aspect of GraphQL Federation, but Cosmo makes it seamless with built-in support for storage providers like S3. The five most common approaches to upload files using GraphQL are:
using GraphQL mutations with base64 encoded blobs, using GraphQL mutations with a multipart HTTP Requests, using a separate REST API, using S3, and WunderGraph's Approach using the TokenHandler Pattern with S3 as the storage. Before evaluating different solutions, it's essential to establish metrics for "good" solutions, including complexity of implementation on both client and server, bandwidth overhead, upload speed, portability, no vendor lock-in, security, and ease of implementing business logic after an upload is finished.
The comparison of these options shows that base64 encoding files increases the size of the file by roughly one third, making it unsuitable for large files, while using a separate REST API or S3 can be clean solutions but may add complexity. The WunderGraph Approach using the TokenHandler Pattern with S3 as storage abstracts away the complexity from the developer and relies on open standards, offering a secure solution that balances between developer experience and flexibility without locking users into specific implementations.
Oct 20, 2021
3,056 words in the original blog post.
Twitch.tv uses a batching mechanism for their GraphQL API, sending multiple operations as an array in a single HTTP POST request. This reduces the number of requests and can improve performance. However, this approach also has drawbacks, such as defeating the possibility of HTTP caching and potentially leading to slower perceived user experience. Twitch's API uses HTTP/1.1 instead of HTTP/2, which limits its ability to take full advantage of batching. The use of Automatic Persisted Queries (APQ) does not provide significant benefits in terms of performance. GraphQL Subscriptions are not used for Realtime updates in the Twitch API. To build production-grade GraphQL APIs, it is recommended to use HTTP GET requests over HTTP/2, leveraging cache-control headers and etags to improve performance. Additionally, using a tool like WunderGraph can help validate and compile operations into efficient code at runtime, reducing overhead at runtime.
Oct 14, 2021
3,599 words in the original blog post.
WunderGraph is exploring an innovative approach to building JSON APIs using JSON-Schema validation and GraphQL operations, offering an alternative to traditional GraphQL server implementations. This method utilizes persisted GraphQL operations, which function like stored procedures, allowing for secure, backward-compatible, and version-controlled API interactions. By leveraging JSON-Schema, input and response structures are validated, enhancing security and enabling the generation of type-safe clients across multiple languages. This system facilitates seamless integration of various data sources such as REST, GraphQL, Apollo Federation, PostgreSQL, and MySQL, which are unified into a "virtual graph" that can be exposed through JSON APIs. These APIs are designed to be compatible with existing web infrastructure and tools like Postman, avoiding vendor lock-in and increasing security. The approach also supports building backends for frontends (BFF) rapidly, allowing easy swapping of data sources without disrupting the API contract, thus positioning GraphQL as an orchestration layer rather than just a query language.
Oct 07, 2021
1,529 words in the original blog post.