Skip to content

Fix sample-summary typos surfaced on new detail pages - #1189

Merged
David Pine (IEvangelist) merged 1 commit into
mainfrom
dapine/fix-sample-readme-typos
Jun 2, 2026
Merged

David Pine (IEvangelist) merged 1 commit into
mainfrom
dapine/fix-sample-readme-typos

Conversation

@IEvangelist

Copy link
Copy Markdown
Member

Fast follow-up to #1089 addressing Adam Ratzman (@adamint)'s doc-tester feedback (#1089 (comment)):

A few upstream sample summary typos now render visibly on aspire.dev:

  • JavaSript in the FastAPI/Python sample summary.
  • catlog in the Aspire Shop summary.
  • a Aspire application / a Aspire app in a few sample titles/summaries.

What this PR does

Patches the typos directly in src/frontend/src/data/samples.json so the live site stops showing them right away. Each affected sample has its title / description / readme / readmeRaw fields corrected.

Sample Was Now
aspire-shop catlog catalog
aspire-with-python JavaSript JavaScript
container-build a Aspire application / a Aspire app an Aspire application / an Aspire app
database-containers a Aspire application / a Aspire app an Aspire application / an Aspire app

14 string fields updated across 4 samples (1 file, +19/-19).

Upstream fix

The long-term fix for the source READMEs is at microsoft/aspire-samples#1667. Once that merges, the next update-samples run here will produce byte-identical output to this patch (idempotent), so there's no risk of this fix getting clobbered.

Verification

  • 62/62 custom-components.vitest.test.ts still pass.
  • grep for JavaSript / catlog / a Aspire returns no matches under src/frontend/src/data.
  • Remaining a Aspire matches under src/frontend/src/content/docs/dashboard/explore.mdx are pre-existing docs typos outside the scope of this follow-up.

Addresses follow-up feedback on #1089 (#1089 (comment)) where small typos in upstream sample READMEs render on the new sample detail pages:

- aspire-shop: `catlog` -> `catalog`

- aspire-with-python: `JavaSript` -> `JavaScript`

- container-build: title + intro `a Aspire application` / `a Aspire app` -> `an Aspire application` / `an Aspire app`

- database-containers: title + intro `a Aspire application` / `a Aspire app` -> `an Aspire application` / `an Aspire app`

Patches each sample's `title`/`description`/`readme`/`readmeRaw` fields in `samples.json` so the live site stops showing the typos immediately.

Long-term fix for the upstream READMEs is in microsoft/aspire-samples#1667; once that merges, the next `update-samples` run will produce identical output (so this patch is idempotent with the upstream fix).

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings June 2, 2026 17:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes several visible typos in sample titles/descriptions/README content on the new sample detail pages by patching the generated samples.json data.

Changes:

  • Corrects catlog → catalog in the Aspire Shop sample content.
  • Corrects JavaSript → JavaScript in the FastAPI/Python sample content.
  • Fixes article usage a Aspire ... → an Aspire ... in a couple sample titles/README strings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 231 to +235
