EDC Real Estate Platform - Architecture Analysis
The EDC Real Estate Platform is a sophisticated enterprise solution that seamlessly integrates modern React frontend development with the robust content management capabilities of Umbraco CMS. This architecture analysis provides a comprehensive overview of the system's design, implementation, and strategic recommendations.
Technology Stack Overview
- Backend: .NET 6, Umbraco CMS 13.4, ASP.NET Core MVC, Redis Cache
- Frontend: React 18.2, TypeScript 4.8, Vite 3.2, Tailwind CSS 3.2
- Integration: Node.js SSR, Jering.Javascript.NodeJS, AutoMapper
- Infrastructure: Azure Blob Storage, SQL Server, Hangfire
Key Capabilities
System Metrics & Performance
Code Statistics
- Total React Modules: 200+ unique components
- ViewModelBuilderServices: 50+ services
- API Controllers: 25+ REST endpoints
- Converters: 100+ Umbraco to React converters
- Test Coverage: Unit tests for critical paths
System Architecture
High-Level Architecture
Solution Structure
EDC.EDCDK.Website/
├── Edc.Website.Core/ # Core business logic
│ ├── Models/
│ │ ├── Umbraco/ # Auto-generated Umbraco models
│ │ └── Converters/ # Umbraco to React converters
│ ├── Rendering/
│ │ ├── Services/ # ViewModelBuilderServices
│ │ └── Controllers/ # MVC controllers
│ ├── ContentFinders/ # Custom routing logic
│ └── NodeJsRenderer/ # TagHelper implementations
│
├── Edc.Website.WebCore/ # ASP.NET Core application
│ ├── Views/ # Razor views
│ ├── static/ # Compiled frontend assets
│ └── appsettings.json # Configuration
│
├── Edc.Website.RestIntegration/ # REST API layer
│ └── Services/ # External API services
│
└── Frontend/ # React application
├── src/
│ ├── modules/ # React modules
│ ├── pages/ # Page components
│ ├── components/ # Shared components
│ └── view-models/ # TypeScript interfaces
└── package.json # Dependencies
Key Architectural Patterns
1. ViewModelBuilder Pattern
Each Umbraco document type has a corresponding ViewModelBuilderService that orchestrates the entire page build process:
- BuildModel(): Main orchestration method
- BuildMeta(): SEO metadata construction
- BuildHeader(): Navigation and user context
- BuildPageModules(): Converts Umbraco blocks to React modules
- BuildFooter(): Footer ViewModel creation
- EnrichModelDataAsync(): Page-specific data enrichment
2. Converter Pattern
Systematic transformation of Umbraco content to React-compatible ViewModels:
- Element Converters: Individual Umbraco elements
- Composition Converters: Umbraco compositions
- Page Converters: Complete page types
3. ContentFinder Pattern
Custom routing logic for complex URL patterns:
- Case URLs (numeric, GUID, standard, business, project)
- Agency pages
- SEO landing pages
- Dynamic content resolution
Deep Dive: React Module Rendering System
This section provides an in-depth analysis of how the system transforms a C# List<ReactViewModelBase>
into rendered React components through the Node.js bridge.
A. Module Name Resolution Pipeline
1. ViewModel Declaration with ModuleTypeAttribute
// Generated C# ViewModel
namespace React.Models
{
[ModuleType(ModuleTypes.AgentBlocks)] // Maps to React module name
public partial class AgentBlocksViewModel : ReactViewModelBase
{
public virtual List<AgentViewModel> Agents { get; set; }
}
}
2. ModuleName Resolution
public abstract partial class ReactViewModelBase
{
private string? _moduleName;
public virtual string ModuleName
{
get => _moduleName ?? this.ToReactModuleType().ToString();
// Uses reflection to get ModuleTypeAttribute value
set => _moduleName = value;
}
}
3. Extension Method for Type Resolution
public static ModuleTypes ToReactModuleType(this object viewModel)
{
if (Attribute.GetCustomAttribute(viewModel.GetType(),
typeof(ModuleTypeAttribute)) is ModuleTypeAttribute moduleTypeAttribute)
{
return moduleTypeAttribute.ModuleType;
}
return ModuleTypes.Unknown;
}
B. TagHelper Rendering Flow
1. Razor Template Iteration
@model List<ReactViewModelBase>
@foreach (var module in Model.OrDefault().Where(x => !x.Hide))
{
<react-module model="@module" /> @* Each module rendered generically *@
}
2. ReactModuleTagHelper Processing
public class ReactModuleTagHelper : TagHelper
{
public ReactViewModelBase? Model { get; set; }
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
output.TagName = null; // Remove the tag wrapper
if (Model == null) return;
// Check if using Razor fallback
if (Model.UseRazor == true)
{
// Render using traditional Razor partial
var partial = await _htmlHelper.PartialAsync(Model.ModuleName, Model);
output.Content.SetHtmlContent(partial);
}
else
{
// Generate cache key based on module name and content hash
var key = CacheHelper.MakeKey(Model.ModuleName, Model.ComputeHash().ToString());
try
{
// Populate translations for the module
await PopulateViewModelTranslations(Model);
// Invoke Node.js to render the React module
var renderedReact = await _cacheService.GetUsingCacheAsync(key,
async () => await _nodeJsService.InvokeFromFileAsync<string>(
"./static/server/entry-server.js",
"renderModule",
args: [Model.ModuleName, Model, pageConfig]
)
);
output.Content.SetHtmlContent(renderedReact);
}
catch (Exception ex)
{
_logger.LogError(ex, "TagHelper error in {ReactModule}", Model.ModuleName);
}
}
}
}
C. Node.js Bridge & Module Resolution
1. Node.js Entry Point
import { getModule } from '@/generated/modules-map';
import { ssrModule } from '@/core/SsrModule';
/**
* Render a module to an HTML block
* Called from C# via Jering.Javascript.NodeJS
*/
export async function renderModule(
name: ModuleTypes,
props: Object,
siteConfig: SiteConfigViewModel = {}
) {
if (name === 'Unknown') return '';
// Dynamically load the React module
const module = await getModule(name);
// Server-side render the module
return await ssrModule(name, module, props, siteConfig);
}
2. Dynamic Module Loading
// GENERATED FILE - Created by build process
const modulesMap: Partial<Record<ModuleTypes, () => Promise<ModuleInterface>>> = {
// Maps module names to dynamic imports
AgentBlocks: () => import('@/modules/agents/AgentBlocks/AgentBlocks'),
CaseHero: () => import('@/modules/cases/CaseHero/CaseHero'),
Header: () => import('@/modules/header/Header/Header'),
Footer: () => import('@/modules/footer/Footer/Footer'),
// ... 200+ more modules
};
export async function getModule(name: ModuleTypes): Promise<ModuleInterface> {
const module = modulesMap[name];
return module ? await module() : {};
}
D. Server-Side Rendering Process
1. SSR Module Function
export async function ssrModule(
name: string,
module: ModuleInterface,
props: ModuleProps = {},
siteConfig: SiteConfigViewModel = {}
) {
const { default: Module, config = {} } = module;
// Initialize i18n with translations
initTranslations(props.translations, siteConfig.language);
if (Module) {
const { serverOnly, clientOnly, className } = parseModuleConfig(config, props);
const id = crypto.randomBytes(8).toString('hex');
// Render React component to HTML
const output = !clientOnly
? await renderToHtmlWritable(
<ModuleDecorators siteConfig={siteConfig} moduleConfig={config}>
<Module {...props} />
</ModuleDecorators>,
{ identifierPrefix: id }
)
: '';
// Create hydration script with serialized props
const script = `<script type="application/json">${JSON.stringify(props)}</script>`;
// Return complete HTML with hydration markers
return `<div data-module="${name}" data-id="${id}">${output}</div>${script}`;
}
throw new Error(`Unknown module "${name}"`);
}
E. Complete Flow Example
Key Insights
Deep Dive: Umbraco to React Model Conversion
This section provides an in-depth analysis of how Umbraco-generated content models are transformed into React ViewModels through a sophisticated converter system, enabling seamless integration between the CMS backend and React frontend.
A. Architecture Overview
┌─────────────────────┐
│ Umbraco CMS │
│ Content Types │
└──────────┬──────────┘
│ ModelsBuilder
↓
┌─────────────────────┐
│ Generated Models │
│ (*.generated.cs) │
│ PublishedElement │
└──────────┬──────────┘
│
↓
┌─────────────────────┐
│ ConversionService │
│ + TypeRegistry │
└──────────┬──────────┘
│ Auto-discovery
↓
┌─────────────────────┐
│ Converter Classes │
│ PublishedConverter │
│ Base │
└──────────┬──────────┘
│ Transform
↓
┌─────────────────────┐
│ React ViewModels │
│ ReactViewModelBase │
│ [ModuleType] │
└──────────┬──────────┘
│
↓
┌─────────────────────┐
│ Node.js Bridge │
│ React Components │
└─────────────────────┘
B. Umbraco Generated Models
1. Auto-Generated Model Structure
// Auto-generated by Umbraco.ModelsBuilder
namespace Edc.Website.Core.Models.Umbraco
{
[PublishedModel("agentListElement")]
public partial class AgentListElement : PublishedElementModel
{
// Properties mapped from CMS fields
[ImplementPropertyType("agents")]
public virtual List<DropdownListItem> Agents =>
this.Value<List<DropdownListItem>>(_publishedValueFallback, "agents");
}
}
Umbraco's ModelsBuilder automatically generates strongly-typed C# classes from CMS content types.
These models inherit from PublishedElementModel or PublishedContentModel
and represent the raw CMS data structure.
C. React ViewModels with Module Binding
1. Generated React ViewModel
// Generated from TypeScript definitions
namespace React.Models
{
[ModuleType(ModuleTypes.AgentBlocks)] // Binds to React component
public partial class AgentBlocksViewModel : ReactViewModelBase
{
public virtual List<AgentViewModel> Agents { get; set; }
}
}
2. ReactViewModelBase - The Foundation
public abstract partial class ReactViewModelBase
{
private string? _moduleName;
// Dynamically resolves module name from attribute
public virtual string ModuleName
{
get => _moduleName ?? this.ToReactModuleType().ToString();
set => _moduleName = value;
}
public virtual bool Hide { get; set; }
public virtual bool? UseRazor => null; // Rendering strategy
}
3. Module Type Resolution
public static ModuleTypes ToReactModuleType(this object viewModel)
{
if (Attribute.GetCustomAttribute(viewModel.GetType(),
typeof(ModuleTypeAttribute)) is ModuleTypeAttribute moduleTypeAttribute)
{
return moduleTypeAttribute.ModuleType;
}
return ModuleTypes.Unknown;
}
D. Converter Classes - The Bridge
1. Converter Implementation
public class AgentListElementConverter :
PublishedConverterBase<AgentListElement, AgentBlocksViewModel>
{
private readonly IEdcCoreEmployeeService _employeeService;
private readonly IHttpContextAccessor _httpContextAccessor;
public override async Task<AgentBlocksViewModel> ConvertAsync(
AgentListElement element)
{
// Context-aware conversion
var httpContext = _httpContextAccessor.GetRequiredHttpContext();
var contentAlias = GetCurrentPageAlias();
IEnumerable<Guid>? agentIds = null;
// Different behavior based on page type
if (contentAlias == CaseViewPage.ModelTypeAlias)
{
// Get agents from case data in context
var caseData = httpContext.GetContextItem<CaseDataDto>();
agentIds = caseData?.Agents;
}
else if (element.Agents.HasElements())
{
// Use CMS-configured agents
agentIds = element.Agents.Select(x => new Guid(x.Id));
}
// Fetch and enrich agent data
var agents = await _employeeService.GetManyByIdsAsync(agentIds);
var viewModels = await BuildAgentViewModels(agents);
return new AgentBlocksViewModel
{
Agents = viewModels.ToList()
};
}
}
2. Base Converter Class
public abstract class PublishedConverterBase<TPublishedElement, TViewModel> :
EdcTypeConverter
where TPublishedElement : IPublishedElement
where TViewModel : class
{
public abstract Task<TViewModel> ConvertAsync(TPublishedElement element);
public override async Task<object?> ConvertFromAsync(object value)
{
if (value is TPublishedElement model)
{
return await ConvertAsync(model);
}
return default;
}
}
E. Conversion Service Orchestration
1. ConversionService Implementation
public class ConversionService : IConversionService
{
private readonly ITypeConvertersRegistry _registry;
private readonly IServiceProvider _serviceProvider;
public async Task<List<ReactViewModelBase>> ConvertBlocklistAsync(
BlockListModel? model)
{
if (model == null || !model.Any())
return [];
// Convert each block in parallel
var results = await Task.WhenAll(
model.Select(async blockListItem =>
await ConvertBlockAsync(blockListItem) as ReactViewModelBase
));
return results.WhereNotNull().ToList();
}
public async Task<object?> ConvertBlockAsync(BlockListItem item)
{
// Get converter for the content type
if (TryGetConverter(item.Content.GetType(), out var converter))
{
return await converter!.ConvertFromAsync(item.Content);
}
return default;
}
}
2. Auto-Registration of Converters
public static class PublishedConverterBaseRegistrar
{
public static void RegisterTypeConverters(
this IServiceCollection services)
{
var convertersRegistry = new TypeConvertersRegistry();
services.AddSingleton<ITypeConvertersRegistry>(convertersRegistry);
// Find all converter classes via reflection
var typesToRegister = Assembly.GetExecutingAssembly().GetTypes()
.Where(t => !t.IsAbstract
&& !t.IsInterface
&& t.BaseType != null
&& t.BaseType.IsGenericType
&& t.BaseType.GetGenericTypeDefinition() ==
typeof(PublishedConverterBase<,>));
foreach (var typeToRegister in typesToRegister)
{
var genericArguments = typeToRegister.BaseType.GetGenericArguments();
var elementType = genericArguments[0]; // Input type
var viewModelType = genericArguments[1]; // Output type
// Register mapping
convertersRegistry.Register(elementType, typeToRegister);
services.AddSingleton(typeToRegister);
}
}
}
F. Complete Conversion Flow
1. Page Request
└─> ContentFinder identifies page
2. Umbraco Content Retrieval
└─> IPublishedContent with BlockListModel
3. ViewModelBuilder.BuildPageModules()
└─> ConversionService.ConvertBlocklistAsync(pageModuleList)
4. For Each Block:
├─> Identify Umbraco Element Type (e.g., AgentListElement)
├─> Registry Lookup → Find Converter (AgentListElementConverter)
├─> Instantiate Converter with DI
└─> Execute ConvertAsync()
├─> Read CMS Properties
├─> Check Page Context
├─> Fetch External Data (if needed)
└─> Transform to ViewModel
5. Return List<ReactViewModelBase>
└─> Each with ModuleName from [ModuleType] attribute
6. Razor View Renders
└─> <react-module> tags with ViewModels
7. Node.js Bridge
└─> ModuleName → React Component mapping
8. React Component Renders
└─> Receives typed props from ViewModel
G. Key Design Benefits
🔒 Type Safety
Strong typing from CMS to React components ensures compile-time safety and IDE support throughout the pipeline.
🎯 Separation of Concerns
Umbraco models represent CMS structure while React ViewModels represent UI needs, with converters bridging the gap.
🔄 Context Awareness
Converters can adapt their output based on the current page type, HTTP context, or user state.
⚡ Async Support
Full async/await support allows converters to fetch external data without blocking the rendering pipeline.
🔍 Auto-Discovery
Converters are automatically discovered and registered via reflection, reducing boilerplate and configuration.
🧩 Extensibility
New converters can be added simply by inheriting from PublishedConverterBase without modifying existing code.
H. Performance Considerations
- Parallel Processing: BlockList items are converted in parallel using Task.WhenAll
- Singleton Converters: Converters are registered as singletons for efficiency
- Lazy Resolution: Module names are resolved only when accessed via property getter
- Context Caching: External data stored in HttpContext avoids redundant API calls
Data Flow Patterns
Page Rendering Data Flow
HTTP Request
↓
ContentFinder (determines page + fetches external data)
↓
RenderController.Index()
↓
ViewModelBuilderService.BuildModel()
├─ BuildMeta()
├─ BuildHeader()
├─ BuildPageModules() → ConversionService → Converters
├─ BuildFooter()
├─ BuildConfigModel()
└─ EnrichModelDataAsync()
↓
Razor View (_layout.cshtml)
↓
<react-module> TagHelpers
↓
Node.js SSR
↓
HTML Response
↓
Client Hydration
API Integration Flow
External data is fetched through a layered service architecture:
- ContentFinder calls IEdcCoreCaseApiService
- Service makes REST API call via EDC.Rest.Core.Client
- Data stored in HttpContext for ViewModelBuilder access
- ViewModelBuilder maps DTO to ViewModel
- React component receives typed props
Buyer Journey Features
MyEDC Seller Portal
Comprehensive dashboard for property sellers to manage their sales process:
Portal Features
Module Implementation
- /mit-salg/ - Main sales dashboard
- /salgsoverblik/ - Detailed sales overview
- /salgsaktiviteter/ - Track viewings and activities
- /dokumenter/ - Upload and manage documents
- /annoncering/ - Control online/offline advertising
- /mulige-koebere/ - Find potential buyers
- /mine-boliger/ - Manage multiple properties
Search & Discovery
Search Implementation
Filter Types (Umbraco Elements):
├── CaseFilterDatasourceElement # Dropdown filters
├── CaseFilterSliderElement # Range sliders (price, size)
├── CaseFilterCheckboxElement # Multiple selection
├── CaseFilterTextInputElement # Text search
└── CaseFilterDatePickerElement # Date ranges
Search Features:
├── Dynamic filter aggregation
├── Real-time result updates
├── Map-based search interface
├── SEO-friendly URLs
├── Saved search criteria
└── Email notifications
SEO Landing Pages
Auto-generated pages for improved search visibility:
- Municipality pages: /koeb-bolig/kommune/koebenhavn/
- Street pages: /koeb-bolig/vej/vesterbrogade/
- Estate type pages: /villa-til-salg/
- Agency location pages: /ejendomsmaegler/2100-koebenhavn/
Code Quality Review
Architecture Patterns Assessment
Code Organization
- ✅ Consistent project structure
- ✅ Clear naming conventions
- ✅ Modular component architecture
- ✅ Proper use of async/await patterns
- ⚠️ Some large ViewModelBuilderServices could be refactored
- ⚠️ Magic strings in some areas (opportunity for constants)
Performance Considerations
- ✅ Multi-layer caching strategy
- ✅ Efficient database queries with projections
- ✅ Code splitting for React modules
- ✅ CDN integration for static assets
- ⚠️ Some N+1 query patterns in converters
Recommendations
Performance Optimizations
Architecture Enhancements
Developer Experience
Security Enhancements
Strategic Roadmap
Quick Wins (1-2 weeks)
Medium-term Improvements (1-3 months)
Long-term Strategic Initiatives (3-6 months)
Conclusion
The EDC Real Estate Platform demonstrates a mature, well-architected enterprise solution that successfully bridges traditional CMS capabilities with modern frontend development. The innovative React-Umbraco integration through Node.js SSR provides an excellent balance of content editor flexibility and developer experience.
Key Strengths
- ✅ Sophisticated SSR implementation ensuring excellent SEO
- ✅ Generic module rendering system providing great flexibility
- ✅ Strong separation of concerns across layers
- ✅ Comprehensive caching strategy
- ✅ Type safety across C#/TypeScript boundary
Areas for Improvement
- ⚠️ Test coverage needs enhancement
- ⚠️ Some performance bottlenecks in data fetching
- ⚠️ Documentation could be more comprehensive
- ⚠️ Monitoring and observability could be improved
By following the recommendations outlined in this analysis, the platform can evolve to handle increased scale while maintaining its current strengths. The modular architecture provides a solid foundation for future enhancements and feature development.