# GraphQL server on Lambda using Relay and Serverless

**URL:** <https://forum.serverless.com/t/graphql-server-on-lambda-using-relay-and-serverless/2268>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [July 11, 2017, 3:04am UTC](https://forum.serverless.com/t/graphql-server-on-lambda-using-relay-and-serverless/2268 "2017-07-11T03:04:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayushg3112](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@ayushg3112](https://forum.serverless.com/u/ayushg3112)\
**Post date:** [July 11, 2017, 3:04am UTC](https://forum.serverless.com/t/graphql-server-on-lambda-using-relay-and-serverless/2268/1 "2017-07-11T03:04:57Z")

</div>

How can I go about created a GraphQL server on AWS lambda through serverless?

I looked at this: [https://github.com/serverless/serverless-graphql-blog](https://github.com/serverless/serverless-graphql-blog)

but this has been made in nodejs v4 and serverless v0.5 which are quite old now.

---

<div class="post-metadata">

**Author:** ![buggy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/buggy/32/177_2.png) [@buggy](https://forum.serverless.com/u/buggy)\
**Post date:** [July 11, 2017, 4:07am UTC](https://forum.serverless.com/t/graphql-server-on-lambda-using-relay-and-serverless/2268/2 "2017-07-11T04:07:55Z")

</div>

> [@ayushg3112](#):
>
> How can I go about created a GraphQL server on AWS lambda through serverless?

I’ve written a few using [http://graphql.org/graphql-js/](http://graphql.org/graphql-js/). In a very simple implementation your handler just need to get the parameters from the event into the `graphql()` function then send the output back to the browser correctly. For most of my implementations I’ve also handled authentication and setup a context there too.

Once you’ve implemented that you’re just writing the schema/resolvers.

There are other options depending your preferred language including

- [GitHub - apollographql/apollo-server: 🌍 &nbsp;Spec-compliant and production ready JavaScript GraphQL server that lets you develop in a schema-first way. Built for Express, Connect, Hapi, Koa, and more.](https://github.com/apollographql/graphql-server)
- [http://graphene-python.org/](http://graphene-python.org/)

---

<div class="post-metadata">

**Author:** ![ayushg3112](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@ayushg3112](https://forum.serverless.com/u/ayushg3112)\
**Post date:** [July 11, 2017, 9:54am UTC](https://forum.serverless.com/t/graphql-server-on-lambda-using-relay-and-serverless/2268/3 "2017-07-11T09:54:04Z")

</div>

@buggy Do you have a sample code by any chance? I’m new to both Lambda and  
GraphQL so having confusions. Working on NodeJS though.

---

<div class="post-metadata">

**Author:** ![HoraceShmorace](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/horaceshmorace/32/1526_2.png) [@HoraceShmorace](https://forum.serverless.com/u/HoraceShmorace)\
**Post date:** [July 11, 2017, 8:57pm UTC](https://forum.serverless.com/t/graphql-server-on-lambda-using-relay-and-serverless/2268/4 "2017-07-11T20:57:08Z")

</div>

I’ve done this for Madison Square Garden: [https://github.com/HoraceShmorace/msg-graphql-api](https://github.com/HoraceShmorace/msg-graphql-api).

This was just a proof of concept for what ended up being a real application, so ignore the fact that the data layer simply relays to a public REST API. A production application should access a database directly.
