├── src
├── Web
│ ├── wwwroot
│ │ ├── js
│ │ │ ├── site.js
│ │ │ ├── account.min.js
│ │ │ ├── catalog.min.js
│ │ │ ├── home.min.js
│ │ │ └── home.js
│ │ ├── favicon.ico
│ │ └── lib
│ │ │ ├── jquery-validation-unobtrusive
│ │ │ └── LICENSE.txt
│ │ │ ├── jquery-validation
│ │ │ └── LICENSE.md
│ │ │ └── bootstrap
│ │ │ └── LICENSE
│ ├── Views
│ │ ├── _ViewStart.cshtml
│ │ ├── _ViewImports.cshtml
│ │ ├── Order
│ │ │ ├── Index.cshtml
│ │ │ ├── Checkout.cshtml
│ │ │ └── Submitted.cshtml
│ │ ├── Home
│ │ │ ├── About.cshtml
│ │ │ ├── Cheatsheet.cshtml
│ │ │ ├── Help.cshtml
│ │ │ └── Index.cshtml
│ │ ├── Shared
│ │ │ ├── _ValidationScriptsPartial.cshtml
│ │ │ ├── _Spinner.cshtml
│ │ │ ├── _pagination.cshtml
│ │ │ ├── _breadcrumbs.cshtml
│ │ │ └── Error.cshtml
│ │ ├── Partials
│ │ │ ├── Catalog
│ │ │ │ ├── _FakeImg.cshtml
│ │ │ │ ├── _Categories.cshtml
│ │ │ │ ├── _Products.cshtml
│ │ │ │ └── _FakeThumbnails.cshtml
│ │ │ ├── Home
│ │ │ │ ├── _SignIn.cshtml
│ │ │ │ ├── _SignInInfo.cshtml
│ │ │ │ ├── _Header.cshtml
│ │ │ │ └── _MainContent.cshtml
│ │ │ ├── Order
│ │ │ │ └── _CheckoutPreview.cshtml
│ │ │ ├── Help
│ │ │ │ ├── _Account.cshtml
│ │ │ │ ├── _Order.cshtml
│ │ │ │ ├── _Newsletter.cshtml
│ │ │ │ ├── _Payment.cshtml
│ │ │ │ ├── _Web.cshtml
│ │ │ │ ├── _Recommendation.cshtml
│ │ │ │ ├── _Catalog.cshtml
│ │ │ │ ├── _Notification.cshtml
│ │ │ │ ├── _Shipping.cshtml
│ │ │ │ └── _About.cshtml
│ │ │ ├── Account
│ │ │ │ ├── _Create.cshtml
│ │ │ │ ├── _History.cshtml
│ │ │ │ ├── _UpdatePassword.cshtml
│ │ │ │ ├── _SignIn.cshtml
│ │ │ │ ├── _Details.cshtml
│ │ │ │ └── _MyAccount.cshtml
│ │ │ ├── Recommendation
│ │ │ │ └── _Recommendation.cshtml
│ │ │ └── Newsletter
│ │ │ │ └── _Newsletter.cshtml
│ │ ├── Account
│ │ │ ├── UpdatePassword.cshtml
│ │ │ ├── Create.cshtml
│ │ │ ├── SignIn.cshtml
│ │ │ ├── History.cshtml
│ │ │ ├── Orders.cshtml
│ │ │ ├── Update.cshtml
│ │ │ ├── Details.cshtml
│ │ │ ├── Payments.cshtml
│ │ │ ├── Address.cshtml
│ │ │ ├── Index.cshtml
│ │ │ ├── AddAddress.cshtml
│ │ │ ├── AddPayment.cshtml
│ │ │ ├── EditAddress.cshtml
│ │ │ └── EditPayment.cshtml
│ │ └── Catalog
│ │ │ ├── Product.cshtml
│ │ │ └── Products.cshtml
│ ├── build
│ ├── Models
│ │ ├── Order
│ │ │ ├── ShippingStatus.cs
│ │ │ ├── PaymentMethod.cs
│ │ │ ├── PaymentStatus.cs
│ │ │ ├── SubmitOrder.cs
│ │ │ ├── OrderNumberResponse.cs
│ │ │ ├── OrderStatus.cs
│ │ │ ├── CartReview.cs
│ │ │ ├── LineItem.cs
│ │ │ ├── PaymentInfo.cs
│ │ │ └── Order.cs
│ │ ├── ErrorViewModel.cs
│ │ ├── Account
│ │ │ ├── AccountHistory.cs
│ │ │ ├── AccountDetails.cs
│ │ │ ├── SignIn.cs
│ │ │ ├── ChangePassword.cs
│ │ │ ├── Account.cs
│ │ │ └── Address.cs
│ │ ├── Catalog
│ │ │ ├── Category.cs
│ │ │ └── Product.cs
│ │ ├── Recommendation
│ │ │ └── Recommendation.cs
│ │ └── Newsletter
│ │ │ └── NewsletterSignUp.cs
│ ├── Services
│ │ ├── INewsletterProxy.cs
│ │ ├── IOrderProxy.cs
│ │ ├── IRecommendationProxy.cs
│ │ ├── ICatalogProxy.cs
│ │ ├── NewsletterProxy.cs
│ │ ├── RecommendationProxy.cs
│ │ ├── IAccountProxy.cs
│ │ └── OrderProxy.cs
│ ├── Infrastructure
│ │ ├── Global
│ │ │ └── Site.cs
│ │ └── Options
│ │ │ ├── AppConfig.cs
│ │ │ ├── StoreSettings.cs
│ │ │ └── ServiceConfig.cs
│ ├── Dockerfile
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── appsettings.Development.json
│ ├── Web.csproj
│ ├── appsettings.json
│ └── Controllers
│ │ ├── RecommendationController.cs
│ │ ├── HomeController.cs
│ │ └── NewsletterController.cs
├── .dockerignore
├── CatalogSvc
│ ├── products.json
│ ├── Infrastructure
│ │ ├── Options
│ │ │ └── AppConfig.cs
│ │ ├── Db
│ │ │ └── IMongoClient.cs
│ │ └── Extensions
│ │ │ └── ProductExtensions.cs
│ ├── appsettings.json
│ ├── appsettings.Development.json
│ ├── Dockerfile
│ ├── Services
│ │ ├── ICatalogSvc.cs
│ │ └── CatalogSvc.cs
│ ├── Models
│ │ ├── Category.cs
│ │ └── Product.cs
│ ├── Repositories
│ │ ├── ICatalogRepository.cs
│ │ └── CatalogRepository.cs
│ ├── categories.json
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Program.cs
│ ├── CatalogSvc.csproj
│ └── Consumers
│ │ └── ProductInfoRequestConsumer.cs
├── prometheus
│ └── prometheus.yml
├── OrderSvc
│ ├── Models
│ │ ├── ShippingStatus.cs
│ │ ├── PaymentMethod.cs
│ │ ├── PaymentStatus.cs
│ │ ├── OrderStatus.cs
│ │ ├── LineItem.cs
│ │ └── PaymentInfo.cs
│ ├── Repositories
│ │ ├── RefType.cs
│ │ ├── IOrderRepository.cs
│ │ └── EventType.cs
│ ├── appsettings.Development.json
│ ├── Infrastructure
│ │ └── Options
│ │ │ └── AppConfig.cs
│ ├── Dockerfile
│ ├── Services
│ │ └── IOrderSvc.cs
│ ├── OrderSvc.csproj
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Program.cs
│ └── Consumers
│ │ ├── PaymentResponseConsumer.cs
│ │ └── ShippingResponseConsumer.cs
├── PaymentSvc
│ ├── Models
│ │ ├── PaymentMethod.cs
│ │ ├── PaymentStatus.cs
│ │ ├── PaymentGatewayResponseStatus.cs
│ │ ├── PaymentGatewayResponse.cs
│ │ ├── Payment.cs
│ │ └── PaymentGatewayRequest.cs
│ ├── Infrastructure
│ │ └── Options
│ │ │ └── AppConfig.cs
│ ├── Services
│ │ ├── IPaymentGateway.cs
│ │ ├── IPaymentSvc.cs
│ │ └── PaymentGateway.cs
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── Repositories
│ │ └── IPaymentRepository.cs
│ ├── Dockerfile
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Program.cs
│ ├── Consumers
│ │ └── PaymentRequestConsumer.cs
│ ├── PaymentSvc.csproj
│ ├── Controllers
│ │ └── PaymentController.cs
│ └── db.sql
├── ShippingSvc
│ ├── Models
│ │ ├── ShippingProvider.cs
│ │ └── ShippingStatus.cs
│ ├── Infrastructure
│ │ └── Options
│ │ │ └── AppConfig.cs
│ ├── Repositories
│ │ └── IShippingRepository.cs
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── Services
│ │ └── IShippingSvc.cs
│ ├── Dockerfile
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Program.cs
│ ├── Consumers
│ │ └── ShippingRequestConsumer.cs
│ ├── ShippingSvc.csproj
│ ├── db.sql
│ └── Controllers
│ │ └── ShippingController.cs
├── Microservices.Core
│ ├── Contracts
│ │ ├── Shipping
│ │ │ ├── ShippingProvider.cs
│ │ │ ├── ShippingStatus.cs
│ │ │ ├── ShippingResponse.cs
│ │ │ └── ShippingRequest.cs
│ │ ├── Payment
│ │ │ ├── PaymentStatus.cs
│ │ │ ├── PaymentResponse.cs
│ │ │ └── PaymentRequest.cs
│ │ ├── Account
│ │ │ ├── AccountInfo.cs
│ │ │ ├── AccountInfoRequest.cs
│ │ │ ├── AccountInfoResponse.cs
│ │ │ └── AccountCreated.cs
│ │ ├── Base
│ │ │ ├── CommandBase.cs
│ │ │ └── EventBase.cs
│ │ ├── Catalog
│ │ │ ├── ProductInfoRequest.cs
│ │ │ ├── ProductInfoResponse.cs
│ │ │ └── ProductInfo.cs
│ │ ├── Orders
│ │ │ └── OrderSubmitted.cs
│ │ ├── Newsletter
│ │ │ └── NewsletterSubscribed.cs
│ │ └── Notification
│ │ │ └── SendMail.cs
│ ├── Infrastructure
│ │ ├── Options
│ │ │ ├── MassTransitOptions.cs
│ │ │ ├── RedisOptions.cs
│ │ │ ├── EmailTemplate.cs
│ │ │ ├── MongoOptions.cs
│ │ │ └── SmtpOptions.cs
│ │ ├── Global.cs
│ │ ├── Extensions
│ │ │ ├── EnumExtensions.cs
│ │ │ ├── DateTimeExtensions.cs
│ │ │ ├── ExceptionExtensions.cs
│ │ │ ├── StringExtensions.cs
│ │ │ └── ListExtensions.cs
│ │ └── Crypt
│ │ │ └── Crypt.cs
│ ├── Microservices.Core.csproj
│ └── README.md
├── grafana
│ └── provisioning
│ │ ├── datasources
│ │ └── datasource.yml
│ │ └── dashboards
│ │ └── dashboard.yml
├── AccountSvc
│ ├── Repositories
│ │ ├── RefType.cs
│ │ ├── EventType.cs
│ │ └── IAccountRepository.cs
│ ├── Models
│ │ ├── AccountHistory.cs
│ │ ├── UpdateAccount.cs
│ │ ├── SignIn.cs
│ │ ├── Account.cs
│ │ ├── UpdatePassword.cs
│ │ ├── CreateAccount.cs
│ │ ├── PaymentInfo.cs
│ │ └── Address.cs
│ ├── appsettings.Development.json
│ ├── Infrastructure
│ │ └── Options
│ │ │ └── AppConfig.cs
│ ├── Dockerfile
│ ├── Consumers
│ │ ├── NewsletterSubscribedConsumer.cs
│ │ └── AccountInfoRequestConsumer.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Program.cs
│ ├── AccountSvc.csproj
│ ├── appsettings.json
│ └── Services
│ │ └── IAccountSvc.cs
├── RecommendationSvc
│ ├── Infrastructure
│ │ └── Options
│ │ │ └── AppConfig.cs
│ ├── Models
│ │ ├── Recommendation.cs
│ │ └── RecommendationDto.cs
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── Services
│ │ └── IRecommendationSvc.cs
│ ├── Dockerfile
│ ├── Repositories
│ │ └── IRecommendationRepository.cs
│ ├── Consumers
│ │ └── OrderSubmittedConsumer.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Program.cs
│ ├── RecommendationSvc.csproj
│ └── Controllers
│ │ └── RecommendationController.cs
├── NewsletterSvc
│ ├── Services
│ │ └── INewsletterSvc.cs
│ ├── Repositories
│ │ ├── INewsletterRepository.cs
│ │ └── NewsletterRepository.cs
│ ├── db.sql
│ ├── Infrastructure
│ │ └── Options
│ │ │ └── AppConfig.cs
│ ├── Models
│ │ └── Signup.cs
│ ├── appsettings.Development.json
│ ├── Dockerfile
│ ├── Program.cs
│ ├── appsettings.json
│ ├── Properties
│ │ └── launchSettings.json
│ ├── NewsletterSvc.csproj
│ └── Controllers
│ │ └── NewsletterController.cs
├── NotificationSvc
│ ├── Infrastructure
│ │ └── Options
│ │ │ └── AppConfig.cs
│ ├── Services
│ │ ├── INotificationSvc.cs
│ │ └── NotificationSvc.cs
│ ├── Repositories
│ │ ├── INotificationRepository.cs
│ │ └── NotificationRepository.cs
│ ├── Models
│ │ └── Notification.cs
│ ├── db.sql
│ ├── appsettings.Development.json
│ ├── Dockerfile
│ ├── Program.cs
│ ├── appsettings.json
│ ├── Properties
│ │ └── launchSettings.json
│ ├── NotificationSvc.csproj
│ └── Controllers
│ │ └── NotificationController.cs
└── Microservices.Core.sln
├── .gitignore
└── LICENSE
/src/Web/wwwroot/js/site.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/Web/wwwroot/js/account.min.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/Web/wwwroot/js/catalog.min.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/Web/wwwroot/js/home.min.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/.dockerignore:
--------------------------------------------------------------------------------
1 | bin\
2 | obj\
3 |
--------------------------------------------------------------------------------
/src/Web/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/src/CatalogSvc/products.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hd9/aspnet-microservices/HEAD/src/CatalogSvc/products.json
--------------------------------------------------------------------------------
/src/Web/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hd9/aspnet-microservices/HEAD/src/Web/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | packages/
2 | bin/
3 | obj/
4 | *.user
5 | *.suo
6 |
7 | .vs
8 | .vs/*
9 |
10 | nuget.config
11 |
--------------------------------------------------------------------------------
/src/Web/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using Web
2 | @using Web.Models
3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4 |
--------------------------------------------------------------------------------
/src/Web/build:
--------------------------------------------------------------------------------
1 | # to run this script run:
2 | # chmod +x ./build
3 | # so it can be executed on your WSL terminal
4 | docker.exe build -t web -q .
5 |
--------------------------------------------------------------------------------
/src/prometheus/prometheus.yml:
--------------------------------------------------------------------------------
1 | scrape_configs:
2 | - job_name: cadvisor
3 | scrape_interval: 5s
4 | static_configs:
5 | - targets:
6 | - cadvisor:8080
7 |
--------------------------------------------------------------------------------
/src/OrderSvc/Models/ShippingStatus.cs:
--------------------------------------------------------------------------------
1 | namespace OrderSvc.Models
2 | {
3 | public enum ShippingStatus
4 | {
5 | Pending,
6 | Delivered,
7 | Cancelled
8 | }
9 | }
--------------------------------------------------------------------------------
/src/Web/Views/Order/Index.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Your Cart";
3 | }
4 |
5 |
Sign in or create an account for a best experience.
5 | Sign In | 6 | Create Account 7 |4 | The Account microservice 5 | manages account information. It persists its data primarily on 6 | a MySQL container and process operations such as creating accounts, 7 | changing password, granting access to the system (no JWT so far), etc. 8 |
9 |4 | The Order microservice 5 | manages order information and workflow. It persists its data primarily on 6 | a MySQL container and communicates to the other microservices primarily 7 | via asynchronous messages exchanged via a RabbitMQ container. 8 |
9 |4 | The Newsletter microservice 5 | manages newsletter information. It persists email subscriptions primarily on 6 | a MySQL container. There's no default implementation for newsletter 7 | oprations such as a scheduled job, etc. Feel free to implement yours. 8 |
9 |4 | The Payment microservice 5 | simulates a payment gateway and manages the payment workflow. 6 | It persists its data primarily on a MySQL container and communicates 7 | to the other microservices primarily via asynchronous messages exchanges 8 | via a RabbitMQ container. 9 |
10 |These are the last events for your account.
8 |These are the existing orders for your account.
8 |4 | The Web microservice 5 | is this ASP.NET app that you're accessing at the moment. 6 | It's essentially a BFF (backend for frontend) / Api Gateway 7 | and is the public interface between the user and the other 8 | microservices. Web caches catalog, recommendation and data 9 | from other services on a Redis container. 10 |
11 |Here's your account info.
8 | 9 |Here's your list of payment types.
8 | 9 |13 | Already have an account? Sign In 14 |
15 | 16 |Here's your list of addresses.
10 | 11 |4 | The Recommendation microservice 5 | simulates a recommendation service by implementing naive recommendations 6 | based on previously completed shopping carts. 7 | It persists its data primarily on a MySQL container and communicates 8 | to the other microservices primarily via asynchronous messages exchanges 9 | via a RabbitMQ container. 10 |
11 |Welcome back, @name!
10 || Event | 7 |Date | 8 |
|---|---|
| {{ h.info }} | 13 |{{ new Date(h.createdAt).toDateString() }} | 14 |
You have no unread notifications.
10 |
4 | The catalog is provided by the
5 | Catalog microservice
6 | which consists of an ASP.NET Core app pulling data from a
7 | MongoDB container. The catalog is initialized with the
8 | docker-compose script. To change the catalog
9 | information, check th db.js file on the
10 | CatalogSvc project.
11 | The catalog information is cached locally
12 | from the Web microservice on a Redis container.
13 |
4 | Notifications are provided via asynchronous messages 5 | exchanged via a RabbitMQ Docker container and processed by a .NET Core backend. 6 | Different events (such as newsletter signups, account registrations, etc) 7 | send an async message to the 8 | Notification microservice 9 | that's sends and email to the user using Gmail by default. 10 | The notification service also logs the history of sent messages on a 11 | dedicated MySQL database. 12 |
13 |4 | The Shipping microservice 5 | simulates a shipping service and is reached via a RabbitMQ queue 6 | and MassTransit. The service is triggered by the order workflow 7 | whenever shopping carts are approved from the fake 8 | Payment microservice. 9 | The service persists its data primarily on a MySQL container and communicates 10 | to the other microservices primarily via asynchronous messages exchanges 11 | via a RabbitMQ container. 12 |
13 |@(Model.Description ?? $"Here's our list of products under {Model.Name}")
10 |
5 | This is a sample application to demo Microservices in .NET
6 | using ASP.NET Core, Docker, Redis, MongoDB, MySQL, Vue.js, MassTransit,
7 | Azure and Kubernetes.
8 | The source code is
9 | MIT licensed
10 | and is available at
11 | github.com/hd9/aspnet-microservices.
12 |
Check our selection of {{ c.name }}.
14 | View all products in {{ c.name }} 15 |22 | Don't have an account? Create Account. 23 |
24 |
12 | Request ID: @Model.RequestId
13 |
18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |
20 |21 | The Development environment shouldn't be enabled for deployed applications. 22 | It can result in displaying sensitive information from exceptions to end users. 23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 24 | and restarting the app. 25 |
26 | -------------------------------------------------------------------------------- /src/Microservices.Core/Microservices.Core.csproj: -------------------------------------------------------------------------------- 1 |Please review the information below. You'll have a chance to review your cart on the next step.
8 |Congratulations, your order was submitted. Here's the summary of your order:
11 |Sorry but the order you requested could not be found.
16 |Sorry, no recommendations found yet for this product.
18 |
5 | Want to subscribe to our newsletter?
6 | List managed by our Newsletter Microservice.
7 |
Help and information about the project.
5 | 6 |This project is composed of the following microservices:
9 |7 |
35 |