"title": "Image Gallery with Event-Triggered Azure Container Apps Jobs",
"description": "Upload images to Azure Blob Storage with queue-triggered thumbnail generation. Demonstrates event-driven Container Apps Jobs with queue-based autoscaling, managed identity authentication, and Azure SQL free tier - **can run entirely within Azure free tier limits**.",
"href": "https://github.com/microsoft/aspire-samples/tree/main/samples/image-gallery",
"readme": "# Image Gallery with Event-Triggered Azure Container Apps Jobs\n\nUpload images to Azure Blob Storage with queue-triggered thumbnail generation. Demonstrates event-driven Container Apps Jobs with queue-based autoscaling, managed identity authentication, and Azure SQL free tier - **can run entirely within Azure free tier limits**.\n\n## Architecture\n\n**Run Mode:**\n```mermaid\nflowchart LR\n Browser --> Vite[Vite Dev Server<br/>HMR enabled]\n Vite -->|Proxy /api| API[C# API]\n API --> Azurite[Azurite Emulator<br/>Blobs + Queues]\n API --> SQL[SQL Server]\n Worker[Background Worker<br/>Runs continuously] --> Azurite\n Worker --> SQL\n Azurite -.Queue Message.-> Worker\n```\n\n**Publish Mode:**\n```mermaid\nflowchart LR\n Browser --> API[C# API serving<br/>Vite build output<br/>'npm run build']\n API --> Blobs[Azure Blob Storage]\n API --> Queue[Azure Storage Queue]\n API --> SQL[Azure SQL]\n Job[Container Apps Job<br/>Event-triggered<br/>Scales on queue depth] --> Blobs\n Job --> SQL\n Queue -.Queue Trigger.-> Job\n```\n\n## How It Works\n\n### Event-Driven Thumbnail Processing\n\n1. **Upload**: User uploads image → API saves to Azure Blob Storage and metadata to Azure SQL\n2. **Queue**: API enqueues thumbnail generation message to Azure Storage Queue\n3. **Trigger**: Azure monitors queue depth and automatically starts a Container Apps Job instance\n4. **Process**: Job processes messages in batches (up to 10), generates thumbnails using SkiaSharp\n5. **Scale Down**: After 2 empty polls (~5 seconds), job exits; new instances start automatically when messages arrive\n\n### Local Development vs Production\n\n**Production (Event-Triggered):**\n- Job starts when queue depth > 0, exits within ~5 seconds when empty\n- API and worker both scale to zero when idle\n\n**Local Development (Continuous):**\n- Worker runs continuously, polls every 5 seconds\n- Instant feedback with Azurite emulator and SQL Server container\n\n## What This Demonstrates\n\n- **Event-Driven Jobs**: Container Apps Jobs with queue-based autoscaling rules using Azure.Provisioning APIs\n- **Dual-Mode Resources**: Azurite/SQL Server containers locally, Azure services in production (`.RunAsEmulator()`, `.RunAsContainer()`)\n- **Free Tier Deployment**: Azure SQL free tier with serverless auto-pause, Container Apps scale-to-zero\n- **Managed Identity**: Password-less authentication to all Azure resources (Storage, SQL, Queues)\n- **Polyglot Stack**: Vite+React frontend embedded in C# API container, SkiaSharp for image processing\n- **OpenTelemetry**: Distributed tracing across upload → queue → worker pipeline\n\n## Running Locally\n\n```bash\naspire run\n```\n\nNo Azure resources required - uses Azurite emulator and SQL Server container.\n\n## Deploying to Azure\n\n**Prerequisites for deployment:**\n- [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli)\n- [Azure subscription](https://azure.microsoft.com/free/)\n\n**Commands:**\n```bash\naspire run # Run locally with Azurite\naspire publish # Generate Bicep files to explore deployment artifacts (output in ./aspire-output)\naspire deploy # Deploy to Azure Container Apps\n```\n\n## Security Notes\n\n**Implemented:**\n- ✅ **Managed Identity**: Password-less authentication to all Azure resources (no connection strings or secrets)\n- ✅ **XSRF Protection**: Antiforgery tokens protect upload/delete endpoints from cross-site request forgery attacks ([docs](https://learn.microsoft.com/aspnet/core/security/anti-request-forgery))\n- ✅ **Input Validation**: 10 MB file size limit, extension allowlist (.jpg, .jpeg, .png, .gif, .webp), and server-side image byte validation before saving or queueing uploads ([file upload security](https://learn.microsoft.com/aspnet/core/mvc/models/file-uploads))\n- ✅ **Filename Sanitization**: Path traversal prevention, 255 char limit\n- ✅ **Resource Limits**: Pagination (max 100 items), retry limits (3 attempts), size checks (20 MB max)\n\n**Not Implemented (Required for Production):**\n- ❌ **Authentication & Authorization**: Endpoints are public - anyone can upload/delete\n- ❌ **Rate Limiting**: No protection against abuse or DoS ([docs](https://learn.microsoft.com/aspnet/core/performance/rate-limit))\n- ❌ **Malware Scanning**: Image byte validation rejects unsupported or malformed images, but production upload workflows should consider malware scanning and the broader [ASP.NET Core security guidance](https://learn.microsoft.com/aspnet/core/security/)\n\n## Key Aspire Patterns\n\n**Azure Storage Emulation** - Automatic Azurite in run mode, real Azure in publish:\n```csharp\nvar storage = builder.AddAzureStorage(\"storage\").RunAsEmulator();\nvar blobs = storage.AddBlobContainer(\"images\");\nvar queues = storage.AddQueues(\"queues\");\n```\n\n**Azure SQL Dual Mode** - SQL Server container locally, Azure SQL free tier in production:\n```csharp\nvar sql = builder.AddAzureSqlServer(\"sql\")\n .RunAsContainer()\n .AddDatabase(\"imagedb\");\n```\n\nDefaults to Azure SQL free tier with serverless auto-pause (SKU: GP_S_Gen5_2).\n\n**Scale to Zero** - API only runs when handling requests:\n```csharp\napi.PublishAsAzureContainerApp((infra, app) =>\n{\n app.Template.Scale.MinReplicas = 0;\n});\n```\n\n**Event-Triggered Container App Job** - Direct control over Azure resources with Azure.Provisioning libraries:\n\nThis example demonstrates using the **Azure.Provisioning** libraries to directly configure low-level Azure resources (Bicep/ARM) from the AppHost. This provides complete flexibility and control when Aspire's higher-level APIs don't expose specific features.\n\n```csharp\nworker.PublishAsAzureContainerAppJob((infra, job) =>\n{\n // Direct access to Azure Provisioning APIs - full control over Bicep/ARM templates\n\n // Get storage account name for queue authentication\n var accountNameParameter = queues.Resource.Parent.NameOutputReference.AsProvisioningParameter(infra);\n\n // Configure event-driven trigger using Container Apps Job APIs\n job.Configuration.TriggerType = ContainerAppJobTriggerType.Event;\n job.Configuration.EventTriggerConfig.Scale.Rules.Add(new ContainerAppJobScaleRule\n {\n Name = \"queue-rule\",\n JobScaleRuleType = \"azure-queue\",\n Metadata = new ObjectExpression(\n // Bicep expressions - referencing other resources dynamically\n new PropertyExpression(\"accountName\", new IdentifierExpression(accountNameParameter.BicepIdentifier)),\n new PropertyExpression(\"queueName\", new StringLiteralExpression(\"thumbnails\")),\n new PropertyExpression(\"queueLength\", new IntLiteralExpression(1)) // Start job when 1+ messages\n ),\n Identity = identityAnnotation.IdentityResource.Id.AsProvisioningParameter(infra) // Use managed identity\n });\n});\n```\n\nThis approach gives you full control over Azure resource configuration without waiting for Aspire abstractions to expose every feature. The C# strongly-typed APIs generate correct Bicep/ARM templates with automatic dependency tracking and parameter passing between resources. You can seamlessly mix high-level Aspire APIs with low-level Azure Provisioning when you need fine-grained control.\n\n**Dual-Mode Worker** - Continuous in run mode, event-triggered in publish mode:\n```csharp\n// AppHost: Set environment variable only in run mode\nif (builder.ExecutionContext.IsRunMode)\n{\n worker = worker.WithEnvironment(\"WORKER_RUN_CONTINUOUSLY\", \"true\");\n}\n\n// Worker: Adapt behavior based on mode\nif (_configuration.GetValue<bool>(\"WORKER_RUN_CONTINUOUSLY\"))\n{\n // Local dev: poll every 5 seconds, run forever\n await ExecuteContinuousAsync(stoppingToken);\n}\nelse\n{\n // Production: poll up to 2 times (5s intervals), exit when empty\n // MaxEmptyPolls = 2, EmptyPollWaitSeconds = 5\n await ExecuteScheduledAsync(stoppingToken);\n}\n```\n\n**Graceful Shutdown** - Event-triggered mode always stops, exceptions crash naturally:\n```csharp\nif (_configuration.GetValue<bool>(\"WORKER_RUN_CONTINUOUSLY\"))\n{\n // Continuous mode: run forever, let exceptions crash the app\n await ExecuteContinuousAsync(stoppingToken);\n}\nelse\n{\n try\n {\n // Event-triggered mode: process messages until queue empty, then shutdown\n await ExecuteScheduledAsync(stoppingToken);\n }\n finally\n {\n // Always stop application when done (success or exception)\n // New instances will start automatically when queue has messages\n _hostApplicationLifetime.StopApplication();\n }\n}\n```\n\n**Container Files Publishing** - Embed Vite build output in API container:\n```csharp\napi.PublishWithContainerFiles(frontend, \"wwwroot\");\n```\n\n## Performance & Cost Characteristics\n\n**Response Times:**\n- Thumbnail generation: typically ready within seconds of upload\n- Local development: instant feedback with continuous polling\n\n**Cost Optimization:**\n- **Compute**: API and worker scale to zero when idle (~5 seconds), only pay for active processing\n- **SQL**: Free tier with serverless auto-pause (GP_S_Gen5_2), free up to monthly limits\n- **Storage**: Pay only for blob storage used, queues/blobs have minimal costs at low volumes\n- **Result**: Can run entirely within Azure free tier limits\n\n**Further optimization:** Using SAS URLs instead of API blob streaming would eliminate compute/egress costs for serving images\n\n**Scalability:**\n- Parallel job instances spawn automatically for high queue depth\n- Batch processing (up to 10 messages per poll)\n- Managed identity eliminates secrets management overhead\n",
"readmeRaw": "# Image Gallery with Event-Triggered Azure Container Apps Jobs\n\nUpload images to Azure Blob Storage with queue-triggered thumbnail generation. Demonstrates event-driven Container Apps Jobs with queue-based autoscaling, managed identity authentication, and Azure SQL free tier - **can run entirely within Azure free tier limits**.\n\n## Architecture\n\n**Run Mode:**\n```mermaid\nflowchart LR\n Browser --> Vite[Vite Dev Server<br/>HMR enabled]\n Vite -->|Proxy /api| API[C# API]\n API --> Azurite[Azurite Emulator<br/>Blobs + Queues]\n API --> SQL[SQL Server]\n Worker[Background Worker<br/>Runs continuously] --> Azurite\n Worker --> SQL\n Azurite -.Queue Message.-> Worker\n```\n\n**Publish Mode:**\n```mermaid\nflowchart LR\n Browser --> API[C# API serving<br/>Vite build output<br/>'npm run build']\n API --> Blobs[Azure Blob Storage]\n API --> Queue[Azure Storage Queue]\n API --> SQL[Azure SQL]\n Job[Container Apps Job<br/>Event-triggered<br/>Scales on queue depth] --> Blobs\n Job --> SQL\n Queue -.Queue Trigger.-> Job\n```\n\n## How It Works\n\n### Event-Driven Thumbnail Processing\n\n1. **Upload**: User uploads image → API saves to Azure Blob Storage and metadata to Azure SQL\n2. **Queue**: API enqueues thumbnail generation message to Azure Storage Queue\n3. **Trigger**: Azure monitors queue depth and automatically starts a Container Apps Job instance\n4. **Process**: Job processes messages in batches (up to 10), generates thumbnails using SkiaSharp\n5. **Scale Down**: After 2 empty polls (~5 seconds), job exits; new instances start automatically when messages arrive\n\n### Local Development vs Production\n\n**Production (Event-Triggered):**\n- Job starts when queue depth > 0, exits within ~5 seconds when empty\n- API and worker both scale to zero when idle\n\n**Local Development (Continuous):**\n- Worker runs continuously, polls every 5 seconds\n- Instant feedback with Azurite emulator and SQL Server container\n\n## What This Demonstrates\n\n- **Event-Driven Jobs**: Container Apps Jobs with queue-based autoscaling rules using Azure.Provisioning APIs\n- **Dual-Mode Resources**: Azurite/SQL Server containers locally, Azure services in production (`.RunAsEmulator()`, `.RunAsContainer()`)\n- **Free Tier Deployment**: Azure SQL free tier with serverless auto-pause, Container Apps scale-to-zero\n- **Managed Identity**: Password-less authentication to all Azure resources (Storage, SQL, Queues)\n- **Polyglot Stack**: Vite+React frontend embedded in C# API container, SkiaSharp for image processing\n- **OpenTelemetry**: Distributed tracing across upload → queue → worker pipeline\n\n## Running Locally\n\n```bash\naspire run\n```\n\nNo Azure resources required - uses Azurite emulator and SQL Server container.\n\n## Deploying to Azure\n\n**Prerequisites for deployment:**\n- [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli)\n- [Azure subscription](https://azure.microsoft.com/free/)\n\n**Commands:**\n```bash\naspire run # Run locally with Azurite\naspire publish # Generate Bicep files to explore deployment artifacts (output in ./aspire-output)\naspire deploy # Deploy to Azure Container Apps\n```\n\n## Security Notes\n\n**Implemented:**\n- ✅ **Managed Identity**: Password-less authentication to all Azure resources (no connection strings or secrets)\n- ✅ **XSRF Protection**: Antiforgery tokens protect upload/delete endpoints from cross-site request forgery attacks ([docs](https://learn.microsoft.com/aspnet/core/security/anti-request-forgery))\n- ✅ **Input Validation**: 10 MB file size limit, extension allowlist (.jpg, .jpeg, .png, .gif, .webp), and server-side image byte validation before saving or queueing uploads ([file upload security](https://learn.microsoft.com/aspnet/core/mvc/models/file-uploads))\n- ✅ **Filename Sanitization**: Path traversal prevention, 255 char limit\n- ✅ **Resource Limits**: Pagination (max 100 items), retry limits (3 attempts), size checks (20 MB max)\n\n**Not Implemented (Required for Production):**\n- ❌ **Authentication & Authorization**: Endpoints are public - anyone can upload/delete\n- ❌ **Rate Limiting**: No protection against abuse or DoS ([docs](https://learn.microsoft.com/aspnet/core/performance/rate-limit))\n- ❌ **Malware Scanning**: Image byte validation rejects unsupported or malformed images, but production upload workflows should consider malware scanning and the broader [ASP.NET Core security guidance](https://learn.microsoft.com/aspnet/core/security/)\n\n## Key Aspire Patterns\n\n**Azure Storage Emulation** - Automatic Azurite in run mode, real Azure in publish:\n```csharp\nvar storage = builder.AddAzureStorage(\"storage\").RunAsEmulator();\nvar blobs = storage.AddBlobContainer(\"images\");\nvar queues = storage.AddQueues(\"queues\");\n```\n\n**Azure SQL Dual Mode** - SQL Server container locally, Azure SQL free tier in production:\n```csharp\nvar sql = builder.AddAzureSqlServer(\"sql\")\n .RunAsContainer()\n .AddDatabase(\"imagedb\");\n```\n\nDefaults to Azure SQL free tier with serverless auto-pause (SKU: GP_S_Gen5_2).\n\n**Scale to Zero** - API only runs when handling requests:\n```csharp\napi.PublishAsAzureContainerApp((infra, app) =>\n{\n app.Template.Scale.MinReplicas = 0;\n});\n```\n\n**Event-Triggered Container App Job** - Direct control over Azure resources with Azure.Provisioning libraries:\n\nThis example demonstrates using the **Azure.Provisioning** libraries to directly configure low-level Azure resources (Bicep/ARM) from the AppHost. This provides complete flexibility and control when Aspire's higher-level APIs don't expose specific features.\n\n```csharp\nworker.PublishAsAzureContainerAppJob((infra, job) =>\n{\n // Direct access to Azure Provisioning APIs - full control over Bicep/ARM templates\n\n // Get storage account name for queue authentication\n var accountNameParameter = queues.Resource.Parent.NameOutputReference.AsProvisioningParameter(infra);\n\n // Configure event-driven trigger using Container Apps Job APIs\n job.Configuration.TriggerType = ContainerAppJobTriggerType.Event;\n job.Configuration.EventTriggerConfig.Scale.Rules.Add(new ContainerAppJobScaleRule\n {\n Name = \"queue-rule\",\n JobScaleRuleType = \"azure-queue\",\n Metadata = new ObjectExpression(\n // Bicep expressions - referencing other resources dynamically\n new PropertyExpression(\"accountName\", new IdentifierExpression(accountNameParameter.BicepIdentifier)),\n new PropertyExpression(\"queueName\", new StringLiteralExpression(\"thumbnails\")),\n new PropertyExpression(\"queueLength\", new IntLiteralExpression(1)) // Start job when 1+ messages\n ),\n Identity = identityAnnotation.IdentityResource.Id.AsProvisioningParameter(infra) // Use managed identity\n });\n});\n```\n\nThis approach gives you full control over Azure resource configuration without waiting for Aspire abstractions to expose every feature. The C# strongly-typed APIs generate correct Bicep/ARM templates with automatic dependency tracking and parameter passing between resources. You can seamlessly mix high-level Aspire APIs with low-level Azure Provisioning when you need fine-grained control.\n\n**Dual-Mode Worker** - Continuous in run mode, event-triggered in publish mode:\n```csharp\n// AppHost: Set environment variable only in run mode\nif (builder.ExecutionContext.IsRunMode)\n{\n worker = worker.WithEnvironment(\"WORKER_RUN_CONTINUOUSLY\", \"true\");\n}\n\n// Worker: Adapt behavior based on mode\nif (_configuration.GetValue<bool>(\"WORKER_RUN_CONTINUOUSLY\"))\n{\n // Local dev: poll every 5 seconds, run forever\n await ExecuteContinuousAsync(stoppingToken);\n}\nelse\n{\n // Production: poll up to 2 times (5s intervals), exit when empty\n // MaxEmptyPolls = 2, EmptyPollWaitSeconds = 5\n await ExecuteScheduledAsync(stoppingToken);\n}\n```\n\n**Graceful Shutdown** - Event-triggered mode always stops, exceptions crash naturally:\n```csharp\nif (_configuration.GetValue<bool>(\"WORKER_RUN_CONTINUOUSLY\"))\n{\n // Continuous mode: run forever, let exceptions crash the app\n await ExecuteContinuousAsync(stoppingToken);\n}\nelse\n{\n try\n {\n // Event-triggered mode: process messages until queue empty, then shutdown\n await ExecuteScheduledAsync(stoppingToken);\n }\n finally\n {\n // Always stop application when done (success or exception)\n // New instances will start automatically when queue has messages\n _hostApplicationLifetime.StopApplication();\n }\n}\n```\n\n**Container Files Publishing** - Embed Vite build output in API container:\n```csharp\napi.PublishWithContainerFiles(frontend, \"wwwroot\");\n```\n\n## Performance & Cost Characteristics\n\n**Response Times:**\n- Thumbnail generation: typically ready within seconds of upload\n- Local development: instant feedback with continuous polling\n\n**Cost Optimization:**\n- **Compute**: API and worker scale to zero when idle (~5 seconds), only pay for active processing\n- **SQL**: Free tier with serverless auto-pause (GP_S_Gen5_2), free up to monthly limits\n- **Storage**: Pay only for blob storage used, queues/blobs have minimal costs at low volumes\n- **Result**: Can run entirely within Azure free tier limits\n\n**Further optimization:** Using SAS URLs instead of API blob streaming would eliminate compute/egress costs for serving images\n\n**Scalability:**\n- Parallel job instances spawn automatically for high queue depth\n- Batch processing (up to 10 messages per poll)\n- Managed identity eliminates secrets management overhead\n",
"readme": "# Image Gallery with Event-Triggered Azure Container Apps Jobs\n\nUpload images to Azure Blob Storage with queue-triggered thumbnail generation. Demonstrates event-driven Container Apps Jobs with queue-based autoscaling, managed identity authentication, and Azure SQL free tier - **can run entirely within Azure free tier limits**.\n\n## Architecture\n\n**Run Mode:**\n```mermaid\nflowchart LR\n Browser --> Vite[Vite Dev Server<br/>HMR enabled]\n Vite -->|Proxy /api| API[C# API]\n API --> Azurite[Azurite Emulator<br/>Blobs + Queues]\n API --> SQL[SQL Server]\n Worker[Background Worker<br/>Runs continuously] --> Azurite\n Worker --> SQL\n Azurite -.Queue Message.-> Worker\n```\n\n**Publish Mode:**\n```mermaid\nflowchart LR\n Browser --> API[C# API serving<br/>Vite build output<br/>'npm run build']\n API --> Blobs[Azure Blob Storage]\n API --> Queue[Azure Storage Queue]\n API --> SQL[Azure SQL]\n Job[Container Apps Job<br/>Event-triggered<br/>Scales on queue depth] --> Blobs\n Job --> SQL\n Queue -.Queue Trigger.-> Job\n```\n\n## How It Works\n\n### Event-Driven Thumbnail Processing\n\n1. **Upload**: User uploads image \u2192 API saves to Azure Blob Storage and metadata to Azure SQL\n2. **Queue**: API enqueues thumbnail generation message to Azure Storage Queue\n3. **Trigger**: Azure monitors queue depth and automatically starts a Container Apps Job instance\n4. **Process**: Job processes messages in batches (up to 10), generates thumbnails using SkiaSharp\n5. **Scale Down**: After 2 empty polls (~5 seconds), job exits; new instances start automatically when messages arrive\n\n### Local Development vs Production\n\n**Production (Event-Triggered):**\n- Job starts when queue depth > 0, exits within ~5 seconds when empty\n- API and worker both scale to zero when idle\n\n**Local Development (Continuous):**\n- Worker runs continuously, polls every 5 seconds\n- Instant feedback with Azurite emulator and SQL Server container\n\n## What This Demonstrates\n\n- **Event-Driven Jobs**: Container Apps Jobs with queue-based autoscaling rules using Azure.Provisioning APIs\n- **Dual-Mode Resources**: Azurite/SQL Server containers locally, Azure services in production (`.RunAsEmulator()`, `.RunAsContainer()`)\n- **Free Tier Deployment**: Azure SQL free tier with serverless auto-pause, Container Apps scale-to-zero\n- **Managed Identity**: Password-less authentication to all Azure resources (Storage, SQL, Queues)\n- **Polyglot Stack**: Vite+React frontend embedded in C# API container, SkiaSharp for image processing\n- **OpenTelemetry**: Distributed tracing across upload \u2192 queue \u2192 worker pipeline\n\n## Running Locally\n\n```bash\naspire run\n```\n\nNo Azure resources required - uses Azurite emulator and SQL Server container.\n\n## Deploying to Azure\n\n**Prerequisites for deployment:**\n- [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli)\n- [Azure subscription](https://azure.microsoft.com/free/)\n\n**Commands:**\n```bash\naspire run # Run locally with Azurite\naspire publish # Generate Bicep files to explore deployment artifacts (output in ./aspire-output)\naspire deploy # Deploy to Azure Container Apps\n```\n\n## Security Notes\n\n**Implemented:**\n- \u2705 **Managed Identity**: Password-less authentication to all Azure resources (no connection strings or secrets)\n- \u2705 **XSRF Protection**: Antiforgery tokens protect upload/delete endpoints from cross-site request forgery attacks ([docs](https://learn.microsoft.com/aspnet/core/security/anti-request-forgery))\n- \u2705 **Input Validation**: 10 MB file size limit, extension allowlist (.jpg, .jpeg, .png, .gif, .webp), and server-side image byte validation before saving or queueing uploads ([file upload security](https://learn.microsoft.com/aspnet/core/mvc/models/file-uploads))\n- \u2705 **Filename Sanitization**: Path traversal prevention, 255 char limit\n- \u2705 **Resource Limits**: Pagination (max 100 items), retry limits (3 attempts), size checks (20 MB max)\n\n**Not Implemented (Required for Production):**\n- \u274c **Authentication & Authorization**: Endpoints are public - anyone can upload/delete\n- \u274c **Rate Limiting**: No protection against abuse or DoS ([docs](https://learn.microsoft.com/aspnet/core/performance/rate-limit))\n- \u274c **Malware Scanning**: Image byte validation rejects unsupported or malformed images, but production upload workflows should consider malware scanning and the broader [ASP.NET Core security guidance](https://learn.microsoft.com/aspnet/core/security/)\n\n## Key Aspire Patterns\n\n**Azure Storage Emulation** - Automatic Azurite in run mode, real Azure in publish:\n```csharp\nvar storage = builder.AddAzureStorage(\"storage\").RunAsEmulator();\nvar blobs = storage.AddBlobContainer(\"images\");\nvar queues = storage.AddQueues(\"queues\");\n```\n\n**Azure SQL Dual Mode** - SQL Server container locally, Azure SQL free tier in production:\n```csharp\nvar sql = builder.AddAzureSqlServer(\"sql\")\n .RunAsContainer()\n .AddDatabase(\"imagedb\");\n```\n\nDefaults to Azure SQL free tier with serverless auto-pause (SKU: GP_S_Gen5_2).\n\n**Scale to Zero** - API only runs when handling requests:\n```csharp\napi.PublishAsAzureContainerApp((infra, app) =>\n{\n app.Template.Scale.MinReplicas = 0;\n});\n```\n\n**Event-Triggered Container App Job** - Direct control over Azure resources with Azure.Provisioning libraries:\n\nThis example demonstrates using the **Azure.Provisioning** libraries to directly configure low-level Azure resources (Bicep/ARM) from the AppHost. This provides complete flexibility and control when Aspire's higher-level APIs don't expose specific features.\n\n```csharp\nworker.PublishAsAzureContainerAppJob((infra, job) =>\n{\n // Direct access to Azure Provisioning APIs - full control over Bicep/ARM templates\n\n // Get storage account name for queue authentication\n var accountNameParameter = queues.Resource.Parent.NameOutputReference.AsProvisioningParameter(infra);\n\n // Configure event-driven trigger using Container Apps Job APIs\n job.Configuration.TriggerType = ContainerAppJobTriggerType.Event;\n job.Configuration.EventTriggerConfig.Scale.Rules.Add(new ContainerAppJobScaleRule\n {\n Name = \"queue-rule\",\n JobScaleRuleType = \"azure-queue\",\n Metadata = new ObjectExpression(\n // Bicep expressions - referencing other resources dynamically\n new PropertyExpression(\"accountName\", new IdentifierExpression(accountNameParameter.BicepIdentifier)),\n new PropertyExpression(\"queueName\", new StringLiteralExpression(\"thumbnails\")),\n new PropertyExpression(\"queueLength\", new IntLiteralExpression(1)) // Start job when 1+ messages\n ),\n Identity = identityAnnotation.IdentityResource.Id.AsProvisioningParameter(infra) // Use managed identity\n });\n});\n```\n\nThis approach gives you full control over Azure resource configuration without waiting for Aspire abstractions to expose every feature. The C# strongly-typed APIs generate correct Bicep/ARM templates with automatic dependency tracking and parameter passing between resources. You can seamlessly mix high-level Aspire APIs with low-level Azure Provisioning when you need fine-grained control.\n\n**Dual-Mode Worker** - Continuous in run mode, event-triggered in publish mode:\n```csharp\n// AppHost: Set environment variable only in run mode\nif (builder.ExecutionContext.IsRunMode)\n{\n worker = worker.WithEnvironment(\"WORKER_RUN_CONTINUOUSLY\", \"true\");\n}\n\n// Worker: Adapt behavior based on mode\nif (_configuration.GetValue<bool>(\"WORKER_RUN_CONTINUOUSLY\"))\n{\n // Local dev: poll every 5 seconds, run forever\n await ExecuteContinuousAsync(stoppingToken);\n}\nelse\n{\n // Production: poll up to 2 times (5s intervals), exit when empty\n // MaxEmptyPolls = 2, EmptyPollWaitSeconds = 5\n await ExecuteScheduledAsync(stoppingToken);\n}\n```\n\n**Graceful Shutdown** - Event-triggered mode always stops, exceptions crash naturally:\n```csharp\nif (_configuration.GetValue<bool>(\"WORKER_RUN_CONTINUOUSLY\"))\n{\n // Continuous mode: run forever, let exceptions crash the app\n await ExecuteContinuousAsync(stoppingToken);\n}\nelse\n{\n try\n {\n // Event-triggered mode: process messages until queue empty, then shutdown\n await ExecuteScheduledAsync(stoppingToken);\n }\n finally\n {\n // Always stop application when done (success or exception)\n // New instances will start automatically when queue has messages\n _hostApplicationLifetime.StopApplication();\n }\n}\n```\n\n**Container Files Publishing** - Embed Vite build output in API container:\n```csharp\napi.PublishWithContainerFiles(frontend, \"wwwroot\");\n```\n\n## Performance & Cost Characteristics\n\n**Response Times:**\n- Thumbnail generation: typically ready within seconds of upload\n- Local development: instant feedback with continuous polling\n\n**Cost Optimization:**\n- **Compute**: API and worker scale to zero when idle (~5 seconds), only pay for active processing\n- **SQL**: Free tier with serverless auto-pause (GP_S_Gen5_2), free up to monthly limits\n- **Storage**: Pay only for blob storage used, queues/blobs have minimal costs at low volumes\n- **Result**: Can run entirely within Azure free tier limits\n\n**Further optimization:** Using SAS URLs instead of API blob streaming would eliminate compute/egress costs for serving images\n\n**Scalability:**\n- Parallel job instances spawn automatically for high queue depth\n- Batch processing (up to 10 messages per poll)\n- Managed identity eliminates secrets management overhead\n",
"readmeRaw": "# Image Gallery with Event-Triggered Azure Container Apps Jobs\n\nUpload images to Azure Blob Storage with queue-triggered thumbnail generation. Demonstrates event-driven Container Apps Jobs with queue-based autoscaling, managed identity authentication, and Azure SQL free tier - **can run entirely within Azure free tier limits**.\n\n## Architecture\n\n**Run Mode:**\n```mermaid\nflowchart LR\n Browser --> Vite[Vite Dev Server<br/>HMR enabled]\n Vite -->|Proxy /api| API[C# API]\n API --> Azurite[Azurite Emulator<br/>Blobs + Queues]\n API --> SQL[SQL Server]\n Worker[Background Worker<br/>Runs continuously] --> Azurite\n Worker --> SQL\n Azurite -.Queue Message.-> Worker\n```\n\n**Publish Mode:**\n```mermaid\nflowchart LR\n Browser --> API[C# API serving<br/>Vite build output<br/>'npm run build']\n API --> Blobs[Azure Blob Storage]\n API --> Queue[Azure Storage Queue]\n API --> SQL[Azure SQL]\n Job[Container Apps Job<br/>Event-triggered<br/>Scales on queue depth] --> Blobs\n Job --> SQL\n Queue -.Queue Trigger.-> Job\n```\n\n## How It Works\n\n### Event-Driven Thumbnail Processing\n\n1. **Upload**: User uploads image \u2192 API saves to Azure Blob Storage and metadata to Azure SQL\n2. **Queue**: API enqueues thumbnail generation message to Azure Storage Queue\n3. **Trigger**: Azure monitors queue depth and automatically starts a Container Apps Job instance\n4. **Process**: Job processes messages in batches (up to 10), generates thumbnails using SkiaSharp\n5. **Scale Down**: After 2 empty polls (~5 seconds), job exits; new instances start automatically when messages arrive\n\n### Local Development vs Production\n\n**Production (Event-Triggered):**\n- Job starts when queue depth > 0, exits within ~5 seconds when empty\n- API and worker both scale to zero when idle\n\n**Local Development (Continuous):**\n- Worker runs continuously, polls every 5 seconds\n- Instant feedback with Azurite emulator and SQL Server container\n\n## What This Demonstrates\n\n- **Event-Driven Jobs**: Container Apps Jobs with queue-based autoscaling rules using Azure.Provisioning APIs\n- **Dual-Mode Resources**: Azurite/SQL Server containers locally, Azure services in production (`.RunAsEmulator()`, `.RunAsContainer()`)\n- **Free Tier Deployment**: Azure SQL free tier with serverless auto-pause, Container Apps scale-to-zero\n- **Managed Identity**: Password-less authentication to all Azure resources (Storage, SQL, Queues)\n- **Polyglot Stack**: Vite+React frontend embedded in C# API container, SkiaSharp for image processing\n- **OpenTelemetry**: Distributed tracing across upload \u2192 queue \u2192 worker pipeline\n\n## Running Locally\n\n```bash\naspire run\n```\n\nNo Azure resources required - uses Azurite emulator and SQL Server container.\n\n## Deploying to Azure\n\n**Prerequisites for deployment:**\n- [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli)\n- [Azure subscription](https://azure.microsoft.com/free/)\n\n**Commands:**\n```bash\naspire run # Run locally with Azurite\naspire publish # Generate Bicep files to explore deployment artifacts (output in ./aspire-output)\naspire deploy # Deploy to Azure Container Apps\n```\n\n## Security Notes\n\n**Implemented:**\n- \u2705 **Managed Identity**: Password-less authentication to all Azure resources (no connection strings or secrets)\n- \u2705 **XSRF Protection**: Antiforgery tokens protect upload/delete endpoints from cross-site request forgery attacks ([docs](https://learn.microsoft.com/aspnet/core/security/anti-request-forgery))\n- \u2705 **Input Validation**: 10 MB file size limit, extension allowlist (.jpg, .jpeg, .png, .gif, .webp), and server-side image byte validation before saving or queueing uploads ([file upload security](https://learn.microsoft.com/aspnet/core/mvc/models/file-uploads))\n- \u2705 **Filename Sanitization**: Path traversal prevention, 255 char limit\n- \u2705 **Resource Limits**: Pagination (max 100 items), retry limits (3 attempts), size checks (20 MB max)\n\n**Not Implemented (Required for Production):**\n- \u274c **Authentication & Authorization**: Endpoints are public - anyone can upload/delete\n- \u274c **Rate Limiting**: No protection against abuse or DoS ([docs](https://learn.microsoft.com/aspnet/core/performance/rate-limit))\n- \u274c **Malware Scanning**: Image byte validation rejects unsupported or malformed images, but production upload workflows should consider malware scanning and the broader [ASP.NET Core security guidance](https://learn.microsoft.com/aspnet/core/security/)\n\n## Key Aspire Patterns\n\n**Azure Storage Emulation** - Automatic Azurite in run mode, real Azure in publish:\n```csharp\nvar storage = builder.AddAzureStorage(\"storage\").RunAsEmulator();\nvar blobs = storage.AddBlobContainer(\"images\");\nvar queues = storage.AddQueues(\"queues\");\n```\n\n**Azure SQL Dual Mode** - SQL Server container locally, Azure SQL free tier in production:\n```csharp\nvar sql = builder.AddAzureSqlServer(\"sql\")\n .RunAsContainer()\n .AddDatabase(\"imagedb\");\n```\n\nDefaults to Azure SQL free tier with serverless auto-pause (SKU: GP_S_Gen5_2).\n\n**Scale to Zero** - API only runs when handling requests:\n```csharp\napi.PublishAsAzureContainerApp((infra, app) =>\n{\n app.Template.Scale.MinReplicas = 0;\n});\n```\n\n**Event-Triggered Container App Job** - Direct control over Azure resources with Azure.Provisioning libraries:\n\nThis example demonstrates using the **Azure.Provisioning** libraries to directly configure low-level Azure resources (Bicep/ARM) from the AppHost. This provides complete flexibility and control when Aspire's higher-level APIs don't expose specific features.\n\n```csharp\nworker.PublishAsAzureContainerAppJob((infra, job) =>\n{\n // Direct access to Azure Provisioning APIs - full control over Bicep/ARM templates\n\n // Get storage account name for queue authentication\n var accountNameParameter = queues.Resource.Parent.NameOutputReference.AsProvisioningParameter(infra);\n\n // Configure event-driven trigger using Container Apps Job APIs\n job.Configuration.TriggerType = ContainerAppJobTriggerType.Event;\n job.Configuration.EventTriggerConfig.Scale.Rules.Add(new ContainerAppJobScaleRule\n {\n Name = \"queue-rule\",\n JobScaleRuleType = \"azure-queue\",\n Metadata = new ObjectExpression(\n // Bicep expressions - referencing other resources dynamically\n new PropertyExpression(\"accountName\", new IdentifierExpression(accountNameParameter.BicepIdentifier)),\n new PropertyExpression(\"queueName\", new StringLiteralExpression(\"thumbnails\")),\n new PropertyExpression(\"queueLength\", new IntLiteralExpression(1)) // Start job when 1+ messages\n ),\n Identity = identityAnnotation.IdentityResource.Id.AsProvisioningParameter(infra) // Use managed identity\n });\n});\n```\n\nThis approach gives you full control over Azure resource configuration without waiting for Aspire abstractions to expose every feature. The C# strongly-typed APIs generate correct Bicep/ARM templates with automatic dependency tracking and parameter passing between resources. You can seamlessly mix high-level Aspire APIs with low-level Azure Provisioning when you need fine-grained control.\n\n**Dual-Mode Worker** - Continuous in run mode, event-triggered in publish mode:\n```csharp\n// AppHost: Set environment variable only in run mode\nif (builder.ExecutionContext.IsRunMode)\n{\n worker = worker.WithEnvironment(\"WORKER_RUN_CONTINUOUSLY\", \"true\");\n}\n\n// Worker: Adapt behavior based on mode\nif (_configuration.GetValue<bool>(\"WORKER_RUN_CONTINUOUSLY\"))\n{\n // Local dev: poll every 5 seconds, run forever\n await ExecuteContinuousAsync(stoppingToken);\n}\nelse\n{\n // Production: poll up to 2 times (5s intervals), exit when empty\n // MaxEmptyPolls = 2, EmptyPollWaitSeconds = 5\n await ExecuteScheduledAsync(stoppingToken);\n}\n```\n\n**Graceful Shutdown** - Event-triggered mode always stops, exceptions crash naturally:\n```csharp\nif (_configuration.GetValue<bool>(\"WORKER_RUN_CONTINUOUSLY\"))\n{\n // Continuous mode: run forever, let exceptions crash the app\n await ExecuteContinuousAsync(stoppingToken);\n}\nelse\n{\n try\n {\n // Event-triggered mode: process messages until queue empty, then shutdown\n await ExecuteScheduledAsync(stoppingToken);\n }\n finally\n {\n // Always stop application when done (success or exception)\n // New instances will start automatically when queue has messages\n _hostApplicationLifetime.StopApplication();\n }\n}\n```\n\n**Container Files Publishing** - Embed Vite build output in API container:\n```csharp\napi.PublishWithContainerFiles(frontend, \"wwwroot\");\n```\n\n## Performance & Cost Characteristics\n\n**Response Times:**\n- Thumbnail generation: typically ready within seconds of upload\n- Local development: instant feedback with continuous polling\n\n**Cost Optimization:**\n- **Compute**: API and worker scale to zero when idle (~5 seconds), only pay for active processing\n- **SQL**: Free tier with serverless auto-pause (GP_S_Gen5_2), free up to monthly limits\n- **Storage**: Pay only for blob storage used, queues/blobs have minimal costs at low volumes\n- **Result**: Can run entirely within Azure free tier limits\n\n**Further optimization:** Using SAS URLs instead of API blob streaming would eliminate compute/egress costs for serving images\n\n**Scalability:**\n- Parallel job instances spawn automatically for high queue depth\n- Batch processing (up to 10 messages per poll)\n- Managed identity eliminates secrets management overhead\n",
Comment on lines 384 to +389
"name": "rag-document-qa-svelte",
"title": "RAG Document Q&A with Svelte",
"description": "Upload documents and ask questions using Retrieval Augmented Generation with vector search.",
"href": "https://github.com/microsoft/aspire-samples/tree/main/samples/rag-document-qa-svelte",
"readme": "# RAG Document Q&A with Svelte\n\n![Screenshot of the RAG Document Q&A sample UI](~/assets/samples/rag-document-qa-svelte/rag-document-qa-svelte-primary-page.png)\n\nUpload documents and ask questions using Retrieval Augmented Generation with vector search.\n\n## Architecture\n\n**Run Mode:**\n```mermaid\nflowchart LR\n User --> Svelte[Vite Dev Server<br/>HMR enabled]\n Svelte -->|Proxy /api| API[FastAPI]\n API --> Qdrant[Qdrant Vector DB]\n API --> OpenAI[OpenAI API]\n```\n\n**Publish Mode:**\n```mermaid\nflowchart LR\n User --> API[FastAPI serving<br/>Vite build output<br/>'npm run build']\n API --> Qdrant[Qdrant Vector DB]\n API --> OpenAI[OpenAI API]\n```\n\n## What This Demonstrates\n\n- **RAG Pattern**: Document upload → chunk → embed → vector search → GPT answer\n- **addUvicornApp**: Python FastAPI backend with uv package manager\n- **addViteApp**: Svelte 5 frontend with Vite\n- **addQdrant**: Vector database for semantic search\n- **addOpenAI**: Secure API key management\n- **publishWithContainerFiles**: Frontend embedded in API for publish mode\n\n## Running\n\n```bash\naspire run\n```\n\nAspire will prompt for your OpenAI API key on first run.\n\n## Security Notes\n\nThis is a local-first sample, not a production-ready document service. Uploaded documents are untrusted input and the API only accepts UTF-8 `.txt` text uploads with size, chunk, question length, and per-client rate limits to reduce accidental OpenAI cost or quota burn.\n\nRAG apps can be affected by prompt injection and data disclosure risks because retrieved document text is placed into model context. The sample does not provide tenant isolation, document deletion controls, malware/content scanning, or durable data-retention policies.\n\nBefore adapting this for production, add real authentication and authorization, data retention and deletion workflows, monitoring, and malware/content scanning as appropriate for your data. Relevant references include [FastAPI security](https://fastapi.tiangolo.com/tutorial/security/), [OWASP LLM01 Prompt Injection](https://genai.owasp.org/llmrisk/llm01-prompt-injection/), [OWASP LLM02 Sensitive Information Disclosure](https://genai.owasp.org/llmrisk/llm022025-sensitive-information-disclosure/), [OWASP LLM08 Vector and Embedding Weaknesses](https://genai.owasp.org/llmrisk/llm082025-vector-and-embedding-weaknesses/), and OpenAI's [production best practices](https://developers.openai.com/api/docs/guides/production-best-practices) and [safety best practices](https://developers.openai.com/api/docs/guides/safety-best-practices).\n\n## Commands\n\n```bash\naspire run # Run locally\naspire deploy # Deploy to Docker Compose\naspire do docker-compose-down-dc # Teardown deployment\n```\n\n## Key Aspire Patterns\n\n**Static File Embedding** - Frontend proxied in run mode, embedded in publish mode:\n```ts\nconst openAiApiKey = await builder.addParameter(\"openai-api-key\", { secret: true });\nconst qdrant = await builder.addQdrant(\"qdrant\");\n\nawait builder.addOpenAI(\"openai\")\n .withApiKey(openAiApiKey);\n\nconst api = await builder.addUvicornApp(\"api\", \"./api\", \"main:app\")\n .withUv()\n .waitFor(qdrant)\n .withReference(qdrant)\n .withEnvironment(\"OPENAI_APIKEY\", openAiApiKey);\n\nconst frontend = await builder.addViteApp(\"frontend\", \"./frontend\")\n .withReference(api)\n .withUrl(\"\", { displayText: \"RAG UI\" });\n\nawait api.publishWithContainerFiles(frontend, \"public\");\n```\n\n**Python + uv** - Fast dependency installation from `pyproject.toml`\n\n**Vector Database** - `addQdrant()` for semantic search\n\n**OpenAI Integration** - `addOpenAI()` prompts for API key on first run\n",
"readmeRaw": "# RAG Document Q&A with Svelte\n\n![Screenshot of the RAG Document Q&A sample UI](./images/rag-document-qa-svelte-primary-page.png)\n\nUpload documents and ask questions using Retrieval Augmented Generation with vector search.\n\n## Architecture\n\n**Run Mode:**\n```mermaid\nflowchart LR\n User --> Svelte[Vite Dev Server<br/>HMR enabled]\n Svelte -->|Proxy /api| API[FastAPI]\n API --> Qdrant[Qdrant Vector DB]\n API --> OpenAI[OpenAI API]\n```\n\n**Publish Mode:**\n```mermaid\nflowchart LR\n User --> API[FastAPI serving<br/>Vite build output<br/>'npm run build']\n API --> Qdrant[Qdrant Vector DB]\n API --> OpenAI[OpenAI API]\n```\n\n## What This Demonstrates\n\n- **RAG Pattern**: Document upload → chunk → embed → vector search → GPT answer\n- **addUvicornApp**: Python FastAPI backend with uv package manager\n- **addViteApp**: Svelte 5 frontend with Vite\n- **addQdrant**: Vector database for semantic search\n- **addOpenAI**: Secure API key management\n- **publishWithContainerFiles**: Frontend embedded in API for publish mode\n\n## Running\n\n```bash\naspire run\n```\n\nAspire will prompt for your OpenAI API key on first run.\n\n## Security Notes\n\nThis is a local-first sample, not a production-ready document service. Uploaded documents are untrusted input and the API only accepts UTF-8 `.txt` text uploads with size, chunk, question length, and per-client rate limits to reduce accidental OpenAI cost or quota burn.\n\nRAG apps can be affected by prompt injection and data disclosure risks because retrieved document text is placed into model context. The sample does not provide tenant isolation, document deletion controls, malware/content scanning, or durable data-retention policies.\n\nBefore adapting this for production, add real authentication and authorization, data retention and deletion workflows, monitoring, and malware/content scanning as appropriate for your data. Relevant references include [FastAPI security](https://fastapi.tiangolo.com/tutorial/security/), [OWASP LLM01 Prompt Injection](https://genai.owasp.org/llmrisk/llm01-prompt-injection/), [OWASP LLM02 Sensitive Information Disclosure](https://genai.owasp.org/llmrisk/llm022025-sensitive-information-disclosure/), [OWASP LLM08 Vector and Embedding Weaknesses](https://genai.owasp.org/llmrisk/llm082025-vector-and-embedding-weaknesses/), and OpenAI's [production best practices](https://developers.openai.com/api/docs/guides/production-best-practices) and [safety best practices](https://developers.openai.com/api/docs/guides/safety-best-practices).\n\n## Commands\n\n```bash\naspire run # Run locally\naspire deploy # Deploy to Docker Compose\naspire do docker-compose-down-dc # Teardown deployment\n```\n\n## Key Aspire Patterns\n\n**Static File Embedding** - Frontend proxied in run mode, embedded in publish mode:\n```ts\nconst openAiApiKey = await builder.addParameter(\"openai-api-key\", { secret: true });\nconst qdrant = await builder.addQdrant(\"qdrant\");\n\nawait builder.addOpenAI(\"openai\")\n .withApiKey(openAiApiKey);\n\nconst api = await builder.addUvicornApp(\"api\", \"./api\", \"main:app\")\n .withUv()\n .waitFor(qdrant)\n .withReference(qdrant)\n .withEnvironment(\"OPENAI_APIKEY\", openAiApiKey);\n\nconst frontend = await builder.addViteApp(\"frontend\", \"./frontend\")\n .withReference(api)\n .withUrl(\"\", { displayText: \"RAG UI\" });\n\nawait api.publishWithContainerFiles(frontend, \"public\");\n```\n\n**Python + uv** - Fast dependency installation from `pyproject.toml`\n\n**Vector Database** - `addQdrant()` for semantic search\n\n**OpenAI Integration** - `addOpenAI()` prompts for API key on first run\n",
"readme": "# RAG Document Q&A with Svelte\n\n![Screenshot of the RAG Document Q&A sample UI](~/assets/samples/rag-document-qa-svelte/rag-document-qa-svelte-primary-page.png)\n\nUpload documents and ask questions using Retrieval Augmented Generation with vector search.\n\n## Architecture\n\n**Run Mode:**\n```mermaid\nflowchart LR\n User --> Svelte[Vite Dev Server<br/>HMR enabled]\n Svelte -->|Proxy /api| API[FastAPI]\n API --> Qdrant[Qdrant Vector DB]\n API --> OpenAI[OpenAI API]\n```\n\n**Publish Mode:**\n```mermaid\nflowchart LR\n User --> API[FastAPI serving<br/>Vite build output<br/>'npm run build']\n API --> Qdrant[Qdrant Vector DB]\n API --> OpenAI[OpenAI API]\n```\n\n## What This Demonstrates\n\n- **RAG Pattern**: Document upload \u2192 chunk \u2192 embed \u2192 vector search \u2192 GPT answer\n- **addUvicornApp**: Python FastAPI backend with uv package manager\n- **addViteApp**: Svelte 5 frontend with Vite\n- **addQdrant**: Vector database for semantic search\n- **addOpenAI**: Secure API key management\n- **publishWithContainerFiles**: Frontend embedded in API for publish mode\n\n## Running\n\n```bash\naspire run\n```\n\nAspire will prompt for your OpenAI API key on first run.\n\n## Security Notes\n\nThis is a local-first sample, not a production-ready document service. Uploaded documents are untrusted input and the API only accepts UTF-8 `.txt` text uploads with size, chunk, question length, and per-client rate limits to reduce accidental OpenAI cost or quota burn.\n\nRAG apps can be affected by prompt injection and data disclosure risks because retrieved document text is placed into model context. The sample does not provide tenant isolation, document deletion controls, malware/content scanning, or durable data-retention policies.\n\nBefore adapting this for production, add real authentication and authorization, data retention and deletion workflows, monitoring, and malware/content scanning as appropriate for your data. Relevant references include [FastAPI security](https://fastapi.tiangolo.com/tutorial/security/), [OWASP LLM01 Prompt Injection](https://genai.owasp.org/llmrisk/llm01-prompt-injection/), [OWASP LLM02 Sensitive Information Disclosure](https://genai.owasp.org/llmrisk/llm022025-sensitive-information-disclosure/), [OWASP LLM08 Vector and Embedding Weaknesses](https://genai.owasp.org/llmrisk/llm082025-vector-and-embedding-weaknesses/), and OpenAI's [production best practices](https://developers.openai.com/api/docs/guides/production-best-practices) and [safety best practices](https://developers.openai.com/api/docs/guides/safety-best-practices).\n\n## Commands\n\n```bash\naspire run # Run locally\naspire deploy # Deploy to Docker Compose\naspire do docker-compose-down-dc # Teardown deployment\n```\n\n## Key Aspire Patterns\n\n**Static File Embedding** - Frontend proxied in run mode, embedded in publish mode:\n```ts\nconst openAiApiKey = await builder.addParameter(\"openai-api-key\", { secret: true });\nconst qdrant = await builder.addQdrant(\"qdrant\");\n\nawait builder.addOpenAI(\"openai\")\n .withApiKey(openAiApiKey);\n\nconst api = await builder.addUvicornApp(\"api\", \"./api\", \"main:app\")\n .withUv()\n .waitFor(qdrant)\n .withReference(qdrant)\n .withEnvironment(\"OPENAI_APIKEY\", openAiApiKey);\n\nconst frontend = await builder.addViteApp(\"frontend\", \"./frontend\")\n .withReference(api)\n .withUrl(\"\", { displayText: \"RAG UI\" });\n\nawait api.publishWithContainerFiles(frontend, \"public\");\n```\n\n**Python + uv** - Fast dependency installation from `pyproject.toml`\n\n**Vector Database** - `addQdrant()` for semantic search\n\n**OpenAI Integration** - `addOpenAI()` prompts for API key on first run\n",
"readmeRaw": "# RAG Document Q&A with Svelte\n\n![Screenshot of the RAG Document Q&A sample UI](./images/rag-document-qa-svelte-primary-page.png)\n\nUpload documents and ask questions using Retrieval Augmented Generation with vector search.\n\n## Architecture\n\n**Run Mode:**\n```mermaid\nflowchart LR\n User --> Svelte[Vite Dev Server<br/>HMR enabled]\n Svelte -->|Proxy /api| API[FastAPI]\n API --> Qdrant[Qdrant Vector DB]\n API --> OpenAI[OpenAI API]\n```\n\n**Publish Mode:**\n```mermaid\nflowchart LR\n User --> API[FastAPI serving<br/>Vite build output<br/>'npm run build']\n API --> Qdrant[Qdrant Vector DB]\n API --> OpenAI[OpenAI API]\n```\n\n## What This Demonstrates\n\n- **RAG Pattern**: Document upload \u2192 chunk \u2192 embed \u2192 vector search \u2192 GPT answer\n- **addUvicornApp**: Python FastAPI backend with uv package manager\n- **addViteApp**: Svelte 5 frontend with Vite\n- **addQdrant**: Vector database for semantic search\n- **addOpenAI**: Secure API key management\n- **publishWithContainerFiles**: Frontend embedded in API for publish mode\n\n## Running\n\n```bash\naspire run\n```\n\nAspire will prompt for your OpenAI API key on first run.\n\n## Security Notes\n\nThis is a local-first sample, not a production-ready document service. Uploaded documents are untrusted input and the API only accepts UTF-8 `.txt` text uploads with size, chunk, question length, and per-client rate limits to reduce accidental OpenAI cost or quota burn.\n\nRAG apps can be affected by prompt injection and data disclosure risks because retrieved document text is placed into model context. The sample does not provide tenant isolation, document deletion controls, malware/content scanning, or durable data-retention policies.\n\nBefore adapting this for production, add real authentication and authorization, data retention and deletion workflows, monitoring, and malware/content scanning as appropriate for your data. Relevant references include [FastAPI security](https://fastapi.tiangolo.com/tutorial/security/), [OWASP LLM01 Prompt Injection](https://genai.owasp.org/llmrisk/llm01-prompt-injection/), [OWASP LLM02 Sensitive Information Disclosure](https://genai.owasp.org/llmrisk/llm022025-sensitive-information-disclosure/), [OWASP LLM08 Vector and Embedding Weaknesses](https://genai.owasp.org/llmrisk/llm082025-vector-and-embedding-weaknesses/), and OpenAI's [production best practices](https://developers.openai.com/api/docs/guides/production-best-practices) and [safety best practices](https://developers.openai.com/api/docs/guides/safety-best-practices).\n\n## Commands\n\n```bash\naspire run # Run locally\naspire deploy # Deploy to Docker Compose\naspire do docker-compose-down-dc # Teardown deployment\n```\n\n## Key Aspire Patterns\n\n**Static File Embedding** - Frontend proxied in run mode, embedded in publish mode:\n```ts\nconst openAiApiKey = await builder.addParameter(\"openai-api-key\", { secret: true });\nconst qdrant = await builder.addQdrant(\"qdrant\");\n\nawait builder.addOpenAI(\"openai\")\n .withApiKey(openAiApiKey);\n\nconst api = await builder.addUvicornApp(\"api\", \"./api\", \"main:app\")\n .withUv()\n .waitFor(qdrant)\n .withReference(qdrant)\n .withEnvironment(\"OPENAI_APIKEY\", openAiApiKey);\n\nconst frontend = await builder.addViteApp(\"frontend\", \"./frontend\")\n .withReference(api)\n .withUrl(\"\", { displayText: \"RAG UI\" });\n\nawait api.publishWithContainerFiles(frontend, \"public\");\n```\n\n**Python + uv** - Fast dependency installation from `pyproject.toml`\n\n**Vector Database** - `addQdrant()` for semantic search\n\n**OpenAI Integration** - `addOpenAI()` prompts for API key on first run\n",
@IEvangelist
David Pine (IEvangelist) enabled auto-merge (squash) June 2, 2026 17:30
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Frontend HTML artifact ready

