logo
Build a UGC Live Streaming App with Amazon IVS: Creating a User (Lesson 2.1)

Build a UGC Live Streaming App with Amazon IVS: Creating a User (Lesson 2.1)

Welcome to Lesson 2.1 in this series where we're looking at building a web based user-generated content live streaming application with Amazon IVS. This entire series is available in video format on the AWS Developers YouTube channel and all of the code related to the sample application used in this series can be viewed on GitHub. Refer to the links at the end of the post for more information.

TS
Todd Sharp
Amazon Employee
Published Dec 13, 2023

In lesson 1, we learned all about StreamCat - a UGC live streaming application. We learned that StreamCat uses AdonisJS, and AlpineJS, and learned about the application schema and architecture. In lesson 2, we'll focus on what happens when new users register for an account.

As a reminder, there are two categories of AWS resources that make up the cloud architecture of the StreamCat application. The first category is a set of pre-built resources - things like the Amazon RDS PostgreSQL instance, Amazon EventBridge rules, and AWS Lambda functions that handle automated chat moderation and persistence of live stream events. These pre-built resources were deployed to the AWS cloud via the AWS Cloud Development Kit (CDK). The second category of resources are created and deployed on-demand. This group of resources include an Amazon IVS channel, chat room, and stage (for multi-host, real time live streams). The Channel, ChatRoom, and Stage resources all have a one-to-one relationship with a User, as illustrated in the following diagram.
User relationships
User Relationships
When a new user registers for a StreamCat account, the application will create and persist a new User entity.

The username and password are sent to a /register endpoint via an HTTP form POST. These values are used to create a new User and persist that User to the database.
1
2
3
4
5
Route.post('/register', async ({ auth, request, response }) => {
const username: string = request.input('username');
const password: string = request.input('password');
const user: User = await User.create({ username, password });
};
Note: This video series focuses on solving specific problems related to building UGC applications, and **is not meant to illustrate an end-to-end solution**. As such, there are certain best practices that are not addressed such as form input validation, and proper password strength enforcement. These items are left as an exercise for the developer/viewer, and will vary greatly depending on the language, framework, and security model necessary for your application.
Once the User is created, we can now focus on creating the Channel, ChatRoom, and Stage entities via the AWS SDK for JavaScript (v3). In the StreamCat application, the functionality for working with each entity is encapsulated in a reusable service class, respectively named ChannelService, ChatRoomService, and RealTimeService (for working with Stage entities).

In this lesson, we learned how the StreamCat application creates a new user and what resources need to be created to enable broadcasting and playback for that user's live stream. In the next lesson, we'll look at how to create an Amazon IVS channel for each user.


Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.