Skip to content

Commit d45bd9e

Browse files
author
aligneddev
committed
containers, WASM, Aspire
1 parent 02a0136 commit d45bd9e

1 file changed

Lines changed: 32 additions & 26 deletions

File tree

.specify/constitution.md

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# Bike Tracking Application Constitution
2-
<!-- Sync Impact Report v1.4
3-
Rationale: Applied Aspire Dashboard UI requirement to cloud deployments in addition to local diagnostics.
2+
<!-- Sync Impact Report v1.7
3+
Rationale: Clarified that Blazor WASM frontend is fully orchestrated by Aspire locally; a single `dotnet run` command starts the entire application stack including API, database, and WASM frontend.
44
Modified Sections:
5-
- Core Principles > VI. Performance, Scalability & Observability: Require Aspire Dashboard UI for local and cloud diagnostics
6-
- Technology Stack Requirements > Infrastructure & DevOps: Logging & Monitoring updated to include cloud dashboard UI
7-
- Monthly Technology Audit: Dashboard verification covers local and cloud
8-
Status: Approved for Aspire Dashboard UI in all environments
5+
- Technology Stack Requirements > Infrastructure & DevOps: Local Hosting clarified to show Aspire orchestrates both frontend and API
6+
- Development Workflow: Updated to emphasize all services orchestrated by Aspire locally
7+
- Onboarding Checklist: Simplified to single `dotnet run` command; no separate frontend build step needed for local dev
8+
Status: Approved for Aspire-orchestrated local development
99
Previous Updates:
10+
- v1.6: Adopted Blazor WebAssembly (WASM) as the frontend hosting model, enabling static site hosting for the UI while maintaining containerized API in both local and cloud.
11+
- v1.5: Standardized containerized hosting for local development and cloud deployments using Azure Container Apps. Clarified that static hosting for the Blazor app is allowed only for Blazor WebAssembly builds.
12+
- v1.4: Applied Aspire Dashboard UI requirement to cloud deployments in addition to local diagnostics.
1013
- v1.3: Standardized telemetry on Aspire built-in OpenTelemetry for all services exporting to Application Insights and required the Aspire Dashboard UI for observability.
1114
- v1.2: Changed Infrastructure as Code approach from Bicep to Azure CLI. Azure CLI scripts provide scriptable, imperative infrastructure management suitable for both automation and manual deployment workflows. Works seamlessly with azd and GitHub Actions.
1215
- v1.1: Added local deployment optionality. Application can run entirely locally with local database or deploy to Azure. Azure services optional deployment targets. Local-first development supported with SQLite or SQL Server LocalDB.
@@ -84,11 +87,13 @@ All user input **MUST** be validated in three layers: (1) **Client-side (Blazor)
8487
- **Domain-Infrastructure Interop**: EF Core value converters (FSharpValueConverters) enable transparent mapping of F# discriminated unions to database columns
8588

8689
### Frontend
87-
- **Framework**: Microsoft Blazor .NET 10 (latest stable)
90+
- **Framework**: Microsoft Blazor WebAssembly (WASM) .NET 10 (latest stable) — client-side compiled to WebAssembly
8891
- **UI Library**: Fluent UI Blazor v4.13.2 (or latest patch within v4.13.x)
89-
- **Authentication**: OAuth (via Microsoft.AspNetCore.Authentication.OpenIdConnect)
92+
- **Hosting Model**: Static site hosting for compiled Blazor WASM; serves frontend as static assets (HTML, CSS, JavaScript/WASM) from CDN or blob storage
93+
- **Authentication**: OAuth (via MSAL.js or Microsoft.Authentication.WebAssembly.Msal)
94+
- **API Communication**: HttpClient with OAuth bearer token to containerized backend API
9095
- **Design System**: Centralized DesignTheme with design tokens; theme colors locked to brand palette
91-
- **Validation**: Microsoft DataAnnotationsAttributes for form validation (see Principle VII)
96+
- **Validation**: Microsoft DataAnnotationsAttributes mirrored client-side (DataAnnotations attributes map to Blazor form validation)
9297

9398
### Data & Persistence
9499
- **Primary Database**:
@@ -105,23 +110,23 @@ All user input **MUST** be validated in three layers: (1) **Client-side (Blazor)
105110

