<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jamal Alsofy</title>
    <description>The latest articles on DEV Community by Jamal Alsofy (@jamalalsofy).</description>
    <link>https://dev.to/jamalalsofy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1144422%2F35e0c85e-625b-4069-83d2-0c3b840e178c.jpeg</url>
      <title>DEV Community: Jamal Alsofy</title>
      <link>https://dev.to/jamalalsofy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jamalalsofy"/>
    <language>en</language>
    <item>
      <title>Building High-Performance Full-Stack Applications with Angular v20 and .NET 9</title>
      <dc:creator>Jamal Alsofy</dc:creator>
      <pubDate>Fri, 29 Aug 2025 20:59:00 +0000</pubDate>
      <link>https://dev.to/jamalalsofy/building-high-performance-apps-with-angular-v20-and-net-9-3hjd</link>
      <guid>https://dev.to/jamalalsofy/building-high-performance-apps-with-angular-v20-and-net-9-3hjd</guid>
      <description>&lt;p&gt;In today's fast-paced digital landscape, developers need robust frameworks that deliver exceptional performance, security, and maintainability. The combination of &lt;strong&gt;Angular v20&lt;/strong&gt; for the front-end and &lt;strong&gt;.NET 9&lt;/strong&gt; with &lt;strong&gt;ASP.NET Core Web API&lt;/strong&gt; for the back-end provides a powerful stack for building modern web applications. In this article, we'll explore how to leverage the latest features of both technologies to create high-performance applications with excellent developer experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Architecture and Design Philosophy&lt;/strong&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Separation of Concerns
&lt;/h2&gt;

&lt;p&gt;Maintain clear separation between UI, API, and business logic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Angular&lt;/strong&gt; handles UX, rendering, and client-side caching&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ASP.NET Core&lt;/strong&gt; manages data, authentication, server-side caching, telemetry, and business rules&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Contract-First Development
&lt;/h2&gt;

&lt;p&gt;.NET 9 includes built-in OpenAPI support, enabling you to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Expose clear API contracts&lt;/li&gt;
&lt;li&gt;Generate typed clients in Angular&lt;/li&gt;
&lt;li&gt;Run contract tests during CI/CD&lt;/li&gt;
&lt;li&gt;Ensure API consistency across front-end and back-end&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Deployment Options
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Decoupled&lt;/strong&gt;: Serve Angular from CDN (ideal for scaling) with API behind load balancers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monolithic&lt;/strong&gt;: Use .NET 9's MapStaticAssets() to serve Angular builds with optimized static file delivery (build-time compression, content-based ETags, and fingerprinting)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Angular v20: Modern Front-End Development&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Angular v20 introduces several groundbreaking features that significantly improve performance and developer experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features and Patterns
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Signals for Fine-Grained Reactivity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;typescript&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Using Signals for state management
import { signal, computed } from '@angular/core';

export class CartService {
  items = signal&amp;lt;Item[]&amp;gt;([]);
  total = computed(() =&amp;gt; 
    this.items().reduce((sum, item) =&amp;gt; sum + item.price, 0)
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Signals provide a single source of truth, reduce unnecessary change detection cycles, and offer clearer dependency graphs compared to traditional RxJS approaches.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTP Resource for Reactive Data Fetching&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;typescript&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Product component using httpResource
import { Component, signal } from '@angular/core';
import { httpResource } from '@angular/common/http';

@Component({
  standalone: true,
  template: `
    &amp;lt;div *ngIf="products.hasValue()"&amp;gt;
      &amp;lt;div *ngFor="let p of products.value()"&amp;gt;
        {{ p.name }} — {{ p.price | currency }}
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div *ngIf="products.isLoading()"&amp;gt;Loading…&amp;lt;/div&amp;gt;
  `
})
export class ProductListComponent {
  page = signal(1);
  products = httpResource(() =&amp;gt; `/api/products?page=${this.page()}`);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The httpResource pattern provides reactive data fetching with built-in loading states, error handling, and request cancellation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Zoneless Change Detection&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;typescript&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Enable zoneless mode in bootstrap
import { bootstrapApplication } from '@angular/platform-browser';
import { provideZonelessChangeDetection } from '@angular/core';

bootstrapApplication(AppComponent, {
  providers: [provideZonelessChangeDetection()]
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Zoneless mode eliminates zone.js overhead, reducing bundle size and improving runtime performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server-Side Rendering with Incremental Hydration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;typescript&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Enable incremental hydration
import { provideClientHydration, withIncrementalHydration } from '@angular/platform-browser';

bootstrapApplication(AppComponent, {
  providers: [
    provideClientHydration(withIncrementalHydration())
  ]
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Incremental hydration improves perceived performance by hydrating only the visible parts of the page first.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;.NET 9: High-Performance Back-End Development&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;.NET 9 brings significant improvements for building fast, secure, and scalable APIs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features and Patterns
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Native AOT Compilation&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;xml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Enable Native AOT in .csproj --&amp;gt;
&amp;lt;PropertyGroup&amp;gt;
  &amp;lt;PublishAot&amp;gt;true&amp;lt;/PublishAot&amp;gt;
&amp;lt;/PropertyGroup&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Native AOT produces self-contained, native binaries that offer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduced startup time&lt;/li&gt;
&lt;li&gt;Lower memory footprint&lt;/li&gt;
&lt;li&gt;Smaller deployment size&lt;/li&gt;
&lt;li&gt;Ideal for microservices and serverless environments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Built-in OpenAPI Support&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;csharp&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Program.cs
using Microsoft.AspNetCore.OpenApi;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddOpenApi();

var app = builder.Build();
if (app.Environment.IsDevelopment())
    app.MapOpenApi(); // Exposes openapi.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.NET 9's built-in OpenAPI support simplifies API documentation and client generation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HybridCache for Optimal Performance&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;csharp&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Program.cs
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Caching.StackExchangeRedis;

builder.Services.AddStackExchangeRedisCache(options =&amp;gt; 
    options.Configuration = builder.Configuration.GetConnectionString("Redis"));
builder.Services.AddMemoryCache();
builder.Services.AddHybridCache();

// Controller usage
app.MapGet("/api/products", async (IHybridCache cache, IProductRepo repo) =&amp;gt;
{
    return await cache.GetOrCreateAsync("products:all", 
        async _ =&amp;gt; await repo.GetAllAsync(), 
        TimeSpan.FromSeconds(30));
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;HybridCache&lt;/em&gt; combines in-memory and distributed caching strategies for optimal performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Optimized Static Asset Delivery&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;csharp&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Serve optimized static assets
app.MapStaticAssets();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;MapStaticAssets()&lt;/em&gt; provides build-time compression, content-based ETags, and fingerprinting for optimal static file delivery.&lt;/p&gt;

&lt;h2&gt;
  
  
  Security Best Practices
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Authentication and Authorization&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;csharp&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// JWT Authentication setup
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
    .AddJwtBearer(options =&amp;gt; {
        options.Authority = builder.Configuration["Auth:Authority"];
        options.Audience = builder.Configuration["Auth:Audience"];
        options.RequireHttpsMetadata = true;
    });

// CORS policy
builder.Services.AddCors(options =&amp;gt; 
    options.AddPolicy("frontend", policy =&amp;gt;
        policy.WithOrigins("https://yourdomain.com")
              .AllowAnyHeader()
              .AllowAnyMethod()));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Content Security Policy
&lt;/h2&gt;

&lt;p&gt;Implement CSP headers to restrict script execution sources and prevent XSS attacks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Input Validation and Sanitization&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;csharp&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Model validation
public record ProductDto(
    [Required] string Name,
    [Range(0, 1000)] decimal Price);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lever Angular's DOM sanitization and .NET's model validation to protect against injection attacks.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Performance Optimization Checklist&lt;/strong&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Front-End (Angular)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use AOT compilation and tree-shaking&lt;/li&gt;
&lt;li&gt;Implement lazy loading for routes&lt;/li&gt;
&lt;li&gt;Leverage signals for fine-grained reactivity&lt;/li&gt;
&lt;li&gt;Enable zoneless change detection&lt;/li&gt;
&lt;li&gt;Utilize httpResource for efficient data fetching&lt;/li&gt;
&lt;li&gt;Implement incremental hydration for SSR&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Back-End (.NET 9)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use Native AOT for reduced startup time&lt;/li&gt;
&lt;li&gt;Implement HybridCache for frequently accessed data&lt;/li&gt;
&lt;li&gt;Enable response compression&lt;/li&gt;
&lt;li&gt;Use EF Core performance improvements in .NET 9&lt;/li&gt;
&lt;li&gt;Implement health checks and monitoring&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Development and Maintenance&lt;/strong&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  CI/CD Pipeline
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Generate OpenAPI documentation during build&lt;/li&gt;
&lt;li&gt;Run contract tests to ensure API consistency&lt;/li&gt;
&lt;li&gt;Use Angular's build optimizer and .NET's publish optimizations&lt;/li&gt;
&lt;li&gt;Implement security scanning in the pipeline&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Observability
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;csharp&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// OpenTelemetry setup
builder.Services.AddOpenTelemetry()
    .WithMetrics(metrics =&amp;gt; metrics
        .AddAspNetCoreInstrumentation()
        .AddHttpClientInstrumentation())
    .WithTracing(tracing =&amp;gt; tracing
        .AddAspNetCoreInstrumentation()
        .AddHttpClientInstrumentation());
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Implement comprehensive logging, metrics, and tracing using OpenTelemetry for end-to-end observability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The combination of Angular v20 and .NET 9 provides a powerful foundation for building high-performance, secure, and maintainable web applications. By leveraging the latest features such as signals, zoneless change detection, Native AOT, and HybridCache, developers can create applications that excel in performance while maintaining excellent developer experience.&lt;/p&gt;

&lt;p&gt;Remember to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Follow security best practices for both front-end and back-end&lt;/li&gt;
&lt;li&gt;Implement comprehensive monitoring and observability&lt;/li&gt;
&lt;li&gt;Use contract-first development with OpenAPI&lt;/li&gt;
&lt;li&gt;Optimize deployment strategy based on your specific needs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This powerful combination enables teams to deliver exceptional user experiences while maintaining high development velocity.&lt;/p&gt;

&lt;p&gt;By implementing these patterns and leveraging the latest features of both frameworks, you can build applications that are not only performant and secure but also maintainable and scalable as your project grows.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
