Introducing Bob’s Used Books—a New, Real-World, .NET Sample Application

0
209
Introducing Bob’s Used Books—a New, Real-World, .NET Sample Application


Voiced by Polly

Today, I’m completely satisfied to announce {that a} new open-source pattern software, a fictitious used books eCommerce retailer we name Bob’s Used Books, is obtainable for .NET builders working with AWS. The .NET advocacy and improvement groups at AWS discuss to clients repeatedly and, throughout these conversations, usually obtain requests for extra in-depth samples. Customers inform us that, whereas small code snippets serve properly as an instance the mechanics of an API, their improvement groups additionally want and wish to make use of fuller, extra real-world samples to know higher easy methods to assemble fashionable purposes for the cloud. Today’s pattern software launch is in response to these requests.

Bob’s Used Books is a pattern eCommerce software constructed utilizing ASP.NET Core model 6 and represents an preliminary modernization of a typical on-premises customized software. Representing a primary stage of modernization, the appliance makes use of fashionable cross-platform .NET, enabling it to run on each Windows and Linux techniques within the cloud. It’s typical of what many .NET builders are simply now going via, porting their very own purposes from .NET Framework to .NET utilizing freely obtainable instruments from AWS such because the Toolkit for .NET Refactoring and the Porting Assistant for .NET.

Bob's Used Books sample application homepage

Sample software options
Customers of our fictional bookstore can browse and search on the shop for used books and examine particulars on chosen books corresponding to worth, situation, style, and extra:

Bob's Used Books sample application search results page, which shows 8 books and their prices.

 

Bob's Used Books sample application book details page

Just like an actual e-commerce retailer, clients can add books to a procuring cart, pending subsequent checkout, or to a private want record. When the time involves buy, the client can begin the checkout course of, which can encourage them to register if they’re an present buyer or join throughout the course of.

Bob's Used Books sample application checkout page

In this pattern software, the bookstore’s workers makes use of the identical internet software to handle stock and buyer orders. Role-based authentication is used to find out whether or not it’s a workers member signing in, through which case they will view an administrative portal, or a daily retailer buyer. For workers, having accessed the admin portal, they begin with a dashboard view that summarizes pending, in-process, or accomplished orders and the state of the shop’s stock:

Bob's Used Books sample application staff dashboard page

Staff can edit stock so as to add new books, full with cowl pictures, or regulate inventory ranges. From the identical dashboard, workers may view and course of pending orders.

Bob's Used Books sample application staff order processing page

Not proven right here, however one thing I feel is fairly cool, is a simulated workflow the place clients can re-sell their books via the shop. This includes the client submitting an software, the shop admin evaluating and deciding whether or not to buy from the client, the client “posting” the e-book to the shop if accepted, and at last the admin including the e-book into stock and reimbursing the client. Remember, that is all fictional, nonetheless—no precise monetary transactions happen!

Application structure
The bookstore pattern didn’t begin as a .NET Framework-based software that wanted porting to .NET, however it does use a monolithic MVC (model-view-controller) software design, typical of the .NET Framework improvement period (and nonetheless in use right now). It additionally makes use of a single Microsoft SQL Server database to comprise stock, procuring cart, person information, and extra.

Bob's Used Books sample application outline architecture

When totally deployed to AWS, the appliance makes use of a number of companies. These present assets to host the appliance, present configuration to the operating software, and likewise present helpful performance to the operating code, corresponding to picture verification:

  • Amazon Cognito – used for buyer and bookstore workers authentication. The software makes use of Cognito‘s Hosted UI to offer sign-in and sign-up performance.
  • Amazon Relational Database Service (RDS) – manages a single Microsoft SQL Server Express occasion containing stock, buyer, and different typical information for an e-commerce software.
  • Amazon Simple Storage Service (Amazon S3) – an S3 bucket is used to retailer cowl pictures for books.
  • AWS Systems Manager Parameter Store – accommodates runtime configuration information, together with the identify of the S3 bucket for canopy pictures, and Cognito person pool particulars.
  • AWS Secrets Manager – holds the person and password particulars for the underlying SQL Server database in RDS.
  • Amazon CloudEntrance – offers a website for accessing the quilt pictures within the S3 bucket, which implies the bucket doesn’t should be publicly obtainable.
  • Amazon Rekognition – used to confirm that cowl pictures uploaded for a e-book don’t comprise objectionable content material.