The latest frontend build uploaded the frontend-dist artifact for PR #1189. Use the VS Code button below to open this PR with GitHub Artifacts Explorer and browse the built HTML locally.

VS Code: Open PR #1189 artifacts

This comment updates automatically when a new frontend build artifact is uploaded.

@IEvangelist
David Pine (IEvangelist) merged commit 9c3243c into main Jun 2, 2026
10 checks passed
@IEvangelist
David Pine (IEvangelist) deleted the dapine/fix-sample-readme-typos branch June 2, 2026 17:42
David Pine (IEvangelist) added a commit that referenced this pull request Jun 5, 2026
Regenerates `src/frontend/src/data/samples.json` from microsoft/aspire-samples#1668 (`Update samples for Aspire 13.3 APIs`) so the sample detail pages on aspire.dev pick up the new APIs that PR exercises.

Notable AppHost-code changes mirrored into the data file:

- `aspire-with-azure-functions`: uses `WithComputeEnvironment(env)` and switches `AddAzureFunctionsProject` to the typed-name overload.

- `aspire-with-javascript`: adds `WithBrowserLogs()` for Angular/React/Vue/Vite, swaps `PublishAsDockerFile` for `PublishAsStaticWebsite`, and adds `WithNpm(installCommand: \"ci\")` for npm-ci installs.

- `aspire-with-node`: adds `WithBrowserLogs()` to the Node frontend.

- `aspire-with-python`: adds `Aspire.Hosting.Browsers` package reference and `WithBrowserLogs()` + `PublishAsStaticWebsite` on the Vite frontend.

- `image-gallery`: switches to `WithComputeEnvironment(env)` and the typed-name `AddAzureFunctionsProject` overload (plus README updates).

- `node-express-redis` / `polyglot-task-queue` / `rag-document-qa-svelte` / `vite-csharp-postgres` / `vite-react-fastapi` / `vite-yarp-static`: pick up TypeScript AppHost `apphost.mts` updates and `aspire.config.json` additions.

- `health-checks-ui` / `custom-resources`: pick up new `TestResource` plumbing and AppHost updates.

Also normalizes a handful of em-dash characters from `\\u2014` ASCII-escapes back to literal Unicode (artifact from an earlier intermediate edit by the typo-fix script in #1189); `update-samples.ts` natively writes literal Unicode, so this restores the file to the script's native output format. JSON parses identically either way.

Generated by temporarily pointing `update-samples.ts` at the PR's head branch (`ievangelist/dapine-aspire-api-updates`) via a `SAMPLES_BRANCH` env-var override, then reverting the script edit. `href` fields remain anchored to `tree/main` so links keep working after #1668 merges.

Verified: 62/62 `custom-components.vitest.test.ts` pass, `pnpm lint` clean, `samples.json` parses (26 samples).

Co-authored-by: David Pine <[email protected]>
Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants