Skip to content
Lum7ntPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

OstaBot Monorepo

Starter monorepo for an Osta.ee auction monitoring tool with a persistent-session personal-bids workflow, background public-ingestion pipeline, FastAPI backend, worker jobs, PostgreSQL persistence, and a Next.js dashboard.

Structure

  • apps/api: FastAPI app and API routes
  • apps/web: Next.js dashboard
  • apps/worker: APScheduler worker entrypoint and jobs
  • packages/core: shared config, database, models, repositories, schemas
  • packages/osta_public: public Osta API client
  • packages/osta_account: Playwright account-monitor skeleton
  • packages/alerts: Discord and optional event-sink alerts
  • packages/reports: digest/report generation helpers
  • alembic: database migrations

Quick start

  1. Copy .env.example to .env.
  2. Start the stack: docker compose up --build
  3. Run migrations inside the API container: docker compose exec api alembic upgrade head
  4. Open:
    • API docs: http://localhost:8000/docs
    • Web UI: http://localhost:3000

Personal bids workflow

  • The main dashboard centers on auctions you have personally bid on.
  • Personal bid refreshes reuse a durable Playwright browser profile instead of attempting a fresh login on every run.
  • You can also bring your own authenticated Osta session material through uploaded storage state or cookies.
  • Public feed polling still runs in the background for analytics and digests, but it is hidden from the main dashboard and exposed only in admin views.

Session setup

  1. Set ENABLE_ACCOUNT_MONITOR=true in .env.
  2. Start the stack with docker compose up --build.
  3. Trigger setup with POST /admin/account-session/setup.
  4. Complete any Cloudflare check and Osta login manually in the headed Chromium session.
  5. When authenticated state is detected, the browser profile is saved under OSTA_ACCOUNT_PROFILE_DIR.

Session status and refresh

  • Check session health with GET /admin/account-session/status
  • Refresh personal bids with POST /admin/refresh-my-bids
  • If the session expires or is blocked, the API returns reauth_required and the dashboard shows a reconnect action instead of crashing

Bring your own session

  • Supported auth modes:
    • managed_login
    • storage_state_upload
    • cookie_json_upload
    • cookie_header_upload
  • Full storage state is preferred over raw cookies because it carries more browser session context.
  • Secret session material is encrypted on disk under OSTA_ACCOUNT_SECRET_DIR and is never returned by the API.
  • Admin endpoints:
    • POST /admin/account-session/upload-storage-state
    • POST /admin/account-session/upload-cookies
    • GET /admin/account-session/status
    • DELETE /admin/account-session
  • The dashboard includes a session-management card where you can pick an auth mode, paste or upload the material, validate it, and delete it later.

Playwright in Docker

  • The shared Python image used by api and worker now installs Playwright Chromium during docker compose build
  • No manual playwright install step is required inside the containers after rebuild
  • If Playwright dependencies change, rebuild the Python image with docker compose build api worker

Osta login debug script

  • Run inside the API container: docker compose exec api python packages/osta_account/scripts/osta_login_debug.py
  • Output is written under artifacts/osta_account/login_debug/<timestamp>/
  • Optional env overrides:
    • OSTA_LOGIN_DEBUG_URL
    • OSTA_LOGIN_DEBUG_DIR
    • OSTA_LOGIN_DEBUG_HEADLESS

Frontend in Docker

  • The web service runs from /app/apps/web
  • Dev server command: npm run dev -- --hostname 0.0.0.0 --port 3000
  • Start only the frontend if needed: docker compose up --build web

Local development without Docker

Backend

  1. Create a Python 3.11 virtualenv.
  2. Install backend deps: pip install -e .
  3. Export PYTHONPATH to include:
    • apps/api/src
    • apps/worker/src
    • packages/core/src
    • packages/osta_public/src
    • packages/osta_account/src
    • packages/alerts/src
    • packages/reports/src
  4. Run migrations: alembic upgrade head
  5. Start the API: uvicorn api.main:app --reload
  6. Start the worker: python -m worker.main

Frontend

  1. cd apps/web
  2. npm install
  3. npm run dev -- --hostname 0.0.0.0 --port 3000
  4. Open http://localhost:3000

Design rules carried into the starter

  • Public API ingestion stays separate from account automation.
  • Public integration uses only:
    • GET /api/items/active
    • GET /api/items/active/{itemId}
  • Webpush endpoints are intentionally excluded from the main alerting design.
  • Bid execution is protected by a feature flag and dry-run mode.

Current starter capabilities

  • Poll public active listings and upsert item state
  • Store item snapshots over time
  • Track categories and saved filters
  • Persistent-session Playwright account monitor for personal bid extraction
  • Generate Discord-ready daily digests
  • Expose health and admin-style API endpoints for the UI

Personal bids mode

  • Main dashboard now centers on personal bid items instead of the public feed
  • Refresh path: POST /admin/refresh-my-bids
  • Session setup path: POST /admin/account-session/setup
  • Session status path: GET /admin/account-session/status
  • Public feed remains available only in the admin route and currently polls page 1 only

Next steps

  • Replace response-field assumptions in the public client if the live payload differs
  • Add real filter evaluation and alert deduplication rules per team preference
  • Tighten account-page selectors once authenticated discovery artifacts are reviewed

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages