How ayarse/ibay_apartment_hunter works
Project type and purpose
• This is a backend “bot as a service” application written in TypeScript.
• Its sole purpose is to periodically scrape apartment listings from iBay.com.mv, persist them to a PostgreSQL database, and push notifications via Telegram to subscribed users.
• It’s deployed via Docker Compose and uses Drizzle ORM, Puppeteer, and grammY (Telegram bot framework).
File structure
• Entry point: src/app.ts
• “clients/”: third-party integrations
• db.ts (Drizzle-based PostgreSQL client)
• telegram.ts (grammY client wrapper)
• “scrapers/”: modules that fetch raw data from iBay (uses Puppeteer)
• “listeners/”: event handlers that respond to “new-ibay-item” events
• “services/”: business logic layer
• config-service.ts (read runtime config)
• user-service.ts (manage subscriber data)
• notif-service.ts (prepare/send Telegram notifications)
• “util/”: shared utilities (event-bus, logger, helpers)
• scripts/migrate.ts + drizzle.config.ts + db/migrations: database schema and migration tooling
• Deployment/config: Dockerfile, docker-compose.yml, ecosystem.config.cjs (PM2), .env examples
README for additional insights
• The timer interval is configurable (TIMER_INTERVAL).
• DEBUG mode reroutes all notifications to DEBUG_USER.
• External dependencies: PostgreSQL, Telegram API, Sentry for error logging.