A Ruby on Rails application that syncs Empire Flippers marketplace listings to HubSpot CRM deals and Google Sheets automatically once per day.
- Fetches all "For Sale" listings from the Empire Flippers Public API — with full pagination support
- Stores listing data in a PostgreSQL database
- Creates a corresponding Deal in HubSpot CRM for each listing
- Exports all listings to a Google Sheet (clears and rewrites daily)
- Runs automatically once per day via Sidekiq background job scheduler
- Prevents duplicate listings and duplicate HubSpot deals
- Ruby on Rails 7.1
- PostgreSQL — database
- Sidekiq — background job processing
- sidekiq-scheduler — daily cron scheduling
- HTTParty — HTTP requests to Empire Flippers API
- hubspot-api-client — official HubSpot Ruby gem
- google-apis-sheets_v4 — Google Sheets API
- RSpec — test suite
- Ruby 3.1+
- PostgreSQL
- Redis (required for Sidekiq)
git clone https://github.com/imlakshay08/empire-sync
cd empire-sync
bundle installCreate a .env file in the root directory:
HUBSPOT_ACCESS_TOKEN=your_hubspot_private_app_token
GOOGLE_SHEETS_CREDENTIALS_PATH=config/google_credentials.json
GOOGLE_SHEET_ID=your_google_sheet_id
Also add your Google service account credentials file at config/google_credentials.json (never commit this file).
rails db:create
rails db:migratebundle exec rspecrails console
ListingSyncService.syncbundle exec sidekiqSyncListingsJob (runs daily at midnight)
↓
ListingSyncService
├── EmpireFlippersService → fetches all listings from EF API (paginated)
├── HubspotService → creates deals in HubSpot CRM
└── GoogleSheetsService → exports listings to Google Sheet
| Deal Field | Source |
|---|---|
| Deal Name | "Listing ##{listing_number}" |
| Amount | listing_price |
| Close Date | 30 days from sync date |
| Description | summary |
| Column | Source |
|---|---|
| Listing # | listing_number |
| Listing Price | listing_price |
| Summary | summary |
16 RSpec tests covering:
- Listing model validations
- EmpireFlippersService API fetching with pagination
- ListingSyncService sync logic and duplicate prevention
- HubspotService deal creation
- GoogleSheetsService sheet creation and data export
- SyncListingsJob execution