npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

serverless-boilerplate-graphql

v0.0.3

Published

The Serverless GraphQL Application Boilerplate

Downloads

9

Readme

Serverless GraphQL Architecture Application Boilerplate

Serverless GraphQL Boilerplate

serverless

This boilerplate application features a serverless architecture that leverages new technologies (Lambda, GraphQL) to reach a very low total cost of ownership (i.e., least amount of code, administration, cost).


Setup

If you haven't yet installed serverless on your machin, run:

npm install -g serverless

then install the GraphQL Boilerplate in the CWD by running:

sls project install serverless-boilerplate-graphql
cd serverless-boilerplate-graphql

Back

Add the authTokenSecret variable to _meta/variables/s-variables-STAGE-REGION.json and give it a strong value. This is the secret used to generate JSON web tokens. Then:

cd back/api
npm install
sls function deploy --all
sls endpoint deploy --all

Client

Set API_URL in client/src/app/js/actions/index.js. Then:

cd ../../client/src
npm install
npm start

This will runs the client locally. You can then deploy the client to an S3 bucket with:

npm run build
sls client deploy

Deploying to S3 bucket

Make sure you're still in the client/src folder mentioned above, then run:

npm run build
sls client deploy

Testing With A Local DynamoDB Instance

  • Install Docker
  • Run docker-compose up to install and run DynamoDB.
  • Add the localDynamoDbEndpoint variable with the value http://<DOCKER-MACHINE-IP>:8000 to _meta/variables/s-variables-common.json. Example value: http://192.168.99.100:8000.
  • Run sls setup db -s <stage> -r <region> to create tables in the local DynamoDB instance.
  • Run sls offline start to start the offline server.

Testing With GraphiQL

If you're running OSX, you can use the GraphiQL Electron App to test the GraphQL backend without a client:

  • Install brew cask for easy installation: brew tap caskroom/cask
  • Install GraphiQL App: brew cask install graphiql
  • Open GraphiQL application. Just search for GraphiQL using OSX Spotlight Search!
  • Add your data endpoint to the "GraphQL Endpoint" text field, and make sure the "Method" is set to POST.
  • Try this mutation to create the first user:
mutation createUserTest {
  createUser (username: "serverless", name: "Serverless Inc.", email: "[email protected]", password: "secret") {
    id 
    username 
    name 
    email  
  }
}
  • Now list all users using the following query:
query getUsersTest { 
  users {
    id
    username
    name
    email
  } 
}
  • You should get the user you just created:
{
  "data": {
    "users": [
      {
        "id": "aca42ee0-f509-11e5-bc11-0d8b1f79b4b9",
        "username": "serverless",
        "name": "Serverless Inc.",
        "email": "[email protected]"
      }
    ]
  }
}

Team Workflow with Meta Sync Plugin

This boilerplate includes the Meta Sync Plugin. To start using it you need to add the following serverless variables to _meta/variables/s-variables-common.json:

"meta_bucket" : "SOME_BUCKET_NAME",
"meta_bucket_region" : "us-east-1" // or any other region

Team