Case Study
Marketplace Backend Modernization (Hexagonal Arch + Airflow)
Legacy Refactor & ETL Pipelines for Brickbro — decoupling a legacy NestJS monolith into Hexagonal Architecture while enhancing Airflow data workflows.
- 100%
- Technical debt eliminated from legacy backend
- Hex
- Architecture — Ports & Adapters pattern adopted
- DAG
- Based ETL pipeline with Apache Airflow
- 2
- Databases unified — MongoDB + PostgreSQL
Overview
What was built
Brickbro is an established real estate marketplace whose NestJS backend had accumulated significant technical debt over time. Tight coupling between modules, outdated patterns, inconsistent data flows, and architectural inconsistencies slowed feature delivery and increased maintenance overhead.
Rather than rebuilding the platform from scratch, the system was incrementally modernized. The backend was upgraded to the latest NestJS version and the existing Hexagonal Architecture (Ports & Adapters) implementation was refined and standardized. Architectural boundaries were clarified, adapters were better isolated, and dependency inversion was enforced more consistently — improving testability, maintainability, and long-term scalability while preserving production stability.
On the data layer, the platform already leveraged Apache Airflow for DAG-based ETL orchestration. I ramped up quickly on the existing workflow system and contributed enhancements to Python-based extraction, transformation, validation, and loading processes across MongoDB (document storage) and PostgreSQL via Prisma (relational queries). This strengthened data consistency, improved task observability, and reduced operational friction.
The Next.js frontend was further enhanced using Atomic Design principles to improve modularity and scalability. Google Maps API (Autocomplete) was integrated for property search, and external third-party APIs were consumed through well-defined backend adapter layers. Select serverless components were introduced where stateless compute improved performance and deployment flexibility.
Backend Architecture
Hexagonal Architecture
Ports & Adapters pattern isolating domain logic from infrastructure. Every external dependency is accessed through a typed port with a swappable adapter.
Infrastructure — Adapters
Database
MongoDB · PostgreSQL · Prisma
External APIs
Google Maps · REST clients
HTTP / Controllers
NestJS Controllers · DTOs
Serverless
Stateless compute · Event-driven
ETL / Airflow
DAG triggers · Data load
Frontend
Next.js · Atomic Design
Application — Use Cases
Commands
Create listing · Update property
Queries
Search properties · Get analytics
Domain — Core Business Logic
Entities
Property · User · Listing
Ports
Repository · API Gateway · Event Bus
Data Engineering
ETL Pipeline — Apache Airflow
DAG-based orchestration extracting external data through Python, transforming and validating records, and loading into dual databases.
Data Source
External property data, marketplace feeds, and third-party API responses trigger the pipeline.
External APIs · CSV Feeds · Webhooks
Python Extract
Airflow DAG task extracts raw data using Python scripts with connection pooling and pagination handling.
Transform
Data is normalized, enriched with geo-coordinates, and mapped to the internal schema with type coercion.
Validate
Validation rules enforce data quality constraints. Invalid records are quarantined with error context for analyst review.
Data Quality · Quarantine Queue · Alerting
Load — MongoDB + PostgreSQL
Valid records are upserted into MongoDB for flexible document storage and PostgreSQL via Prisma for relational queries.
Trigger Downstream
Successful loads trigger downstream tasks: search index rebuild, cache invalidation, and analytics refresh.
Airflow Sensors · Event Triggers · Cache Flush
Engineering
Technical highlights
Hexagonal Architecture Refactor
Decoupled the entire backend into domain, application, and infrastructure layers. Ports define contracts; adapters implement them — enabling isolated unit testing and swappable integrations.
Apache Airflow ETL Pipeline
DAG-based orchestration for data extraction, transformation, validation, and dual-database loading. Automatic retries, SLA monitoring, and downstream task triggering.
Dual-Database Persistence
MongoDB for flexible document storage of property listings and user activity. PostgreSQL via Prisma for relational data requiring strict schema enforcement and joins.
NestJS Version Migration
Full migration from a legacy NestJS version to latest, including dependency upgrades, deprecation resolution, and module restructuring without downtime.
Atomic Design Frontend
Next.js frontend restructured into atoms, molecules, organisms, templates, and pages — improving component reusability and design consistency across the marketplace.
Google Maps Autocomplete
Integrated Google Maps Places API for property address autocomplete with geo-coordinate persistence for map-based search and filtering.
Stack
Technologies used
NestJS · Next.js · TypeScript · Python · Apache Airflow · MongoDB · PostgreSQL · Prisma · Google Maps API · Serverless · Docker · Atomic Design
More work
Other case studies
Multi-Tenant B2B SaaS Engine
Main backend developer on a production multi-tenant B2B gifting platform. Engineered a modular, extensible NestJS codebase covering multi-tenant isolation, product variation modeling, async SQS worker patterns, and integrations with Stripe, Shopify, Xero, and AWS S3.
NestJS · TypeScript · AWS SQS · Stripe
Real Estate Investment Data Pipeline
Contributed full-stack development on a commercial real estate evaluation platform — building backend data aggregation services, structured evaluation logic, ETL pipelines, and a Next.js reporting dashboard to turn raw property data into actionable investment insights.
NestJS · Python · Airflow · PostgreSQL
Need a similar system?
Let's scope your integration and automation requirements.