All Projects → Saeris → Apollo Server Vercel

Saeris / Apollo Server Vercel

Licence: mit
⚫ Production-ready Node.js GraphQL server for Vercel Serverless Functions

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Apollo Server Vercel

Graphql Modules
Enterprise Grade Tooling For Your GraphQL Server
Stars: ✭ 962 (+1294.2%)
Mutual labels:  graphql, apollo, graphql-server, apollo-server
now-course
Proyecto para el curso de Now.sh en Platzi
Stars: ✭ 19 (-72.46%)
Mutual labels:  apollo, nextjs, graphql-server, apollo-server
Graphql Cost Analysis
A Graphql query cost analyzer.
Stars: ✭ 527 (+663.77%)
Mutual labels:  graphql, graphql-server, apollo-server
Pup
The Ultimate Boilerplate for Products.
Stars: ✭ 563 (+715.94%)
Mutual labels:  graphql, apollo, graphql-server
Graphql Yoga
🧘 Fully-featured GraphQL Server with focus on easy setup, performance & great developer experience
Stars: ✭ 6,573 (+9426.09%)
Mutual labels:  graphql, graphql-server, apollo-server
Example Storefront
Example Storefront is Reaction Commerce’s headless ecommerce storefront - Next.js, GraphQL, React. Built using Apollo Client and the commerce-focused React UI components provided in the Storefront Component Library (reactioncommerce/reaction-component-library). It connects with Reaction backend with the GraphQL API.
Stars: ✭ 471 (+582.61%)
Mutual labels:  graphql, apollo, nextjs
Chatty
A WhatsApp clone with React Native and Apollo (Tutorial)
Stars: ✭ 481 (+597.1%)
Mutual labels:  graphql, apollo, apollo-server
Graphql Api Gateway
An open-sourced example of a GraphQL API Gateway. This service queries and joins data across different back-ends into one GraphQL schema.
Stars: ✭ 57 (-17.39%)
Mutual labels:  graphql, graphql-server, apollo-server
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 (+437.68%)
Mutual labels:  graphql, apollo, apollo-server
Crypto Grommet
Crypto and equities app
Stars: ✭ 39 (-43.48%)
Mutual labels:  graphql, apollo, nextjs
Graphql Apq
🎯 Automatic persisted queries (APQ) for any GraphQL server.
Stars: ✭ 43 (-37.68%)
Mutual labels:  graphql, apollo, apollo-server
Hackernews React Graphql
Hacker News clone rewritten with universal JavaScript, using React and GraphQL.
Stars: ✭ 4,242 (+6047.83%)
Mutual labels:  graphql, apollo, nextjs
Graphql Up
Get a ready-to-use GraphQL API for your schema
Stars: ✭ 415 (+501.45%)
Mutual labels:  graphql, apollo, graphql-server
Brian Lovin Next
My personal site
Stars: ✭ 522 (+656.52%)
Mutual labels:  graphql, apollo, nextjs
Next Apollo Example
Next & Apollo Example
Stars: ✭ 413 (+498.55%)
Mutual labels:  graphql, apollo, nextjs
Pizzaql
🍕 Modern OSS Order Management System for Pizza Restaurants
Stars: ✭ 631 (+814.49%)
Mutual labels:  graphql, apollo, nextjs
Graphql Advanced Projection
Fully customizable Mongoose/MongoDB projection generator.
Stars: ✭ 46 (-33.33%)
Mutual labels:  graphql, apollo, apollo-server
Graphcms Examples
Example projects to help you get started with GraphCMS
Stars: ✭ 295 (+327.54%)
Mutual labels:  graphql, apollo-server, nextjs
Apollo Upload Examples
A full stack demo of file uploads via GraphQL mutations using Apollo Server and apollo-upload-client.
Stars: ✭ 358 (+418.84%)
Mutual labels:  graphql, apollo, nextjs
Api Platform
Create REST and GraphQL APIs, scaffold Jamstack webapps, stream changes in real-time.
Stars: ✭ 7,144 (+10253.62%)
Mutual labels:  graphql, graphql-server, nextjs

⚫ Apollo Server Vercel

npmtraviscodecov

Production-ready Node.js GraphQL server for Vercel Serverless Functions.


Note: These docs are subject to change, as this library is under construction. Expect things to be broken!

📦 Installation

In an existing application deployable to Vercel (such as create-next-app), add the following to your project's dependencies:

npm install --save @saeris/apollo-server-vercel graphql
# or
yarn add @saeris/apollo-server-vercel graphql

Only clone this repository if you intend to contribute to the development of this library! Please read the Contributing section below for more details.

🔧 Usage

Please read Vercel's documentation on how to deploy a serverless function or if you are using Nextjs, follow their guide on adding API routes. Also note that this library is intended only for use with Vercel's hosting platform. If you intend to deploy a Nextjs app to a different platform, such as Netlify, you will need to use Apollo Server Lambda instead. The API of this library is identical to apollo-server-lambda and as such, switching between the two is as simple as swapping out dependencies and placing your endpoint handler in the appropriate directory.

// Create a new API endpoint handler in the appropriate directory for your project:
// Vercel: ./api/<endpoint-name>.{js|ts}
// Nextjs: ./pages/api/<endpoint-name>.{js|ts} or ./src/pages/api/<endpoint-name>.{js|ts}

import { ApolloServer } from "@saeris/apollo-server-vercel";

// Construct a schema, using GraphQL schema language
const typeDefs = `
  type Query {
    hello: String
  }
`;

// Provide resolver functions for your schema fields
const resolvers = {
  Query: {
    hello: () => 'Hello world!',
  },
};

const server = new ApolloServer({
  typeDefs,
  resolvers,

  // By default, the GraphQL Playground interface and GraphQL introspection
  // is disabled in "production" (i.e. when `process.env.NODE_ENV` is `production`).
  //
  // If you'd like to have GraphQL Playground and introspection enabled in production,
  // the `playground` and `introspection` options must be set explicitly to `true`.
  playground: true,
  introspection: true,
});

export default server.createHandler();

// You should now be able to access your new endpoint from via::
// http://localhost:3000/api/<endpoint-name>

🕹️ Demo

The example under api/example.ts is live at https://apollo-server-vercel.saeris.io/api/example. You can also give it a try via CodeSandbox or locally by cloning this repo, running yarn && yarn start, and then navigate to the URL provided in your terminal (usually http://localhost:3000/api/example).


🏗️ Contributing

If you would like to contribute to the development of this library, feel free to open a pull request! Getting started should be as easy as running git clone https://github.com/Saeris/apollo-server-vercel.git and then npm install or yarn to install dependencies. Please make sure you run yarn test after making any changes to ensure that all of the integration tests pass before submitting your PR.

⚠️ At this time only bug fixes will be accepted!

🧪 Testing

Testing is provided via jest and is pre-configured to run with codecov as well. Tests for this library have been adapted from the official Apollo Server integration tests and they can be found under src/__test__. Additionally, this library uses eslint, typescript, and prettier, all three of which are automatically run on each commit via husky + lint-staged. To manually lint and test, use the following commands:

Lint:

yarn lint

Typecheck:

yarn typecheck

Test and watch for changes:

yarn test:watch

Lint + Typecheck + Test:

yarn test

📣 Acknowledgements

This library is based on apollo-server-lambda and uses integration tests copied from that library as well as apollo-server-integration-testsuite. Huge thanks to all the folks at Apollo for their amazing work!

🥂 License

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