Webhook-based cross-villa blocking system with automatic inventory updates
💡Business Impact: Enables conflict-free booking operations across 5 properties, generating $30k+ total revenue
Complete booking platform addressing vacation rental challenges in Indonesia, from payment processing to property management. Uses Xendit for local payment compliance and Smoobu integration for inventory management. Solves the complex problem where Akasha villa (entire building) and Lakshmi villa (downstairs portion) share physical space - traditional booking systems create conflicts, but this platform automatically manages cross-property availability while enabling flexible rental strategies.
External bookings via Smoobu webhook → Local database sync with automatic cross-villa blocking. Lakshmi villa (downstairs) bookings trigger Akasha villa (whole building) blocks via Smoobu API, and vice versa.
PostgreSQL with Prisma ORM. Unique constraints @@unique([villa_id, date]) enforce availability. Foreign key relationships (villa → reservations). WebhookLog table stores JSON data for external booking events. Indexed columns for query optimization.
Handler processes 5 action types (newReservation, updateReservation, cancelReservation, deleteReservation, updateRates). Filters detect "Masakali Blocked" self-generated reservations. Returns HTTP 200 status to prevent retries. Database-first persistence strategy. PostHog monitoring integration.
14-step Xendit payment flow with 3DS authentication. Token lifecycle management with modal-based verification. Multi-store state coordination (useCartForm, useXenditStore, useFetchPaymentData). Atomic database operations across booking confirmation pipeline.
Type-safe API integrations and complex booking logic
Migrated from React/Redux to Next.js for better performance and SEO
Managed complex booking state before Next.js migration
Stored booking data with complex availability logic for 5 listings
Zero double-bookings through instant inventory synchronization
Real-time inventory sync across Booking.com and Airbnb
Integrated Indonesian payment processor with limited documentation
Replaced polling with webhooks: 3+ seconds → instant updates
Image optimization across multiple CDN providers
Impact: This blocking system prevents double-bookings of shared physical space by automatically creating API reservations when either Akasha (full building) or Lakshmi (downstairs) is booked, ensuring zero conflicts.
Monthly revenue recovered through zero double-booking system
Double bookings achieved through real-time Smoobu API validation
Webhook-based inventory sync replacing 3+ second polling
Active villa listings managed across Booking.com and Airbnb
Sole developer
July 2020 - ongoing
full-stack development, payment integration, booking system, multi-tenant architecture
Shared Building Logic & Cross-Villa Conflicts: Had to work around the fact that Akasha villa (entire building) and Lakshmi villa (downstairs only) represent the same physical space. The real challenge was creating booking logic where reserving one villa must automatically block the other while maintaining separate booking channels and pricing strategies. Couldn't find existing tools that handled this kind of complex property relationship.
Real-Time Inventory Synchronization Across Multiple Platforms: Managing 5 different webhook action types (newReservation, updateReservation, cancelReservation, deleteReservation, updateRates) from external booking platforms via Smoobu API. Had to ensure immediate availability updates across all platforms while handling webhook reliability, duplicate processing, and maintaining data consistency.
Payment Processing with Limited Documentation: Integrating Indonesian payment processor Xendit with minimal documentation. Had to reverse-engineer the 14-step payment flow including 3DS authentication, token management, and modal-based verification. Built production-ready payment processing without comprehensive vendor support.
Intelligent Cross-Villa Blocking System via Smoobu API: I implemented automatic blocking logic where Lakshmi bookings trigger my blockVilla() function to create "Masakali Blocked" reservations for Akasha villa via Smoobu API, and vice versa. I designed the database with unique constraints on (villa_id, date) pairs, while Smoobu API validation prevents conflicts at source, eliminating the need for complex local locking mechanisms.
Robust Webhook Architecture with Smart Error Handling: I built comprehensive webhook processor handling 5 action types with intelligent filtering to detect self-generated "Masakali Blocked" reservations. My webhook always returns HTTP 200 status (even on partial failures) to prevent Twilio retries, while implementing database-first persistence strategy and PostHog monitoring for production error tracking.
Reverse-Engineered Payment Flow with State Management: I mapped the complete 14-step Xendit payment process through systematic testing and documentation. I implemented multi-store state coordination (useCartForm, useXenditStore, useFetchPaymentData) with proper token lifecycle management, 3DS modal handling, and atomic database operations ensuring payment consistency across the booking confirmation pipeline.
Scale-Appropriate Engineering Over Complex Patterns: For 5-villa operations with low traffic, simple manual oversight and reliable webhook processing proved more effective than complex automated systems. Engineering judgment matters more than following enterprise patterns when scale doesn't justify complexity.
Webhook Reliability Through Simple Patterns: Always returning HTTP 200 (regardless of processing success), implementing database-first persistence, and smart filtering to prevent infinite loops created robust real-time integration. Sometimes simple approaches outperform sophisticated error handling for production reliability.
API Integration Without Documentation: Systematic reverse-engineering through controlled testing, comprehensive state mapping, and building internal documentation proved essential for production integrations with limited vendor support. Building thorough understanding of payment flows enabled confident production deployment.
Zero double-bookings via Smoobu API real-time validation
Webhook-based availability updates prevent conflicts
PostHog error logging for API integration monitoring
Payment processing via secure third-party APIs