All Projects → cloudflare → Workers Graphql Server

cloudflare / Workers Graphql Server

Licence: mit
🔥Lightning-fast, globally distributed Apollo GraphQL server, deployed at the edge using Cloudflare Workers

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Workers Graphql Server

Graphql Serverless
Sample project to guide the use of GraphQL and Serverless Architecture.
Stars: ✭ 28 (-89.02%)
Mutual labels:  graphql, apollo, serverless
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 (-27.06%)
Mutual labels:  graphql, apollo
Scalable React Boilerplate
⭐️ Scalable feature-first React micro-framework made for Udacity Alumni collaborative projects
Stars: ✭ 260 (+1.96%)
Mutual labels:  graphql, apollo
Aws Appsync React Workshop
Building real-time offline-ready Applications with React, GraphQL & AWS AppSync
Stars: ✭ 193 (-24.31%)
Mutual labels:  graphql, serverless
Aws App Sync
Easily Deploy AWS AppSync GraphQL APIs Using Serverless Framework Components
Stars: ✭ 261 (+2.35%)
Mutual labels:  graphql, serverless
React Auth App Example
An app example with authentication using Create React App, React, React Router, Apollo, GraphQL, Redux and Redux Form.
Stars: ✭ 179 (-29.8%)
Mutual labels:  graphql, apollo
Next Ecommerce
⚡️ Quantum Ecommerce. Made with Next.js | GraphQL | Apollo Server | Apollo Client | SSR
Stars: ✭ 186 (-27.06%)
Mutual labels:  graphql, apollo
Jamstack Serverless
Learn JAMstack Serverless Modern App Development in Baby Steps using Gatsby.js, React, TypeScript, GraphQL, Contentful, Netlify, FaunaDB, MongoDB, Apollo, Github Actions, Project Fugu, and CSS Houdini.
Stars: ✭ 178 (-30.2%)
Mutual labels:  graphql, serverless
React Native Fullstack Graphql
🚀 Starter projects for mobile applications based on React Native & GraphQL.
Stars: ✭ 208 (-18.43%)
Mutual labels:  graphql, apollo
Commerceql
UNMAINTAINED
Stars: ✭ 217 (-14.9%)
Mutual labels:  graphql, serverless
Modern Graphql Tutorial
📖 A simple and easy GraphQL tutorial to get started with GraphQL.
Stars: ✭ 219 (-14.12%)
Mutual labels:  graphql, apollo
Graphql Deduplicator
A GraphQL response deduplicator. Removes duplicate entities from the GraphQL response.
Stars: ✭ 258 (+1.18%)
Mutual labels:  graphql, apollo
Apollo Cache Redux
Redux cache for Apollo Client 2.0. This project is no longer maintained.
Stars: ✭ 179 (-29.8%)
Mutual labels:  graphql, apollo
Fullstack Boilerplate
Fullstack boilerplate using Typescript, React, GraphQL
Stars: ✭ 181 (-29.02%)
Mutual labels:  graphql, apollo
React Apollo Form
Build React forms based on GraphQL APIs.
Stars: ✭ 178 (-30.2%)
Mutual labels:  graphql, apollo
Autoserver
Create a full-featured REST/GraphQL API from a configuration file
Stars: ✭ 188 (-26.27%)
Mutual labels:  graphql, serverless
Kit
ReactQL starter kit (use the CLI)
Stars: ✭ 232 (-9.02%)
Mutual labels:  graphql, apollo
Sqldatasource
SQL DataSource for Apollo GraphQL projects
Stars: ✭ 176 (-30.98%)
Mutual labels:  graphql, apollo
Ran
⚡ RAN! React . GraphQL . Next.js Toolkit ⚡ - SEO-Ready, Production-Ready, SSR, Hot-Reload, CSS-in-JS, Caching, CLI commands and more...
Stars: ✭ 2,128 (+734.51%)
Mutual labels:  graphql, apollo
Mongoke
Instant Graphql for MongoDb (active branch is golang, rewrite in process)
Stars: ✭ 203 (-20.39%)
Mutual labels:  graphql, serverless

workers-graphql-server

An Apollo GraphQL server, built with Cloudflare Workers. Try a demo by looking at a deployed GraphQL playground.

Why this rules: Cloudflare Workers is a serverless application platform for deploying your projects across Cloudflare's massive distributed network. Deploying your GraphQL application to the edge is a huge opportunity to build consistent low-latency API servers, with the added benefits of "serverless" (I know, the project has server in it): usage-based pricing, no cold starts, and instant, easy-to-use deployment software, using Wrangler.

By the way - as a full-stack developer who loves GraphQL, and the developer advocate for Cloudflare Workers, I would love to see what you build with this! Let me know on Twitter!

Deploy to Cloudflare Workers

Usage

You can begin building your own Workers GraphQL server by installing Wrangler, the Workers command-line tool, and generating a new project:

wrangler generate my-graphql-server https://github.com/signalnerve/workers-graphql-server

You'll need to configure your project's wrangler.toml file to prepare your project for deployment. See the docs ("Configuring and Publishing") for a guide on how to do this. Note that you'll need to find your Cloudflare API keys to set up your config file.

The source for this project includes an example external REST data source, and defined types for the PokeAPI, as an example of how to integrate external APIs.

To start using the project, configure your graphQLOptions object in src/index.js:

const graphQLOptions = {
  baseEndpoint: '/', // String
  playgroundEndpoint: '/___graphql', // ?String
  forwardUnmatchedRequestsToOrigin: false, // Boolean
  debug: false, // Boolean
  cors: true, // Boolean or Object to further configure
  kvCache: false // Boolean
}

Endpoints

Make requests to your GraphQL server at the baseEndpoint (e.g. graphql-on-workers.signalnerve.com/) and, if configured, try GraphQL queries at the playgroundEndpoint (e.g. graphql-on-workers.signalnerve.com/___graphql).

Origin forwarding

If you run your GraphQL server on a domain already registered with Cloudflare, you may want to pass any unmatched requests from inside your Workers script to your origin: in that case, set forwardUnmatchedRequestToOrigin to true (if you're running a GraphQL server on a Workers.dev subdomain, the default of false is fine).

Debugging

While configuring your server, you may want to set the debug flag to true, to return script errors in your browser. This can be useful for debugging any errors while setting up your GraphQL server, but should be disabled on a production server.

CORS

By default, the cors option allows cross-origin requests to the server from any origin. You may wish to configure it to whitelist specific origins, methods, or headers. To do this, change the cors option to an object:

const graphQLOptions = {
  // ... other options ...

  cors: {
    allowCredentials: 'true',
    allowHeaders: 'Content-type',
    allowOrigin: '*',
    allowMethods: 'GET, POST, PUT',
  }
}

Note that by default, any field that you don't pass here (e.g. allowMethods) will fallback to the default value. See utils/setCors.js for the default values for these fields.

REST caching

Version 1.1.0 of this project includes support for caching external requests made via instances of RESTDataSource, using KV. To use caching in your project, create a new KV namespace, and in wrangler.toml, configure your namespace, calling it WORKERS_GRAPHQL_CACHE:

# wrangler.toml

[[kv-namespaces]]
binding = "WORKERS_GRAPHQL_CACHE"
id = "$myId"

With a configured KV namespace set up, you can opt-in to KV caching by changing the kvCache config value in graphQLOptions (in index.js) to true.

License

This project is licensed with the MIT License.

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].