What is Serverlesspresso?
Serverlesspresso is an interactive serverless application that helps a pop-up coffee shop that provides premium espresso drinks at conferences and events to accept orders and notify customers when their drinks are ready. To make this work, a robust solution that scales to meet demand handles the workflow of individual drinks and authenticates the coffee drinkers is required. It consists of three front-end applications and a backend built primarily with AWS Step Functions and Amazon EventBridge and other AWS services.
Services used
AWS Amplify Console
Amazon API Gateway
Amazon DynamoDB
Amazon EventBridge
AWS Step Functions
AWS IoT Core
AWS Lambda
Amazon Cognito
AWS Amplify Console:
AWS Amplify Console is a full-stack cloud service that provides continuous deployment and hosting for web and mobile applications. It integrates with other AWS services and allows developers to deploy and manage their applications using Git-based workflows. Click here for more on AWS Amplify.
Amazon API Gateway:
Amazon API Gateway is a service that allows for the creation, publishing and management of APIs. It provides robust security, monitoring, and management features for API owners while allowing API consumers to securely access the APIs. Click here for more on Amazon API Gateway.
Amazon DynamoDB:
Amazon DynamoDB is an AWS-managed NoSQL database service that provides fast and predictable performance with easy scalability. It is designed so that it can handle large data amounts and is a popular choice for mobile, web, gaming, ad tech, and IoT applications. Click here for more on Amazon DynamoDB.
Amazon EventBridge:
Amazon EventBridge is a serverless event bus service that simplifies the building of event-driven architectures. It provides a central hub for events from different sources and enables easy routing of events to AWS services or other targets. Click here for more on Amazon EventBridge.
AWS Step Functions:
With the help of visual workflows, Amazon Step Functions is a solution that makes it simple to orchestrate numerous distributed applications and microservices. The steps of your workflow can be arranged and organized in your preferred sequence of execution using the graphical console that is provided.
Your application runs as it should in the designated order since each step is automatically started, monitored, and retried via Amazon Step Functions. Click here for more on AWS Step Functions.
AWS IoT Core:
AWS IoT Core is a service that allows you to connect your devices securely to the AWS cloud and with ease. Option for device management, data processing as well as integration with other AWS services is provided. Click here for more on AWS IoT Core.
AWS Lambda:
AWS Lambda is a serverless computing service that allows you to run your code without worrying about the underlying infrastructure. It supports multiple programming languages and can be used to build highly scalable and event-driven applications. Click here for more on AWS Lambda.
Amazon Cognito:
Amazon Cognito is a service provided by AWS which provides a means for web and mobile application users to register to have access to the application. Cognito provides features such as user registration and sign-in, social identity providers such as Facebook and Google, multi-factor authentication, and user data synchronization across devices. It also integrates with AWS services such as Amazon API Gateway and AWS Lambda to provide a complete serverless application solution. Click here for more on AWS Lambda.
Application Structure
I created various microservices that integrate existing frontends with the backend serverless application. I used AWS Step Functions to handle orchestration and Amazon EventBridge to handle choreography.
Frontends
I provided the deployed frontends with the required environment variables to enable them to connect. The three frontends are:
Display app:
This is to be displayed on screens where customers can see clearly. It provides a barcode for customers to scan to place an order, and shows a real-time queue of upcoming and completed drink orders.
Barista app:
This runs on tablets used by the baristas. The app allows baristas to change the status of a drink order, or cancel the order if needed. Updates from this application are propagated to the other apps.
Ordering app:
This is used by customers to place an order. It is designed to run on mobile devices. This is what it looks like on mobile.
Backend:
The backend application architecture uses AWS Step Functions, Amazon EventBridge, AWS Lambda, Amazon API Gateway, Amazon S3, Amazon DynamoDB, and Amazon Cognito. The backend is a set of several serverless microservices:
The Counting microservice -This uses a DynamoDB table to count the number of orders made and attaches this to the order information.
The OrderManager microservice - This is responsible for managing the coffee orders. It has a DynamoDB that contains information about each coffee order.
The Config microservice - This is responsible for saving information about beverages available on the menu, whether the shop is open or closed, and also granting access with an Amazon API gateway service.
The Publisher microservice - This is responsible for sending events to the IoT core topics which in turn sends event messages to the front-end applications.
The QR Validator microservice - This is responsible for supplying the QR codes to the display screen for customers to scan.
The OrderProcessor microservice - This is the workflow that is responsible for the processing of the customer order from the beginning to the end.
JavaScript runs in the frontend browser application sending and receiving data from an API using API Gateway. DynamoDB gives a persistence layer of data storage which the API uses. Events are sent to the frontend applications through the use of AWS IoT Core and AWS Lambda.
See the diagram below for the complete architecture:
This is from an AWS Workshop. Visit this site to get started. This is continued in part 2 of the series titled "Building Serverlesspresso". Comments are greatly appreciated.