From dfbaf7640a15f86e1625d708d483102d2f63fcff Mon Sep 17 00:00:00 2001 From: Edwin van den Houdt Date: Wed, 3 Jun 2026 11:38:08 +0000 Subject: [PATCH] feat(bff): placeholder BFF + /health endpoint (closes #28) (#34) --- .gitignore | 27 +++++++++++++++++++ docs/PRD.md | 2 +- global.json | 6 +++++ services/bff/Bff.Api/Bff.Api.csproj | 9 +++++++ services/bff/Bff.Api/Program.cs | 12 +++++++++ .../Bff.Api/Properties/launchSettings.json | 23 ++++++++++++++++ .../bff/Bff.Api/appsettings.Development.json | 8 ++++++ services/bff/Bff.Api/appsettings.json | 9 +++++++ services/bff/Bff.Tests/Bff.Tests.csproj | 26 ++++++++++++++++++ services/bff/Bff.Tests/HealthEndpointTests.cs | 20 ++++++++++++++ services/bff/Bff.slnx | 4 +++ 11 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 global.json create mode 100644 services/bff/Bff.Api/Bff.Api.csproj create mode 100644 services/bff/Bff.Api/Program.cs create mode 100644 services/bff/Bff.Api/Properties/launchSettings.json create mode 100644 services/bff/Bff.Api/appsettings.Development.json create mode 100644 services/bff/Bff.Api/appsettings.json create mode 100644 services/bff/Bff.Tests/Bff.Tests.csproj create mode 100644 services/bff/Bff.Tests/HealthEndpointTests.cs create mode 100644 services/bff/Bff.slnx diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1499030 --- /dev/null +++ b/.gitignore @@ -0,0 +1,27 @@ +# .NET build output +bin/ +obj/ +[Dd]ebug/ +[Rr]elease/ +*.user + +# Test results / coverage +[Tt]est[Rr]esults/ +*.trx +coverage*.json +coverage*.xml +*.coverage + +# Rider / VS / VS Code +.idea/ +.vs/ +.vscode/ + +# Node / Angular (added as the frontend lands) +node_modules/ +dist/ +.angular/ + +# OS +.DS_Store +Thumbs.db diff --git a/docs/PRD.md b/docs/PRD.md index e72b176..57577ff 100644 --- a/docs/PRD.md +++ b/docs/PRD.md @@ -85,7 +85,7 @@ The five flows form the BDD acceptance backbone (Gherkin scenarios in `tests/acc - **Source control & collaboration:** **Gitea** (Respellion self-hosted) — repository, issues, milestones, labels, projects, releases, container registry, wiki, packages. - **CI/CD:** **Gitea Actions** running on Respellion-hosted `act_runner` instances. Workflow files live in `.gitea/workflows/`. Marketplace actions are referenced via absolute URLs (`uses: https://github.com/actions/checkout@v4` or Gitea-hosted equivalents where available) for reproducibility. -- **Backend:** .NET 9 (LTS at iteration time), C#, minimal APIs for BFF, MediatR for in-process messaging within Domain Service, EF Core for the projection store and domain DB. +- **Backend:** .NET 10 (LTS at iteration time), C#, minimal APIs for BFF, MediatR for in-process messaging within Domain Service, EF Core for the projection store and domain DB. - **Frontend:** Angular (latest LTS) + TypeScript, standalone components + signals, Nx monorepo, NL Design System component library, Angular Testing Library + Playwright. - **Workflow:** Flowable (BPMN + DMN) via Docker image; Postgres for engine store. - **Identity:** Keycloak with pre-seeded realms. diff --git a/global.json b/global.json new file mode 100644 index 0000000..ab84b81 --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "10.0.203", + "rollForward": "latestFeature" + } +} diff --git a/services/bff/Bff.Api/Bff.Api.csproj b/services/bff/Bff.Api/Bff.Api.csproj new file mode 100644 index 0000000..a3a34b6 --- /dev/null +++ b/services/bff/Bff.Api/Bff.Api.csproj @@ -0,0 +1,9 @@ + + + + net10.0 + enable + enable + + + diff --git a/services/bff/Bff.Api/Program.cs b/services/bff/Bff.Api/Program.cs new file mode 100644 index 0000000..633eec0 --- /dev/null +++ b/services/bff/Bff.Api/Program.cs @@ -0,0 +1,12 @@ +var builder = WebApplication.CreateBuilder(args); +builder.Services.AddHealthChecks(); + +var app = builder.Build(); + +app.MapGet("/", () => "BFF placeholder"); +app.MapHealthChecks("/health"); + +app.Run(); + +// Exposed so the test host (WebApplicationFactory) can boot the app. +public partial class Program; diff --git a/services/bff/Bff.Api/Properties/launchSettings.json b/services/bff/Bff.Api/Properties/launchSettings.json new file mode 100644 index 0000000..47e0b9f --- /dev/null +++ b/services/bff/Bff.Api/Properties/launchSettings.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5249", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7106;http://localhost:5249", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/services/bff/Bff.Api/appsettings.Development.json b/services/bff/Bff.Api/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/services/bff/Bff.Api/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/services/bff/Bff.Api/appsettings.json b/services/bff/Bff.Api/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/services/bff/Bff.Api/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/services/bff/Bff.Tests/Bff.Tests.csproj b/services/bff/Bff.Tests/Bff.Tests.csproj new file mode 100644 index 0000000..e6b2ace --- /dev/null +++ b/services/bff/Bff.Tests/Bff.Tests.csproj @@ -0,0 +1,26 @@ + + + + net10.0 + enable + enable + false + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/bff/Bff.Tests/HealthEndpointTests.cs b/services/bff/Bff.Tests/HealthEndpointTests.cs new file mode 100644 index 0000000..2244534 --- /dev/null +++ b/services/bff/Bff.Tests/HealthEndpointTests.cs @@ -0,0 +1,20 @@ +using System.Net; +using Microsoft.AspNetCore.Mvc.Testing; + +namespace Bff.Tests; + +public class HealthEndpointTests(WebApplicationFactory factory) + : IClassFixture> +{ + [Fact] + public async Task Health_endpoint_returns_200_and_reports_healthy() + { + var client = factory.CreateClient(); + + var response = await client.GetAsync("/health"); + + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + var body = await response.Content.ReadAsStringAsync(); + Assert.Contains("Healthy", body); + } +} diff --git a/services/bff/Bff.slnx b/services/bff/Bff.slnx new file mode 100644 index 0000000..5680319 --- /dev/null +++ b/services/bff/Bff.slnx @@ -0,0 +1,4 @@ + + + +