schmaluk / serverlessGraphQL

Boilerplate for serverless/lambda on AWS using Cloud Formation with graphQL as the API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CircleCI tested with jest jest

Please go to Gitlab Repo or use gitlab if you want to use gitlab CI/CD instead of circleCI

Features.


  1. Serverless templates that provide lambda functions hooked up via an API Gateway on AWS with other scalable resorces DynamoDb,S3 bucket etc based on cloud formation templates(Infrastucture As Code- IAC) without any manual intervention to create any resorce needed for the project.
  2. Support for Typescript that compiles to Common js targeting node runtime.
  3. An attempt at unit testablity and test coverage via Jest, this would be focused more heavily on later updates.
  4. Attempts to focus on a simple development structure / flow.
  5. Support for any amount of environments (Dev,Test,Production etc..) replications via Cloud formation templates.
  6. GraphQL api exposed via a single endpoint with the posiblilty to scale via step functions or otherwise in future.
  7. finally CI/CD for all 3 environments (dev,test,production) via Gitlab CI/CD

How to Install & Pre-requisites


Clone project into your local folder.... & then navigate to project on terminal or Shell

npm install -g serverless 

serverless config credentials --provider aws --key $AWS_ACCESS_KEY_ID --secret $AWS_SECRET_ACCESS_KEY

Note that the $AWS_ACCESS_KEY_ID and $AWS_SECRET_ACCESS_KEY here needs to be replaced by credentials given to you by project owner or you may create your own AWS account and IAM role / credentials for programatic access Click here for more info !!!

Install GraphQL Playground optional for easy querying

Getting started


npm install

npm install -g graphql-cli   

npm run deploy-dev 
npm start

To run it locally

Using / Playing around with it...


Initially make sure you have completed steps in both Install & Pre-requisites and in Getting started

npm run deploy-dev 

Copy URL to the lambda function that is output onto the terminal once above command is run Terminal

Then Open GraphQL Playground and Select "URL EndPoint" and paste the Copied URL there GraphQL OpenProject

Then Run

query {
  listEvents {
    id
    name
  }
}

To see if the GraphQL query works as inteded either by returning empty list or list of "events" GraphQLPlayground

Read more on graphQL to learn Queries / Mutations to try out more queries againt the API

About

Boilerplate for serverless/lambda on AWS using Cloud Formation with graphQL as the API

License:Apache License 2.0


Languages

Language:TypeScript 67.2%Language:JavaScript 32.8%