Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Eagle Eye — Architecture and Operations

Eagle Eye is an internal competitor price-monitoring tool for Account Managers (AMs). It scrapes competitor URLs (Social Media, Eatigo, Chope, bank offers, loyalty programmes), normalises those offers against HungryHub packages, and surfaces a daily dashboard so AMs can track and act on price-parity discrepancies.

  • Repo: hungryhub-team/eagle-eye
  • Default branch: main
  • Pairs with: hunger-games (Apify + Facebook scraper that feeds raw competitor data)

Architecture

Account Manager (browser)
        │
        ▼
  client/  (React + Vite + TanStack Router)
        │
        ▼
  server/  (Hono + Bun + Prisma + Better Auth)   ──► PostgreSQL
        │                                          ──► Redis
        ▼
  worker/  (BullMQ + Bun)  ─── background jobs
        │
        ▼
  go-service/  (Go + Fiber + Clean Architecture)
        │
        ├── PostgreSQL
        ├── Redis
        ├── MongoDB
        └── Hunger Games API  (competitor data feed)

Services

_app_services/frontend-app/ — Turborepo monorepo (v0.5.1)

PackagePurposeKey tech
client/User-facing web appReact, Vite, TanStack Router, shadcn/ui, Tailwind CSS
server/Backend-for-frontendHono, Bun, Prisma, Better Auth, BullMQ, PostgreSQL
worker/Background job processorBullMQ, Redis, Bun
shared/Shared types and validationTypeScript, Zod

_app_services/go-service/ — Core backend API

Built with Go + Fiber following Clean Architecture (handler → usecase → repository layers).

EntrypointPurpose
cmd/apiMain REST API server (JWT/RSA auth, Swagger docs)
cmd/asynq_workerBackground job processor (Asynq)
cmd/schedulerCron scheduler

Key integrations: PostgreSQL (GORM), Redis, MongoDB, Facebook Graph API, Apify, Open Router (AI), golang-migrate.


Repository structure

_app_services/
  frontend-app/        Turborepo monorepo
    client/            React frontend
    server/            BFF server
    worker/            BullMQ worker
    shared/            Zod schemas + TS types
  go-service/          Core Go backend
    cmd/               api / asynq_worker / scheduler entrypoints
    internal/          handler / usecase / repository / middleware
    config/            DB, Redis, Logger config
    entity/            Domain entities and DTOs
    deploy/            Docker + deployment configs
api-client-docs/       Bruno API collection (Eagle Eye API)
architecture/          Excalidraw system diagrams
deploy/                Deployment scripts
docs/                  Developer documentation

Common development tasks

Regenerate Swagger docs (Go service)

cd _app_services/go-service
swag init -g cmd/api/main.go

Regenerate mocks (Go service)

cd _app_services/go-service
mockery --all

Run database migrations (Go service)

# Up
migrate -path internal/migrations -database "$DATABASE_URL" up

# Down (one step)
migrate -path internal/migrations -database "$DATABASE_URL" down 1

Run the full stack locally

# From frontend-app/ (Turborepo)
bun install
bun run dev        # starts client + server + worker concurrently

# Go service separately
cd _app_services/go-service
go run cmd/api/main.go

Browse API docs (Go service)

Swagger UI is served at /swagger/index.html when the Go service is running locally.


Analytics — PostHog

Eagle Eye uses PostHog Cloud (US region, project ID 455524) for product analytics and session recording.

Automatic: pageviews and session recordings are captured for all authenticated users.

Custom events:

EventTrigger
user_authenticatedSuccessful login (Google or email)
restaurant_data_syncedAM clicks Sync Data and job completes
restaurant_monitoring_toggledAM turns monitoring on/off for a restaurant
restaurant_searchedAM submits a search or filter on the restaurants page
restaurant_link_editedAM saves changes in the restaurant edit sheet
change_feed_action_markedAM marks a change feed item with a resolution
promo_comparison_viewedAM opens a promo comparison modal
promo_feedback_submittedAM submits a data quality report on a promo
ai_process_retry_triggeredAM retries AI processing on a promo
market_intelligence_filteredUser changes month/year on the Market Intelligence page
task_createdUser creates a task

Implementation: src/lib/posthog.ts in the client. Disabled when VITE_POSTHOG_KEY is unset (safe for local dev).

Secret: VITE_POSTHOG_KEY GitHub Actions repository secret — baked into the Docker image at build time as a Vite env var.


  • Hunger Games: competitor data scraper that feeds Eagle Eye — hungryhub-team/hunger-games
  • API collection: api-client-docs/Eagle Eye API/ (Bruno)
  • Architecture diagrams: architecture/overview.excalidraw, architecture/services.excalidraw