Engineering
Deep Dives
A comprehensive look into the technical challenges, architecture decisions, and system designs implemented in real-world production environments.
Webhook & Asynchronous Notification System
Backend Architecture
Developed an internal "Webhook-like" event system for the Arep-API ecosystem, designed to handle multi-channel asynchronous notifications (Push, SMS, Email).
View Arep-APIListener
Middleware intercepts req/res
Queue
Redis-backed Bull queue
Processor
Asynchronous job execution
The Listener: Notification Middleware
The middleware acts as the receiver for internal events, listening for successful (200/201) API responses to trigger the flow without blocking the main request cycle.
@Injectable()
export class NotificationMiddleware implements NestMiddleware {
async use(req: Request, res: Response, next: NextFunction) {
const endpoint = req.originalUrl.split('/api/')[1];
const eventName = `${endpoint}_${req.method.toLowerCase()}`;
res.on('finish', async () => {
if (res.statusCode === 200 || res.statusCode === 201) {
await this.notificationQueue.add(JobName.PROCESS_NOTIFICATION, {
notification,
targetUsers,
});
}
});
next();
}
}The "Messy Part": Dynamic Extraction
"The biggest challenge was extracting target user IDs dynamically across varying endpoint structures (params vs body vs session). I solved it by creating a centralized probe helper that normalizes naming conventions like userId vs id."
Booking System & iCal Synchronization
Third-Party Integration
Implemented as a core feature for the Aroovia Platform, handling third-party integrations with Airbnb and Booking.com.
The Critical Bug
Airbnb's iCal feed marked dates outside the current year as booked without documentation, leading to false unavailability across the system.
Implementation: The Adapter Pattern
class AirbnbICalAdapter {
private isValid(event) {
const now = new Date();
const max = new Date();
max.setFullYear(now.getFullYear() + 1);
// Explicitly filtering non-documented overflow dates
return event.start >= now && event.end <= max;
}
parse(rawData: string) {
return parseICal(rawData)
.filter(this.isValid)
.map(this.normalize);
}
}Ensuring repetitive sync cycles don't duplicate bookings or trigger redundant notifications.
Alerting engineers when a property suddenly shows 100% occupancy via a feed sync.
Unified Dynamic Search Engine
Optimization & Routing
A centralized search engine developed for the Arep-API environment to handle cross-model querying and reflection-based filtering.
Multilingual Search (JSON Fields)
Powered by Prisma Reflection
- Localized Response:Using custom ResponseService for atomic localized entities.
- Model Discovery:/allowedModels endpoint lets Frontend discover searchable schemas.
- Auto-Cleanup:Middleware-level temporary file purging on request failure.
Core Learning
"Building abstractions shouldn't mean losing flexibility. By using Reflection, I allowed the system to scale to new DB models without a single line of search-logic change."