How aws-samples/bobs-used-bookstore-classic works
Project type and purpose
• This is a full-stack ASP.NET MVC 5 web application targeting .NET Framework 4.8 (“Bob’s Used Books Classic”).
• It follows a layered architecture (Presentation → Domain → Data → Common) and can run locally (IIS Express + local DB/files) or be deployed to AWS via AWS CDK.
File structure
• Top-level “app” folder with four projects:
– Bookstore.Web: MVC presentation (Views, Controllers, Models, Middleware)
– Bookstore.Domain: business entities & services (service interfaces, DTOs, domain services)
– Bookstore.Data: EF DbContext, repositories, data services (local/S3 file services, Rekognition/validation)
– Bookstore.Common: shared constants, utilities
• AWS CDK project (Bookstore.Cdk) with four stacks: NetworkStack (VPC, subnets, ALB), DatabaseStack (RDS SQL Server), EcsStack (ECS Fargate cluster, task definitions), CoreStack (global IAM roles, S3 buckets, Cognito, CloudWatch LogGroups).
• Dockerfile for containerizing the .NET app, cdk.json for CDK context, LogMonitorConfig.json for logging setup.
Key points from the README
• The web.config toggles each service between “local” (in-process/local) and “aws” implementations.
• CDK stack “BobsUsedBooksClassicECS” builds a Windows container of the MVC app and deploys to ECS Fargate.
• AWS services used: Amazon Cognito, Amazon RDS (SQL Server), Amazon S3, Amazon Rekognition, Amazon CloudWatch.
a. Main components to represent
– User’s browser (HTTP(S) requests)
– Presentation layer (ASP.NET MVC app running in Windows container on ECS Fargate or locally in IIS Express)
– Domain layer (business logic services)
– Data layer (Entity Framework → RDS SQL Server or local DB)
– File service (local file system or Amazon S3)
– Image validation (local validators or Amazon Rekognition)
– Authentication (local store or Amazon Cognito user pool)
– Logging (local logs or Amazon CloudWatch)
– Infrastructure (VPC, public/private subnets, ALB, ECS cluster, RDS instance, S3 bucket, Cognito, CloudWatch).
b. Relationships and interactions
– Browser → ALB → ECS Fargate task → MVC Controllers
– Controllers → Domain services → Repositories → RDS (SQL)
– Controllers/Domain → FileService interface → S3 bucket (or local FS)
– Controller invoking AuthenticationController → Cognito User Pool (or local auth)
– Domain/ImageValidationService → Rekognition API (or local validation)
– Application → CloudWatch LogGroups/Streams via LoggingService interface
– CDK stacks interact to provision VPC → Subnets → RDS → ECS → supporting AWS services.
c. Architectural patterns & principles
– Layered architecture (Presentation, Domain, Data, Common)
– Repository pattern for data access
– Service interfaces for pluggable implementations (local vs. AWS)
– Dependency injection configured in Bookstore.Web/App_Start/DependencyInjectionSetup
– Infrastructure as Code via AWS CDK with separate stacks for networking, database, compute.
d. Key technologies/frameworks
– ASP.NET MVC 5 (.NET Framework 4.8)
– Entity Framework (Code First)
– AWS Cloud Development Kit (CDK) in .NET
– Docker Windows containers, ECS on Fargate
– Amazon RDS for SQL Server, Amazon S3, Amazon Rekognition, Amazon Cognito, Amazon CloudWatch.