A Serverless Architecture: Registration System

Serverless architecture is becoming one of popular enterprise architectures in this cloud era. Serverless allows developers to focus on coding and solving business problems and not worrying much on the infrastructure. In the context of Microsoft, an Azure Function is serverless compute service that enable users to run code on demand (C#, Javascript, Python, Java, etc.) without having to explicitly provision or manage an infrastructure. Your code can be kicked off to run through a trigger (httptrigger, servicebus trigger, blob trigger, etc.) or through a timer.

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:

registrationArchitecture

  • 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.
  • PaymentAPI
    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.
  • RegistrationAPI
    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:

      • SaveOrder:
        The SaveOrder function as the name states, takes the order object and saves it in the Azure SQL database
      • SendEmailConfirmation:
        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.
      • AddEmailToMailingList:
        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!