106111
### Infrastructure & DevOps
107112
- **Hosting**:
108-
- **Local Deployment**: Aspire orchestration runs all services locally; single `dotnet run` command starts API, frontend, and database
109-
- **Cloud Deployment**: Azure Container Apps (managed Kubernetes) for API and Blazor frontend
113+
- **Local Deployment**: Single `dotnet run` orchestrates entire stack via Aspire: (1) Blazor WASM frontend container serving compiled static assets, (2) .NET Minimal API container, (3) SQLite/LocalDB database container. All services discoverable via Aspire AppHost; frontend connects to API via `localhost:API_PORT`
114+
- **Cloud Deployment**: Blazor WASM compiled to static assets, hosted in Azure Static Web Apps or Blob Storage + CDN. Containerized API runs in Azure Container Apps
110115
- **Identity**:
111116
- **Local Deployment**: User Secrets for local development; environment variables for configuration
112117
- **Cloud Deployment**: Azure Managed Identity for service-to-service authentication; no connection strings in code
113118
- **Secrets Management**:
114119
- **Local Deployment**: .NET User Secrets (development) or local environment variables (production-local)
115120
- **Cloud Deployment**: Azure Key Vault for database credentials, API keys, OAuth secrets
116121
- **Logging & Monitoring**:
117-
- **Local Deployment**: Aspire OpenTelemetry (logs, metrics, traces) with console/file exporters; Aspire Dashboard UI enabled
118-
- **Cloud Deployment**: Aspire OpenTelemetry exporters to Application Insights for all services; centralized logs, metrics, traces in Application Insights; Aspire Dashboard UI deployed for cloud diagnostics
122+
- **Local Deployment**: Aspire OpenTelemetry (logs, metrics, traces) with console/file exporters for backend API; browser console for frontend; Aspire Dashboard UI enabled
123+
- **Cloud Deployment**: Aspire OpenTelemetry exporters to Application Insights for backend API; frontend telemetry optional (browser-side logging to Application Insights via SDK); centralized logs, metrics, traces in Application Insights; Aspire Dashboard UI deployed for cloud diagnostics
119124
- **CI/CD**:
120-
- **Local Deployment**: Manual `dotnet run` or local Docker Compose
125+
- **Local Deployment**: Manual `dotnet run` (Aspire containers) or local Docker Compose
121126
- **Cloud Deployment**: GitHub Actions with Aspire and azd (Azure Developer CLI) for orchestrated deployment
122127
- **Deployment Artifacts**:
123-
- **Local Deployment**: Executable binaries or Docker containers
124-
- **Cloud Deployment**: IaC via Azure CLI scripts (imperative infrastructure provisioning and configuration)
128+
- **Local Deployment**: Aspire AppHost (`Program.cs`) defines all services (frontend, API, database); `dotnet run` builds and runs containers locally. Frontend built as part of Aspire orchestration, served by embedded HTTP container
129+
- **Cloud Deployment**: Blazor WASM static assets (HTML, CSS, JS, WASM binaries) deployed to Azure Static Web Apps or Blob Storage; API containerized in Azure Container Apps via Azure CLI scripts
125130

126131
### Package Management & Updates
127132
- Check latest NuGet versions monthly; update patches for security; propose major/minor upgrades with test coverage
@@ -136,14 +141,14 @@ Each specification defines a **complete, deployable vertical slice**:
136141
- **API**: One or more Minimal API endpoints handling commands/queries
137142
- **Database**: Event table, read projection table, SQL migrations via .sqlproj
138143
- **Integration**: Background function or event handler to materialize projections (if applicable)
139-
- **Deployment**: Tested locally via Aspire, deployable to Azure Container Apps
144+
- **Deployment**: Tested locally via single `dotnet run` (Aspire orchestrates frontend, API, database), deployable to Azure Static Web Apps (frontend) + Azure Container Apps (API)
140145

141146
Example: "User records a bike ride" slice includes:
142-
- Blazor form component (RideRecorder.razor, styled with DesignTheme, with DataAnnotationsAttributes validation)
143-
- POST /rides API endpoint (command handler with DataAnnotationsAttributes on DTO)
147+
- Blazor WASM form component (RideRecorder.razor, styled with DesignTheme, with DataAnnotationsAttributes validation) compiled and served by Aspire
148+
- POST /rides API endpoint (command handler with DataAnnotationsAttributes on DTO) in containerized backend
144149
- Events table with RideRecorded event; Projections table (RideProjection)
145150
- Background function listening to CES to update RideProjection
146-
- Aspire host configuration; Azure CLI deployment script for Container Apps
151+
- Aspire AppHost configuration for frontend + API + database orchestration; Azure CLI deployment scripts for Static Web Apps (frontend) and Container Apps (API)
147152

