Giter Club home page Giter Club logo

firebase-functions-graphql-example's Introduction

GraphQL Server on Cloud Functions for Firebase

Host a GraphQL Server in Cloud Functions for Firebase with ES6+!

Here is the accompanying Medium Post.

This method is markedly simpler than any other GraphQL-on-FaaS method I have seen. No custom packages for GCP or struggling with API Gateway or complex setup instructions for AWS. Just use the most prominent, community drive implementation.

TLDR;

Host your GraphQL Server on Cloud Functions enabling rapid development with GraphQL on a low-cost, auto-scaling web server leveraging Firebase's sweet, sweet developer experience.

Cloud Functions can accept an Express Server object directly, so leverage the Apollo apollo-server-express pacakge to setup our GraphQL server.

The schema and resolvers are the same used in the Apollo example.

Routes

Schema: https://us-central1-<project-name>.cloudfunctions.net/api/schema

GraphiQL: https://us-central1-<project-name>.cloudfunctions.net/api/graphiql

GraphQL: https://us-central1-<project-name>.cloudfunctions.net/api/graphql?<query>

Installation

git clone https://github.com/jthegedus/firebase-functions-graphql-example
cd firebase-functions-graphql-example
yarn install

Local Development

yarn serve

This will serve the Cloud Functions locally using the Firebase emulator.

Deploy to Firebase

yarn deploy

N.B.: Replace <project-name> in the .firebaserc to connect the project to your Firebase project.

A note on Code Compatibility

Everything was tested on Ubuntu 16.04 & Windows 10 with Bash on Ubuntu on Windows. If you wish for Windows native support please submit an issue so we can work on a Windows branch. Please report any macOS errors as I do not have access to a device to test. My development environment can be found here.

firebase-functions-graphql-example's People

Contributors

jthegedus avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.