{"id":25827216,"url":"https://github.com/williamsdevaccount/serverless-graphql-faunadb","last_synced_at":"2026-06-11T11:31:13.688Z","repository":{"id":99609783,"uuid":"106151919","full_name":"williamsdevaccount/serverless-graphql-faunadb","owner":"williamsdevaccount","description":null,"archived":false,"fork":false,"pushed_at":"2019-02-20T01:13:33.000Z","size":54,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-27T21:40:12.836Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/williamsdevaccount.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-08T05:15:34.000Z","updated_at":"2018-09-30T18:38:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"9622ccf9-3b9b-48a4-88c7-547ec93061f0","html_url":"https://github.com/williamsdevaccount/serverless-graphql-faunadb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/williamsdevaccount/serverless-graphql-faunadb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamsdevaccount%2Fserverless-graphql-faunadb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamsdevaccount%2Fserverless-graphql-faunadb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamsdevaccount%2Fserverless-graphql-faunadb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamsdevaccount%2Fserverless-graphql-faunadb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/williamsdevaccount","download_url":"https://codeload.github.com/williamsdevaccount/serverless-graphql-faunadb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamsdevaccount%2Fserverless-graphql-faunadb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34197393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-28T15:55:18.401Z","updated_at":"2026-06-11T11:31:13.654Z","avatar_url":"https://github.com/williamsdevaccount.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Serverless GraphQL Blog AWS Lambda API Gateway](serverless_graphql_blog.png)\n\n[![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com)\n\n# serverless-graphql-blog\n\nThis [Serverless Framework](http://www.serverless.com) Project creates a REST API for a basic blog structure, including Posts, Authors and Comments utilizing [GraphQL][1] and FaunaDB for persistent storage.  The entire REST API consists of only 1 endpoint.\n\nThis project is based on an earlier Serverless demo. You can read about the original version in this [blog post](http://kevinold.com/2016/02/01/serverless-graphql.html).\n\n## Install \u0026 Deploy\n\nMake sure you have the most recent version of the [Serverless Framework](http://www.serverless.com) (1.0 and higher) and you are using NodeV4 or greater.\n\n```\nnpm install serverless -g\n```\n\nClone this repo:\n\n```\ngit clone https://github.com/fauna/serverless-graphql-blog\ncd serverless-graphql-blog\n```\n\nInstall (top level) npm dependencies, and blog level dependencies.\n\n```\nnpm install\ncd blog/\nnpm install\ncd ..\n```\n\nSign up for FaunaDB for free, and configure database and a FaunaDB Server Secret for your application. Do this by visiting http://dashboard.fauna.com/ and creating a database, then browse back to its parent database and select Manage Keys \u003e Create a Key. Then create a key with the `server` role and copy the key secret to your `serverless.yaml` file in place of `SERVER_SECRET_FOR_YOUR_FAUNADB_DATABASE`\n\nNow deploy your service, and make note of the POST endpoint URL it's assigned.\n\n```\nserverless deploy\n```\n\nInvoke the private endpoint for creating the classes and indexes in your FaunaDB database.\n\n```\nserverless invoke --function setupFaunaDB\n```\n\n### Querying with GraphiQL\n\nThe [graphql-js][1] endpoint provided in this Serverless Project is compatible with [GraphiQL][2], a query visualization tool used with [graphql-js][1].\n\nUsage with [GraphiQL.app][3] (an Electron wrapper around [GraphiQL][2]) is recommended and is shown below:\n\n![GraphiQL.app demo](https://s3.amazonaws.com/various-image-files/graphiql-serverless-graphql-blog-screenshot.png)\n\n### Sample GraphQL queries\n\nBefore these queries will have anything to read, you'll want to create an author and some posts, at least. To create an author, visit the Author's class in the FaunaDB dashboard. The URL will look something like: `https://dashboard.fauna.com/db/my-graphql-blog/classes/authors`\n\nClick \"Create Instance\", enter some data like this, and save your author instance.\n\n```json\n{\n  \"name\": \"Chris\",\n  \"id\": \"123\"\n}\n```\n\nNow, you can switch to GraphiQL to run a mutation to create a blog post. Make sure and enter the endpoint URL that came back when you ran `serverless deploy`. Now you can enter a query like this to create a blog post for your author.\n\n```graphql\nmutation createNewPost {\n  post: createPost (id: \"5\",\n    title: \"Fifth post!\",\n    bodyContent: \"Test content\",\n    author: \"123\") { id, title } }\n```\n\nNow that you've created some data, you can run other queries.\n\n#### List of author names\n```graphql\n{ authors { name } }\n```\n\n#### Results\n```json\n{\n  \"data\":{\n    \"authors\":[\n      {\"name\":\"Chris\"}\n    ]\n  }\n}\n```\n\n### List of posts with id and title\n```graphql\n{ posts { id, title } }\n```\n\n#### Results\n```json\n{\n  \"data\": {\n    \"posts\": [\n      { \"id\":\"1\",\n        \"title\":\"First Post Title\"\n      }\n    ]\n  }\n}\n```\n\n#### List of posts with id, title and *nested* author name\n```graphql\n{ posts { id, title, author { name } } }\n```\n\n#### Results\n```json\n{\n  \"data\": {\n    \"posts\": [\n      { \"id\":\"1\",\n        \"title\":\"First Post Title\",\n        \"author\":{\n          \"name\":\"Chris\"\n        }\n      }\n    ]\n  }\n}\n```\n\n#### List of posts with post, author and comments information (for a Post with no comments, i.e. comments:[])\n```graphql\n{ posts { id, title, author { id, name }, comments { id, content, author { name } } } }\n```\n\n#### Results\n```json\n{\n  \"data\":{\n    \"posts\":[\n    {\n      \"id\":\"1\",\n        \"title\":\"First Post Title\",\n        \"author\":{\n          \"id\":\"1\",\n          \"name\":\"Kevin\"\n        },\n        \"comments\":[]\n    }\n    ]\n  }\n}\n```\n\n\n### Sample GraphQL Mutations\n\nThese have been expressed in curl, but you can use GraphiQL instead.\n\n#### Create Post\n```sh\ncurl -XPOST -d '{\"query\": \"mutation createNewPost { post: createPost (id: \\\"5\\\", title: \\\"Fifth post!\\\", bodyContent: \\\"Test content\\\", author: \\\"1\\\") { id, title } }\"}' \u003cendpoint\u003e/dev/blog/graphql\n```\n\n#### Results\n```json\n{\n  \"data\":{\n    \"post\":{\n      \"id\":\"5\",\n      \"title\":\"Fifth post!\"\n    }\n  }\n}\n```\n\n\n#### Mutation Validation\n\nIf your blog post title is too short it will fail. Validations are defined using [graphql-custom-types][4] in [blog/lib/schema.js][5]\n\n```sh\ncurl -XPOST -d '{\"query\": \"mutation createNewPost { post: createPost (id: \\\"8\\\", title: \\\"123456789\\\", bodyContent: \\\"Test content 5\\\") { id, title } }\"}' \u003cendpoint\u003e/dev/blog/graphql\n```\n\n#### Results\n```json\n{\n  \"errors\":[\n  {\n    \"message\":\"Query error: String not long enough\"}\n  ]\n}\n```\n\n\n### Introspection Query\n```sh\ncurl -XPOST -d '{\"query\": \"{__schema { queryType { name, fields { name, description} }}}\"}' \u003cendpoint\u003e/dev/blog/graphql\n```\n\nReturns:\n```json\n{\n  \"data\":{\n    \"__schema\":{\n      \"queryType\":{\n        \"name\":\"BlogSchema\",\n          \"fields\":[\n          {\n            \"name\":\"posts\",\n            \"description\":\"List of posts in the blog\"\n          },\n          {\n            \"name\":\"authors\",\n            \"description\":\"List of Authors\"\n          },\n          {\n            \"name\":\"author\",\n            \"description\":\"Get Author by id\"\n          }\n        ]\n      }\n    }\n  }\n}\n```\n\n### TODOs and Contribution Opportunities\n\n* Currently there is no creation mechanism for comments or authors, so those have to be created via the FaunaDB Dashboard. Adding Mutations for the cases should be straightforward.\n\n* Currently there is no UI for the blog. Maybe there is an existing graphql powered blog frontend that this backend can be adapted to fit?\n\n* Predicate pushdown is missing, so the graphql layer is not taking advantage of all the query capabilities FaunaDB offers. GraphQL and the FaunaDB query language are similar enough that a full-featured FaunaDB graphql layer could potentially combine queries after the resolver has run.\n\n[1]: https://github.com/graphql/graphql-js\n[2]: https://github.com/graphql/graphiql\n[3]: https://github.com/skevy/graphiql-app\n[4]: https://github.com/stylesuxx/graphql-custom-types\n[5]: https://github.com/serverless/serverless-graphql-blog/blob/master/blog/lib/schema.js#L100\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamsdevaccount%2Fserverless-graphql-faunadb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilliamsdevaccount%2Fserverless-graphql-faunadb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamsdevaccount%2Fserverless-graphql-faunadb/lists"}