148153
### Definition of Done: Vertical Slice Completeness
149154

@@ -154,9 +159,9 @@ A vertical slice is **production-ready** only when all items are verified:
154159
- [ ] All tests written and failing (red phase complete)
155160
- [ ] Implementation complete; all tests passing (green + refactor phases)
156161
- [ ] Code review: architecture compliance verified, naming conventions followed, validation discipline observed
157-
- [ ] Feature branch deployed locally via `dotnet run` (Aspire orchestration)
162+
- [ ] Feature branch deployed locally via `dotnet run` (entire Aspire stack: frontend, API, database)
158163
- [ ] Integration tests pass; manual E2E test via Playwright (if critical user journey)
159-
- [ ] All validation layers implemented: client-side (Blazor DataAnnotations), API (DTO DataAnnotations), database (constraints)
164+
- [ ] All validation layers implemented: client-side (Blazor WASM DataAnnotations), API (DTO DataAnnotations), database (constraints)
160165
- [ ] Events stored in event table with correct schema; projections materialized and queryable
161166
- [ ] SAMPLE_/DEMO_ data cleaned up; no test data committed to main branch
162167
- [ ] Deployed to Azure staging environment via GitHub Actions + azd
@@ -245,7 +250,7 @@ Tests suggested by agent must receive explicit user approval before implementati
245250
4. **Implementation (Green)**: Code written to make tests pass
246251
5. **Refactor (Refactor)**: Code cleaned, tests still pass
247252
6. **Code Review**: Implementation reviewed for architecture compliance, naming, performance, validation discipline
248-
7. **Local Deployment**: Slice deployed locally via Aspire, tested manually with Playwright if E2E slice
253+
7. **Local Deployment**: Slice deployed locally in containers via Aspire, tested manually with Playwright if E2E slice
249254
8. **Azure Deployment**: Slice deployed to Azure Container Apps via GitHub Actions + azd
250255
9. **User Acceptance**: User validates slice meets specification and data validation rules observed
251256

@@ -265,6 +270,7 @@ Tests suggested by agent must receive explicit user approval before implementati
265270
- [ ] NuGet packages checked via `mcp_nuget_get-latest-package-version` for security patches
266271
- [ ] Security patches applied immediately; major/minor versions proposed with test coverage
267272
- [ ] Blazor FluentUI version pinned to v4.13.x (or latest approved patch)
273+
- [ ] MSAL.js or Microsoft.Authentication.WebAssembly.Msal updated; OAuth integration verified
268274
- [ ] F# compiler version matches latest stable; discriminated union syntax up-to-date
269275
- [ ] EF Core value converters still compatible with F# domain types
270276
- [ ] Aspire OpenTelemetry exporters updated; Application Insights integration verified
@@ -296,8 +302,8 @@ Breaking these guarantees causes architectural decay and technical debt accrual:
296302
### Onboarding Checklist for New Contributors
297303

298304
1. **Read constitution** (~20 min): Understand mission, seven core principles, technology stack, development workflow
299-
2. **Review decision history** (~15 min): [DECISIONS.md](./DECISIONS.md) explains why F#, why Event Sourcing, why Aspire
300-
3. **Clone repo and bootstrap** (~5 min): `git clone``dotnet tool install --global specify-cli``dotnet run` (Aspire orchestration)
305+
2. **Review decision history** (~15 min): [DECISIONS.md](./DECISIONS.md) explains why F#, why Event Sourcing, why Aspire, why Blazor WASM
306+
3. **Clone repo and bootstrap** (~5 min): `git clone``dotnet tool install --global specify-cli``dotnet run` (Aspire orchestrates frontend, API, database)
301307
4. **Explore specification examples** (~30 min): Review `/specs/` directory; read 2–3 completed specifications to understand vertical slice completeness
302308
5. **Review test examples** (~20 min): Browse `/bikeTracking.Tests/Unit/` and `/bikeTracking.Tests/Integration/` to understand test patterns (F# unit tests, integration test fixtures, E2E Playwright)
303309
6. **Pair with contributor on first spec** (~2–4 hours): Shadow an experienced team member through red-green-refactor cycle; understand test approval and code review gates
@@ -376,5 +382,5 @@ Always commit before continuing to a new phase.
376382

377383
---
378384

379-
**Version**: 1.4.0 | **Ratified**: 2026-03-03 | **Last Amended**: 2026-03-04
385+
**Version**: 1.7.0 | **Ratified**: 2026-03-03 | **Last Amended**: 2026-03-04
380386

0 commit comments

Comments
 (0)