Skip to content

foxminchan/RookieShop

Repository files navigation

RookieShop: Rookie Phase-1 Assignment Project

Issue Build Maintainability Rating License MIT

RookieShop is a .NET Core web application training project demonstrating Clean Architecture, DDD and modern web development with Aspire and Next.js. The project is part of the Rookie Phase-1 Assignment at NashTech.


Table of Contents

Requirements

Build an e-commerce web site with minimum functionality below:

For customers:

  • Home page: category menu, features products
  • View products by category
  • View product details
  • Product rating
  • Register
  • Login/Logout
  • Optional (Shopping Cart, Ordering, IdentityServer4)

For admin:

  • Login/logout
  • Manage product categories (Name, Description)
  • Manage products (Name, Category, Description, Price, Images, CreatedDate, UpdatedDate)
  • View customers

Note

The project should apply as many techniques of ASP.NET MVC Core as possible. For example: TagHelpers, Razor Pages, ViewComponents and have Unit Test. The Unit Test do not need to have a high coverage number but should demonstrate the ability to write unit test for common components: Controllers, ViewComponents, Services …

Project Progress Report

Checkpoint Demo video Report Presentation
1

Technical Stack

Software Architecture

Software Architecture

No Name Usecase
1 identity server An authentication server that provides authentication and authorization services for the application
2 store front A user-facing website that allows customers to view, rate, and purchase products
3 back office An admin-facing website that allows administrators to manage products, categories, and customers
4 web api A REST API that provides data to the user-facing and admin-facing websites
5 redis A distributed lock manager, cache and cart storage
6 postgres A relational database that stores the application's data
7 open telemetry A telemetry data collector that collects and exports telemetry data to the Aspire Dashboard

Getting Started

Prerequisites

Windows with Visual Studio

Mac, Linux, & Windows without Visual Studio

Or use JetBrains Rider for the best experience

Setup tools and dependencies

# Setup the tools

bun install
dotnet tool restore

# Install the dependencies for the .NET Core projects

cd RookieShop
dotnet restore ./RookieShop.sln

Running the application

Warning

Remember to ensure that Docker is started

  • (Windows only) Run the application from Visual Studio:
  • Open the RookieShop.sln solution file in Visual Studio
  • Ensure RookieShop.AppHost are set as the startup projects
  • Hit F5 to run the application
  • Or run the application from your terminal:
dotnet run --project src/RookieShop.AppHost/RookieShop.AppHost.csproj

Testing

In the project, we use xUnit for unit testing and Moq for mocking. For integration testing, we use the TestContainers for running the test in the Docker container. I also use the NetArchTest library to enforce the architecture rules in the project. The test project is located in the test folder. I follow the Test Pyramid strategy to write the test. To run the test, you can use the following command:

dotnet test RookieShop.sln

Note

For performance testing, we use the K6 tool to simulate the load on the application. To run the performance test, you can use the following:

k6 run ./k6/performance-test.js

Deployment

Deploying the application to the production environment by using Aspirate (Aspir8) by running the following command:

dotnet aspirate generate
dotnet aspirate apply

Observability

The project uses OpenTelemetry to collect the telemetry data from the application. The data is sent to the OpenTelemetry Collector and exported to the Aspire Dashboard. The Aspire Dashboard is a monitoring and observability tool that provides insights into the application's performance and behavior. It helps developers to identify and troubleshoot issues in the application.

Aspire Dashboard Overview

Aspire Dashboard Trace

Project References

License

This project is licensed under the MIT License - see the LICENSE file for details.

Organization

NashTech