Skip to content

Aleksander98/aws-serverless-websockets

Repository files navigation

Serverless GraphQL API on AWS with real-time data

Built with SAM, AppSync and TypeScript.

Diagram

Free Tier

This application uses various AWS services and there are costs associated with these services after the Free Tier usage - please see the AWS Pricing page for details.

You are responsible for any AWS costs incurred. No warranty is implied in this example.

Requirements

Installation

In the project root directory, run:

pnpm install

Scripts

  • Rebuild types defined in GraphQL schema (useful during development)

    pnpm run build-schema
    
  • Build resolvers

    pnpm run build-resolvers
    
  • Build all (including SAM template)

    pnpm run build
    

Deployment

  1. Build resolvers and SAM template

    pnpm run build
    
  2. Deploy

    sam deploy --guided --capabilities CAPABILITY_AUTO_EXPAND CAPABILITY_IAM
    

Testing

  1. Create a new user in the Cognito User Pool
  2. Open AppSync in the AWS Console, login and subscribe to "onEvent" AppSync
  3. Go to EventBridge -> Event buses -> events -> Send events and send a test event EventBridge
  4. Go back to AppSync and check the results

Cleanup

Simply run:

sam destroy

License

MIT