This document is a consolidated developer guide and short code-review summary for the repository.
backend/: FastAPI backend with SQLAlchemy models, routers, and marketplace integrations.frontend/: Flutter app (mobile/desktop/web) that consumes the backend API.
- Create and activate a Python virtual environment:
cd backend
python -m venv .venv
source .venv/bin/activate- Install dependencies:
pip install --upgrade pip
pip install -r requirements.txt- Provide environment variables:
- For Render hosting: save your environment variables in the Render service dashboard (do not store secrets in the repo).
- For local development: create
backend/.envyourself with the required variables (the repository does not include an example file).
- Start dev server:
uvicorn app.main:app --reload --host 127.0.0.1 --port 8000API: http://127.0.0.1:8000 — media is mounted under /media.
Notes:
- The app currently runs
Base.metadata.create_all(...)on startup which is fine for local dev. For production use Alembic migrations. - Restrict CORS origins in production (
backend/app/main.py).
Prerequisites: Install Flutter SDK and any platform toolchains you need.
- Get dependencies:
cd frontend
flutter pub get- Run on a target platform:
# web (Chrome)
flutter run -d chrome
# macOS desktop
flutter run -d macos
# Android emulator
flutter run -d emulator-5554The frontend's API base URL is currently set in frontend/lib/services/auth_service.dart. For local development update it to point to http://127.0.0.1:8000 or make the service read a configurable value.
If you use Playwright in production (usually not required), install browsers during build. Example Build & Start commands on Render:
pip install -r requirements.txt && python -m playwright install chromium
uvicorn app.main:app --host 0.0.0.0 --port $PORTSet PLAYWRIGHT_BROWSERS_PATH=0 to use system browsers (optional).
I reviewed the backend and frontend code and summarize the top findings and recommended fixes below.
- Circular import:
backend/app/services/ebay_client.pyimportsapp.routers.marketplaces(forEBAY_SCOPES) andmarketplaces.pyimportsebay_client. MoveEBAY_SCOPESinto a neutral module likebackend/app/core/constants.py. - Sync DB in async code: Async functions in
ebay_client.pyperform synchronous SQLAlchemy operations (db.query,db.commit). These will block the event loop. Options: run DB calls in a threadpool (run_in_threadpool), change the endpoint to sync, or adopt an async DB layer. - Frontend web breakage:
frontend/lib/services/auth_service.dartimportsdart:iounguarded. That prevents web builds. UsekIsWeband conditional imports; prefer a cross-platform storage approach. - Media path mismatch:
ListingImage.file_pathappears to be stored withmedia/...in comments, while thumbnail generation prefixessettings.media_url, which may result in/media/media/.... Store DB file paths relative to the media root (e.g.,listings/1/abc.jpg).
- Replace direct
Base.metadata.create_allwith Alembic migrations for production. - Document required env vars and ensure secrets are stored in the deployment environment (Render) or in a local
backend/.envnot checked into git. - Review
requirements.txtand split dev vs runtime deps (e.g.,playwrightmay be dev-only).
- Add CI running
pytest/flutter analyzeand linters (ruff/black for Python, dart format/lints for Flutter). - Add structured logging and a standard API error response format for the frontend to parse.
- Move
EBAY_SCOPESout ofmarketplaces.pyintobackend/app/core/constants.py. - Avoid sync DB calls in async functions (
ebay_client.py) — either run DB ops in a threadpool or make them sync. - Change
frontend/lib/services/auth_service.dartto avoiddart:ioin web builds and standardize token storage. - Add Alembic and create initial migrations.
# Search for dart:io usage (frontend)
cd frontend
rg "dart:io|\bPlatform\b" || true
# Search for EBAY_SCOPES / ebay_client usage (backend)
cd backend
rg "EBAY_SCOPES|ebay_client|marketplaces" || true
# Run backend
cd backend
source .venv/bin/activate
uvicorn app.main:app --reload
# Run frontend
cd frontend
flutter pub get
flutter analyze
flutter run -d chromeIf you'd like I can apply the immediate fixes (move constants, adjust DB usage, update frontend storage). Tell me which to prioritize and I will create the patches.