Deep Dive · Production · Jun 2023 — Jul 2026
Lesoll
Backend of a large-scale real-estate classifieds marketplace serving real users in the Egyptian market.
- Role
- Backend Engineer — primary, 100% of the backend implementation
- Timeline
- Jun 2023 — Jul 2026
- Stack
- TypeScript Express.js MongoDB Redis BullMQ Socket.IO Paymob AWS Docker NGINX ...
01 — Overview
Lesoll is a large-scale classifieds marketplace for the Egyptian real-estate market. Users buy, sell, and rent residential, commercial, land, and compound properties; the platform also carries premium listing packages, real-time messaging, a blog, and a complete internal administration system.
The business goal is straightforward: connect property owners and seekers directly, and monetize through premium listing packages — which makes the listing lifecycle, search, and payments the load-bearing parts of the backend.
As the Backend Engineer I owned the backend implementation end to end: REST APIs, business logic, database architecture, third-party integrations, and performance work — across the listing lifecycle, authentication, payments, notifications, search, analytics, and internal admin services, on a production platform with real users, where mistakes are visible.
02 — Challenges
Search at scale
Thousands of listings behind dozens of combinable filters, and users who expect results in a few hundred milliseconds.
Media reliability
Listings are created with multiple images. When an upload fails silently, the listing goes live incomplete.
Subscription lifecycle
Package purchases, feature activation, renewals, and expiration all mutate paid state — none of it may ever land in an inconsistent state.
Ranking with premium features
The feed has to surface the most valuable listings while pinned, paid listings keep the exposure they were promised.
SEO for dynamic pages
A large, constantly changing set of listing pages has to stay crawlable and indexable.
Analytics without slowdown
The business needs user-behavior data — visits, calls, WhatsApp clicks, favorites, shares — without the tracking weighing down hot request paths.
Growth
Database size and traffic keep growing; queries that were fine at launch degrade over time.
03 — What I Built
Search and filtering engine
- Problem
- Search is the product’s front door: thousands of listings, dozens of filters, and an expectation of results in a few hundred milliseconds.
- Approach
- Do the work inside the database, once — and cache whatever stays expensive.
- Implementation
- Optimized MongoDB aggregation pipelines shaped around compound indexes, with unnecessary lookup stages removed rather than tuned, and caching in front of the queries that remained expensive.
- Outcome
- Faster search responses and lower database load.
Payment and subscription system (Paymob)
- Problem
- Premium listing packages are the platform’s revenue. Purchases, feature activation, renewals, and expiration all mutate paid state, and an inconsistency here is a direct money problem.
- Approach
- Verify money first, activate features second — and let jobs, not humans, handle time-based transitions.
- Implementation
- Paymob integration with payment verification before any package activates, protection against duplicate gateway callbacks, transactional backend logic around subscription state changes, and automated expiration jobs.
- Outcome
- A stable subscription lifecycle and noticeably less manual support intervention.
Image upload pipeline
- Problem
- Multi-image uploads occasionally failed, and listings were created incomplete.
- Implementation
- Reworked the upload pipeline: validation before anything is saved, retry and error handling around the uploads, and image processing moved off the blocking request path.
- Outcome
- More reliable uploads and fewer failed listing creations.
Advertisement ranking
- Problem
- Show users the most valuable listings while premium features — like pinning — keep their promised exposure.
- Implementation
- A ranking strategy combining pin priority, freshness, listing status, and business rules.
- Outcome
- Fair exposure for premium listings without degrading the browsing experience.
Real-time chat system
- Problem
- Buyers and sellers need to negotiate about a listing inside the platform, in real time, without dropping to phone calls or external messengers.
- Implementation
- A real-time messaging system built on Socket.IO, carrying conversations between users on the production platform.
Co-host system
- Implementation
- A co-host system that lets property owners delegate management of their listings to other accounts.
SEO backend
- Problem
- A large and constantly changing set of dynamic listing pages has to be crawlable.
- Implementation
- Dynamic sitemap generation, canonical URL generation, structured metadata APIs, and optimized URL construction.
- Outcome
- Better indexing and search visibility.
Analytics and tracking
- Problem
- Understand user behavior without the tracking itself affecting performance.
- Implementation
- Event tracking for page visits and listing interactions — WhatsApp clicks, calls, favorites, shares — aggregated into statistics for internal dashboards.
04 — Performance
Indexes and aggregation
Search and listing queries run through MongoDB aggregation pipelines shaped around compound indexes. Unnecessary lookup stages were removed instead of tuned — the fastest pipeline stage is the one that no longer exists.
Caching
Expensive, frequently repeated queries are cached, cutting repeated database calls on hot paths and lowering overall database load.
Non-blocking media processing
Image processing runs off the request path, so uploads no longer block API responses.
Further Reading