The software is a place to begin to showcase additional modernization alternatives sooner or later, corresponding to adopting purpose-built databases as a substitute of utilizing a single relational database, decomposing the monolith to make use of microservices (for the latter, AWS offers the Microservice Extractor for .NET), and extra. The .NET improvement, advocacy, and answer architect groups right here at AWS are fairly excited on the alternatives for brand spanking new content material, utilizing this pattern, as an instance these modernization alternatives within the upcoming months. And, because the pattern is open-source, we’re additionally to see the place the .NET improvement neighborhood takes it relating to modernization.

Running the appliance
My colleague Brad Webber, a Solutions Architect at AWS, has written the primary in a sequence of technical weblog posts we’ll be publishing concerning the pattern. You’ll discover these on the new .NET on AWS weblog channel. In his first put up, you’ll be taught extra about easy methods to run or debug the appliance by yourself machine in addition to deploy it utterly to the AWS cloud.

The software makes use of SQL Server Express localdb occasion for its database wants when operating exterior the cloud, which implies you do at the moment should be utilizing a Windows machine to run or debug. Launch profiles, accessible from Visual Studio, Visual Studio Code, or JetBrains Rider (all on Windows), are used to pick out how the appliance runs (for instance, with no or some cloud assets):

  • Local – When you choose this launch profile, the appliance runs utterly in your machine, utilizing no cloud assets, and doesn’t want an AWS account. This allows you to examine and experiment with the code incurring no fees for cloud assets.
  • Integrated – When you utilize this profile, the appliance nonetheless runs regionally in your Windows machine and continues to make use of the localdb database occasion, however now additionally makes use of some AWS assets, corresponding to an S3 bucket, Rekognition, Cognito, and others. This profile allows you to find out how you should use AWS companies inside your software code, utilizing the AWS SDK for .NET and varied extension libraries that we distribute on NuGet (for a full record of all obtainable libraries you should use when growing your purposes, see the .NET on AWS repository on GitHub). To allow you to arrange the cloud assets wanted by the appliance when utilizing this profile, an AWS Cloud Development Kit (AWS CDK) venture is offered within the pattern repository, making it simple to arrange and tear down these assets on demand.

Deploying the Sample to AWS
You may deploy your complete software to the AWS Cloud, on this case, to digital machines in Amazon Elastic Compute Cloud (Amazon EC2) with a SQL Server Express database occasion in Amazon Relational Database Service (RDS). The deployment makes use of assets suitable with the AWS Free Tier however do observe, nonetheless, that you could be nonetheless incur fees when you exceed the Free Tier limits. Unlike operating the appliance by yourself machine, which requires Windows due to the localdb dependency, you possibly can deploy the appliance to AWS from any machine, together with these operating macOS and Linux. Once once more, a CDK venture is included within the repository to get you began, and Brad’s weblog put up goes into extra element on these steps so I received’t repeat them right here.

Using digital machines within the cloud is usually a primary step in modernizing on-premises purposes due to similarity with an on-premises server setup, therefore the explanation for supporting Amazon EC2 deployments out-of-the-box. In the longer term, we’ll be including content material exhibiting easy methods to deploy the appliance to container companies on AWS, corresponding to AWS App Runner, Amazon Elastic Container Service (Amazon ECS), and Amazon Elastic Kubernetes Service (EKS).

Next steps
The Bob’s Used Books pattern software is obtainable now on GitHub. We encourage you, when you’re a .NET developer engaged on AWS and searching for a deeper, extra real-world pattern, to clone the repository and take the appliance for a spin. We’re additionally interested by what modernization journeys you’d resolve to take with the appliance, which can assist us create future content material for the pattern. Let us know within the points part of the repository. And if you wish to contribute to the pattern, we welcome contributions!

LEAVE A REPLY

Please enter your comment!
Please enter your name here