I would like to share a recent experience where I was called as a volunteer and help a non profit organization to architect their registration application. Due to some requirements, I decided to present a serverless architecture starting from the UI all the way to the database. We used the following Azure resources: Azure Web App, Azure SQL Database, and many Azure Functions.
Below is the architecture diagram presented:
- Web UI
This is the public facing interface where users will be asked to register. Users will provide personal as well as billing information. After data entry is complete, the application makes an HTTP post call to the PaymentAPI which is an Azure Function.
This Azure function uses the Paypal API to validate and process the billing information. In case of failure a 500 HTTP status code is returned letting the user know that an error occurred. However, in case of success, the order object (without the credit card information) is then queued through a Service Bus that will trigger the next step which will process the registration.
This is a Durable Function. Within a durable function, we can many functions using one of these patterns such as: chaining, fan in/fan out. In this case, I’m using a version of the fan in/out where I run 3 functions in parallel. These 3 function is needed to complete a registration:
The SaveOrder function as the name states, takes the order object and saves it in the Azure SQL database
As part the registration, we send an email confirmation letter to the attendee as a proof of registration. We used SendGrid with Razor template to generate the email body content.
This function saves the order email address to the non-profit organization mailing list, so that the user can get the next updated newsletter regarding the conference. For the company uses Mailchimp for their newsletter and email campaign. We use Mailchimp SDK which allowed to add new subscriber.
Let me know your thoughts on serverless architecture!