---
title: "Discussion on \"Build a chat app in 9 minutes with AWS Amplify & Next JS\" | Hashnode"
description: "Discussion on \"Build a chat app in 9 minutes with AWS Amplify & Next JS\". Learn how to use AWS Amplify Subscriptions with Next.JS Server-side rendering to create a"
url: "https://hashnode.com/posts/aws-amplify-live-chat/609f8a36ebf598658125a988"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Build a chat app in 9 minutes with AWS Amplify & Next JS](https://blog.jarrodwatts.com/aws-amplify-live-chat?utm_source=hashnode&utm_medium=feed)

Learn how to use AWS Amplify Subscriptions with Next.JS Server-side rendering to create a

May 15, 2021 · 15 min read · blog.jarrodwatts.com  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#nextjs](https://hashnode.com/tag/nextjs)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#serverless](https://hashnode.com/tag/serverless)

## Written by

[Jarrod Watts](https://hashnode.com/@JarrodWatts)

@JarrodWatts · Sydney, Australia

  
[View profile](https://hashnode.com/@JarrodWatts)

Developer Relations Engineer @ Polygon Labs

A software engineer turned developer relations engineer in the web3 space, from Australia 🇦🇺.

## Responses 4

Markdown supported · ⌘↵ to post

[Rashan Jones](https://hashnode.com/@gatorgrad929)

[Nov 3, 2022](https://hashnode.com/posts/aws-amplify-live-chat/609f8a36ebf598658125a988/comment/63644aed6966069239a87a56)

Great blog! Worked perfectly! How can I have this hosted in the cloud? Not sure how to deploy this to Amplify so I can use the production link?

Thank you.

[Calvin Park](https://hashnode.com/@calvinpark)

[Aug 21, 2022](https://hashnode.com/posts/aws-amplify-live-chat/609f8a36ebf598658125a988/comment/6301a587dc09f71f101c617a)

This was a great way to learn about Amplify. Is there a way to run the frontend on AWS Lambda? I'm hoping to keep this around with minimal cost. Thanks

[auesako](https://hashnode.com/@auesako)

[Apr 20, 2022](https://hashnode.com/posts/aws-amplify-live-chat/609f8a36ebf598658125a988/comment/62602f0e7019274627fd7c5b)

Nice blog! I also recommend to update index.js to avoid duplicate subscription that Gabriel E mentioned too.

```
    // Subscribe to creation of message
    const subscription = API.graphql(
      graphqlOperation(onCreateMessage)
    ).subscribe({
      next: ({ provider, value }) => {
        setStateMessages((stateMessages) => [
          ...stateMessages,
          value.data.onCreateMessage,
        ]);
      },
      error: (error) => console.warn(error),
    });
    return () => subscription.unsubscribe()
  }, []);
```

[Gabriel E](https://hashnode.com/@gabs79)

[Oct 19, 2021](https://hashnode.com/posts/aws-amplify-live-chat/609f8a36ebf598658125a988/comment/616f542741c1b75f924d9b4f)

Great blog, thank you. One minor recommendation, to unsubscribe from subscription (or even within a timer).

```
return () => {
    subscription.unsubscribe();
  }
```
