Awesome Open Source
Awesome Open Source

Serverless Components


Deploy a Full-Stack Realtime App in seconds using Serverless Components. Just provide your frontend code (powered by the website component), and your backend code (powered by the socket component).

Great use-cases for this project are: Chat Apps, Bots, Notification Systems, Charting Dashboards, Stock Tickers & more. As always, consider a serverless stack like this if you are looking to deliver software or features with extremely low overhead.


  1. Install
  2. Create
  3. Configure
  4. Deploy
  5. Example
  6. Pricing


1. Install

$ npm install -g serverless

2. Create

$ mkdir my-realtime-app && cd my-realtime-app

the directory should look something like this:

|- backend
  |- socket.js
|- frontend
  |- index.html
|- serverless.yml
|- .env      # your AWS api keys

# .env

the socket.js file should minimally look something like this:

on('default', async (data, socket) => {

For more info on working with the socket.js file, check out the socket component docs.

To see a full example of an application built with this, check out this Chat Application.

3. Configure

# serverless.yml

  component: "@serverless/realtime-app"
    # backend config to be passed to the socket component
        root: ./code # The root folder containing the backend code.
        src: dist # The folder within your 'src' directory containing your built artifacts
        hook: npm run build # A hook to build/test/do anything
      memory: 128
      timeout: 10
        TABLE_NAME: my-table

    # frontend config to be passed to the website component
        root: ./ # The root folder of your website project.  Defaults to current working directory
        src: ./src # The folder to be uploaded containing your built artifact
        hook: npm run build # A hook to build/test/do anything to your code before uploading
      env: # Environment variables to include in a 'env.js' file with your uploaded code.
    region: us-east-1

4. Deploy

$ serverless

5. Example

You can see a full Chat Application that uses this Component in the example folder. It leverages AWS DynamoDB to maintain state of who is connected, so that messages can be sent out to the appropriate connection IDs.

You can also see how this Component can be used programmatically in the Chat App Component's source code.

6. Pricing

AWS API Gateway Websockets Pricing

AWS Lambda Pricing


New to Components?

Checkout the Serverless Components repo for more information.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
javascript (70,346
aws (1,100
serverless (660
lambda (247
realtime (217