A lightweight ASP.NET Core 9 Razor Pages application that simulates a retail monolith before decomposition.
It includes product listing, shopping cart, checkout, and inventory management — built to demonstrate modernisation and refactoring patterns.
- ASP.NET Core 9 (Razor Pages)
- Entity Framework Core (SQL Server LocalDB)
- Dependency Injection with modular services:
CartServiceCheckoutServiceMockPaymentGateway
- 50 sample seeded products with random inventory
- End-to-end retail flow:
- Products → Cart → Checkout → Orders
- Minimal APIs:
POST /api/checkoutGET /api/orders/{id}
- Health-check endpoint at
/health - NEW: Dummy data generation for testing (DEV/QA only)
POST /api/admin/generate-dummy-data?count={number}- Generate test ordersDELETE /api/admin/cleanup-dummy-data- Remove test data- See DUMMY_DATA_GENERATION.md for details
- Ready for decomposition into microservices
You can run and edit this application in three different ways:
Run the application directly on your local machine with your preferred IDE or editor.
Prerequisites:
- .NET 9 SDK installed (download)
- SQL Server LocalDB (included with Visual Studio) or SQL Server instance
- Your favorite code editor (Visual Studio, VS Code, Rider, etc.)
Steps:
git clone https://github.com/lavann/ads_monotlith_app.git
cd ads_monotlith_app
dotnet restore
dotnet ef database update
dotnet runUse a Docker container with a pre-configured development environment. This ensures consistency across different machines without installing dependencies locally.
Prerequisites:
- Docker Desktop installed and running
- Visual Studio Code with the Dev Containers extension
Steps:
- Clone the repository
- Open the folder in VS Code
- When prompted, click "Reopen in Container" (or use Command Palette:
Dev Containers: Reopen in Container) - VS Code will build and start the dev container with all dependencies pre-installed
- Run
dotnet ef database updateanddotnet runinside the container terminal
Develop entirely in the cloud with zero local setup. Codespaces provides a full VS Code environment in your browser.
Prerequisites:
- GitHub account with Codespaces access
Steps:
- Navigate to the repository on GitHub
- Click the green "Code" button
- Select the "Codespaces" tab
- Click "Create codespace on main"
- Wait for the environment to initialize
- Run
dotnet ef database updateanddotnet runin the integrated terminal
All three environments provide the same development experience with the .NET SDK, C# extension, and all necessary tools pre-configured.
dotnet ef database update
-
If you modify models:
dotnet ef migrations add <MigrationName>dotnet ef database update
-
EF Core uses DesignTimeDbContextFactory (Data/DesignTimeDbContextFactory.cs) with the connection string:
Server=(localdb)\MSSQLLocalDB;Database=RetailMonolith;Trusted_Connection=True;MultipleActiveResultSets=true
At startup, the app automatically runs await AppDbContext.SeedAsync(db); which seeds 50 sample products with random categories, prices, and inventory.
To reseed manually:
dotnet ef database drop -f
dotnet ef database update
dotnet runStart the application:
dotnet runAccess the app at https://localhost:5001 or http://localhost:5000.
| Path | Description |
|---|---|
/ |
Home Page |
/Products |
Product catalogue |
/Cart |
Shopping cart |
/api/checkout |
Checkout API |
/api/orders/{id} |
Order details API |
/health |
Health check endpoint |
You can override the default connection string by setting the ConnectionStrings__DefaultConnection environment variable.
The application uses Azure Cognitive Search and Azure OpenAI services. These credentials must be configured as environment variables for the application to function properly:
| Variable | Description | Required |
|---|---|---|
AZURE_SEARCH_ENDPOINT |
Azure Cognitive Search service endpoint | Yes* |
AZURE_SEARCH_API_KEY |
Azure Cognitive Search API key | Yes* |
AZURE_OPENAI_ENDPOINT |
Azure OpenAI service endpoint | Yes* |
AZURE_OPENAI_API_KEY |
Azure OpenAI service API key | Yes* |
ConnectionStrings__DefaultConnection |
Database connection string | No |
ASPNETCORE_ENVIRONMENT |
Environment mode | No |
* Required only if you plan to use Azure Search or Azure OpenAI features (chat assistant, product search).
Linux/macOS:
export AZURE_SEARCH_ENDPOINT="https://your-search-service.search.windows.net"
export AZURE_SEARCH_API_KEY="your-search-api-key"
export AZURE_OPENAI_ENDPOINT="https://your-openai-service.openai.azure.com/"
export AZURE_OPENAI_API_KEY="your-openai-api-key"Windows (Command Prompt):
set AZURE_SEARCH_ENDPOINT=https://your-search-service.search.windows.net
set AZURE_SEARCH_API_KEY=your-search-api-key
set AZURE_OPENAI_ENDPOINT=https://your-openai-service.openai.azure.com/
set AZURE_OPENAI_API_KEY=your-openai-api-keyWindows (PowerShell):
$env:AZURE_SEARCH_ENDPOINT="https://your-search-service.search.windows.net"
$env:AZURE_SEARCH_API_KEY="your-search-api-key"
$env:AZURE_OPENAI_ENDPOINT="https://your-openai-service.openai.azure.com/"
$env:AZURE_OPENAI_API_KEY="your-openai-api-key"GitHub Codespaces automatically provides access to repository secrets as environment variables. To configure:
- Navigate to your repository on GitHub
- Go to Settings → Secrets and variables → Codespaces (not Actions!)
- Add the following secrets:
AZURE_SEARCH_ENDPOINTAZURE_SEARCH_API_KEYAZURE_OPENAI_ENDPOINTAZURE_OPENAI_API_KEY
Important: Make sure to add secrets under the Codespaces tab, not the Actions tab. Codespaces secrets are separate from Actions secrets.
These secrets will be automatically available as environment variables when you create or restart a Codespace.
Create a .env file in the root directory (this file is git-ignored):
AZURE_SEARCH_ENDPOINT=https://your-search-service.search.windows.net
AZURE_SEARCH_API_KEY=your-search-api-key
AZURE_OPENAI_ENDPOINT=https://your-openai-service.openai.azure.com/
AZURE_OPENAI_API_KEY=your-openai-api-keyThen update docker-compose.yml or .devcontainer/devcontainer.json to load these variables.
Note: Never commit the .env file or any files containing API keys to source control.





