All Projects â†’ lucasconstantino â†’ Graphql Apq

lucasconstantino / Graphql Apq

Licence: mit
🎯 Automatic persisted queries (APQ) for any GraphQL server.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Graphql Apq

React Hipstaplate
A ReactJS full-stack boilerplate based on typescript with ssr, custom apollo-server and huge stack of modern utilities which will help you to start your own project
Stars: ✭ 74 (+72.09%)
Mutual labels:  graphql, apollo, apollo-server, express
Next Graphql Blog
🖊 A Blog including a server and a client. Server is built with Node, Express & a customized GraphQL-yoga server. Client is built with React, Next js & Apollo client.
Stars: ✭ 152 (+253.49%)
Mutual labels:  graphql, apollo, express
Awesome Apollo Graphql
A curated list of amazingly awesome things regarding Apollo GraphQL ecosystem 🌟
Stars: ✭ 126 (+193.02%)
Mutual labels:  graphql, apollo, apollo-server
Sqldatasource
SQL DataSource for Apollo GraphQL projects
Stars: ✭ 176 (+309.3%)
Mutual labels:  graphql, apollo, apollo-server
Apollo Server Vercel
âš« Production-ready Node.js GraphQL server for Vercel Serverless Functions
Stars: ✭ 69 (+60.47%)
Mutual labels:  graphql, apollo, apollo-server
Boilerplate Vue Apollo Graphql Mongodb
Start your magical stack journey!
Stars: ✭ 85 (+97.67%)
Mutual labels:  graphql, apollo, express
Intro To Graphql
[Course] Introduction to GraphQL
Stars: ✭ 175 (+306.98%)
Mutual labels:  graphql, apollo-server, express
Portara
Portara directive is a rate limiter / throttler for GraphQL
Stars: ✭ 158 (+267.44%)
Mutual labels:  graphql, apollo, apollo-server
Tensei
🚀 Content management and distribution with a touch of elegance.
Stars: ✭ 217 (+404.65%)
Mutual labels:  graphql, apollo-server, express
Firestore Apollo Graphql
An example of a GraphQL setup with a Firebase Firestore backend. Uses Apollo Engine/Server 2.0 and deployed to Google App Engine.
Stars: ✭ 371 (+762.79%)
Mutual labels:  graphql, apollo, apollo-server
Graphql Ws
Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client.
Stars: ✭ 398 (+825.58%)
Mutual labels:  graphql, apollo, express
Erxes Api
API for erxes
Stars: ✭ 57 (+32.56%)
Mutual labels:  graphql, apollo, express
Graphql Upload
Middleware and an Upload scalar to add support for GraphQL multipart requests (file uploads via queries and mutations) to various Node.js GraphQL servers.
Stars: ✭ 1,071 (+2390.7%)
Mutual labels:  graphql, apollo, express
Graphql Advanced Projection
Fully customizable Mongoose/MongoDB projection generator.
Stars: ✭ 46 (+6.98%)
Mutual labels:  graphql, apollo, apollo-server
Graphql Modules
Enterprise Grade Tooling For Your GraphQL Server
Stars: ✭ 962 (+2137.21%)
Mutual labels:  graphql, apollo, apollo-server
Next React Graphql Apollo Hooks
React, Apollo, Next.js, GraphQL, Node.js, TypeScript high performance boilerplate with React hooks GraphQL implementation and automatic static type generation
Stars: ✭ 186 (+332.56%)
Mutual labels:  graphql, apollo, express
Hackernews React Graphql
Hacker News clone rewritten with universal JavaScript, using React and GraphQL.
Stars: ✭ 4,242 (+9765.12%)
Mutual labels:  graphql, apollo, express
Chatty
A WhatsApp clone with React Native and Apollo (Tutorial)
Stars: ✭ 481 (+1018.6%)
Mutual labels:  graphql, apollo, apollo-server
Crypto Grommet
Crypto and equities app
Stars: ✭ 39 (-9.3%)
Mutual labels:  graphql, apollo
Api
Stars: ✭ 18 (-58.14%)
Mutual labels:  graphql, apollo-server

GraphQL APQ

Automatic persisted queries made easy.

build status coverage npm version sponsored by Taller


This library consists of a server-side implementation of the persisted queries protocol as presented by the Apollo Engine team.

Apollo Engine is a paid GraphQL gateway with many wonderful tools, and this project brings to the open-source world one of those tools.

Persisted queries was first brought up by the Apollo team, but relied mostly on complicated building process to achieve the full benefit proposed. Automatic persisted queries is a concept built on top of that idea, which allows for persisted queries to be registered in run-time.

How it works

  1. When the client makes a query, it will optimistically send a short (64-byte) cryptographic hash instead of the full query text.
  2. If the backend recognizes the hash, it will retrieve the full text of the query and execute it.
  3. If the backend doesn't recogize the hash, it will ask the client to send the hash and the query text to it can store them mapped together for future lookups. During this request, the backend will also fulfill the data request.

This library is a server implementation for use with any GraphQL server.

You can use any client-side implementation, as long as it follows the same protocol, but we strongly recommend using the apollo-link-persisted-queries project.

Installation

npm install graphql-apq --save

Usage

This project currently provides a core system for handling persisted queries and an express middleware to integrate it to a GraphQL server of choice. It will eventually also provide an extension to the Apollo Server project, as soon as extensions are implemented in that project.

Middleware

import persistedQueries from 'graphql-apq/lib/express'
import express from 'express'
import bodyParser from 'body-parser'
import { graphqlExpress } from 'apollo-server-express'

const schema = // ... define or import your schema here!
const PORT = 3000;

const app = express();

app
  .use('/graphql', bodyParser.json(), persistedQueries(), graphqlExpress({ schema }))
  .listen(PORT)

Options

You can alter some of APQ's default behavior by providing an object of options to the middleware initialization as follows:

cache

A cache object implementing at least the following interface:

interface CacheInterface {
  get: (key: string) => string | null | Promise<string | null>
  set: (key: string, value: string) => void | Promise<void>
  has: (key: string) => boolean | Promise<boolean>
}

Defaults to an instance of memory-cache. Can be modified to provide a more specialized caching system, such as node-redis.

resolveHash

A reducer from an operation to the hash to use. Defaults to retrieving the hash from operation.extensions.persistedQuery.sha256Hash.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].