https://github.com/markstanden/run-suggestion
Azure Function App based running recommendation engine built with TDD practices, using a testable, decoupled layered architecture.
https://github.com/markstanden/run-suggestion
azure-functions clean-architecture csv-processing dotnet8 recommendation-engine tdd
Last synced: 3 days ago
JSON representation
Azure Function App based running recommendation engine built with TDD practices, using a testable, decoupled layered architecture.
- Host: GitHub
- URL: https://github.com/markstanden/run-suggestion
- Owner: markstanden
- Created: 2025-04-05T19:29:41.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-09-10T09:16:10.000Z (7 months ago)
- Last Synced: 2025-09-10T12:57:25.293Z (7 months ago)
- Topics: azure-functions, clean-architecture, csv-processing, dotnet8, recommendation-engine, tdd
- Language: C#
- Homepage:
- Size: 169 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Run Suggestion Engine
A running recommendation engine built on Azure Functions, built using TDD practices, to an initial pre-designed UML
design.
## Project Structure
```bash
.
├── docs/
│ ├── examples/
│ │ └── curl/
│ └── sample-data/
├── src/
│ ├── Api/
│ │ ├── Constants/
│ │ ├── Extensions/
│ │ ├── Functions/
│ │ ├── Properties/
│ │ └── Program.cs
│ ├── Core/
│ │ ├── Constants/
│ │ ├── Interfaces/
│ │ ├── Repositories/
│ │ ├── Services/
│ │ ├── Sql/
│ │ ├── Transformers/
│ │ └── Validators/
│ ├── Shared/
│ │ ├── Constants/
│ │ ├── Extensions/
│ │ └── Models/
│ └── Web/
│ ├── Authentication/
│ ├── Constants/
│ ├── Layout/
│ ├── Pages/
│ ├── Services/
│ └── wwwroot/
├── tests/
│ ├── Api.Integration.Tests/
│ ├── Api.Unit.Tests/
│ ├── Core.Unit.Tests/
│ ├── Shared.Unit.Tests/
│ ├── TestHelpers/
│ └── Web.Unit.Tests/
├── swa-cli.config.json
└── RunSuggestion.sln
```
## Technology Stack
- **.NET 8**: Core framework
- **Azure Functions**: Serverless compute
- **Azure AD B2C**: Authentication
- **Testing**: xUnit, Moq, Shouldly
## Development
### Prerequisites
- [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download)
- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli)
- [Azure Functions Core](https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local)
### Infrastructure Management
This project uses [terraform-tools](https://github.com/markstanden/terraform-tools) for managing Terraform commands.
Although not required, it simplifies the creation of infrastructure by sourcing environment variables when working
locally.
This is a personal workaround for the
following [terraform issue](https://github.com/hashicorp/terraform-provider-azurerm/issues/27423)
## Getting Started
1. Clone the repository
2. Copy the local settings template:
```bash
cp src/Api/local.settings.template.json src/Api/local.settings.json
```
3. Build the solution:
```bash
dotnet build
```
4. Run tests:
```bash
dotnet test
```
5. Run locally
- **Full stack via Static Web Apps CLI** (recommended):
```bash
# prerequisite: install the SWA CLI
npm i -g @azure/static-web-apps-cli
```
```bash
# Local development (with hot reload)
swa start --config-name dev
# Shortcut (undocumented, may break in future versions):
swa start dev
# Deploy to Azure Static Web Apps
swa deploy --config-name deploy
```
- **Run separately**:
- API (Azure Functions):
```bash
cd src/Api
func start
```
- Web (Blazor):
```bash
dotnet watch run --project src/Web/Web.csproj
```
## SWA CLI Configuration
This project uses Azure Static Web Apps CLI with two configurations:
- **Default config**: Used for deployment (`swa deploy`/`swa deploy --config-name deploy`)
- builds and deploys Release versions
- **`dev` config**: Used for local development (`swa start dev`/`swa start --config-name dev`)
- runs Debug builds with hot reload
- **`test` config**: Used for api testing/automated tests (`swa start test`/
`swa start --config-name test`)
- Debug build, no browser, stable dev-server URL
The SWA CLI configuration is in `./swa-cli.config.json` and handles:
- Frontend serving (Blazor WebAssembly)
- API proxying (Azure Functions)
- Build commands for both Web and API projects
- Port configuration for local development
## CI/CD Pipeline
This project uses GitHub Actions to automate basic quality checks, with the pipeline running on pushes or PRs to `main`.
The pipeline jobs are held in my [coding-standards repo](https://github.com/markstanden/coding-standards), allowing for
usage across multiple projects.
- **Format Check**: Enforces code formatting standards using `.editorconfig` and dotnet's built in code formatter:
```bash
dotnet format --verify-no-changes
```
- **Build**: Compiles the solution and validates dependencies using dotnet's build command to flag errors.
```bash
dotnet build
```
- **Unit Tests**: Runs all tests in all test projects with the suffix `Unit.Tests`
```bash
dotnet test --filter 'FullyQualifiedName~Unit.Tests'
```
- **Integration Tests**: Runs all tests in all test projects with the suffix `Integration.Tests`
```bash
dotnet test --filter 'FullyQualifiedName~Integration.Tests'
```
## Code Quality
- Code quality is improved by static analysis during development using SonarQube with IDE integration.
- SonarQube inclusion within the pipeline provides an enforced quality gate on PRs.
- Force pushes to `main` are prohibited - requiring PRs and enabling review before merge.
- Code Rabbit also provides LLM-assisted code reviews, helping to highlight development errors prior to merges.