Before we begin building our app, let's take a deeper look at what exactly we want to achieve.
We can start with user stories. A user story is a description of a specific feature of an application, framed from the perspective of one of our users.
Here's the framework, as suggested by Jon Dobrowolski:
As a user, I want to do ___ because ____.
Given that I'm doing ___, I should be able to ___ in order to ___.
Not all features require the whole framework, though. Let's start with some basic examples:
- Users should be able to log in and out of the application
Pretty straightforward. I don't think we need to add the justification for this, as it is a fairly basic feature.
Let's move on to something more advanced:
- Users should be able to view their messages even when offline
- As a user, I want to be able to check my messages without needing an internet connection, because I may need to read them on the go
- Given that I start the application without internet access, I should be able to view all past messages
Let's cover some of the more basic functionality of the app. Users should be able to send and receive messages in real-time.
Real-time functionality will be key to our application. There's no point in having chat unless it's fast and fluid:
- Users should be able to view all messages by a given author
- As a user, I want to be able to view a list of all messages sent by a given user, because I may need to view their contribution to the conversation without the noise of others' messages
- Given that I click on a user's email, I should be taken to a profile view with all their messages
The profile view is a special feature you suggested to the client to manage the inevitable chaos of the main chat room.
Let's add a couple more PWA-specific user stories:
- Users should receive push notifications when a message is sent by another user
- As a user, I want to be constantly updated on the progress of the conversation, because I don't want to miss anything important
- Given that the chat is not open or visible on my screen, I should receive notifications for each message sent by another user
And installing:
- Users should be able to install the app on their mobile device
- As a user, I want to be able to open the application without navigating to the URL in my browser, because I want easy access to the chat room
- Given that I have signed up to the chat for the first time, I should be prompted to install the app on my device
Don't worry about how we will achieve these goals; we'll cover that in due time. For now, let's just continue documenting what we want to do.
Our client was big on performance, so let's specify some performance-specific goals:
- Users should be able to load the app in under 5 seconds, even under shaky network conditions
- As a user, I want to be able to interact with the app as quickly as possible, because I don't want to be stuck waiting for it to load
- Given that I have opened the application using a poor internet connection, I should still have it load in under 5 seconds
Load in under 5 seconds is still a bit vague in terms of what that means for our application. We'll revisit this story in more depth in the chapters on performance.
The previously mentioned user stories cover the basic functionality of our app. Let's talk about the specific challenges these points present.