src/holds FastAPI services, database models, and shared utilities; align new modules with the existing domain folders.web/app.pyassembles the ASGI app and lifecycle hooks; register new routers undersrc/api/.frontend/hosts the Vite + React dashboard, whiledata/andlogs/are runtime artifacts managed viasrc/config.py.- Keep backend tests in
tests/and mirror package paths (e.g.,tests/services/test_data_pipeline.py).
- Copy
.env.exampleto.env, then setDEFAULT_SYMBOLS,DATABASE_URL, and any cron overrides before launching the API. - Settings resolve through
src/config.py; relative paths are created automatically, so avoid hard-coded user directories. - Keep AkShare credentials and proxies outside git and surface them through environment variables consumed by
.env.
python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txtprepares the backend environment.uvicorn web.app:app --reloadruns the API, initializes SQLite tables, and starts the scheduler with your.envvalues.cd frontend && npm installinstalls client dependencies; usenpm run devfor local work andnpm run buildfor production bundles.python -m unittest discover testsexecutes backend tests from the repo root to ensure settings import cleanly.
- Follow PEP 8 with 4-space indentation, explicit type hints, and module-level
LOGGERinstances as insrc/utils/logging.py. - Use
snake_casefor modules, functions, and columns; reservePascalCasefor Pydantic schemas, SQLAlchemy models, and React components. - Group imports as stdlib, third-party, internal, and prefer focused services or utilities over monolithic modules.
- Target service boundaries (
MarketDataService, schedulers, API handlers); isolate AkShare calls with fakes or recorded fixtures. - Name tests descriptively (
test_refresh_universe_persists_candles) and keep reusable builders undertests/helpers. - Assert scheduler outcomes via service APIs rather than APScheduler internals to keep suites stable.
- Use imperative, concise commit subjects (
Integrate industry filters) and add body context when touching multiple layers. - Open pull requests with a short summary, linked issues, and evidence of local runs (
unittest,npm run build, UI screenshots when relevant). - Verify API and frontend commands succeed locally before requesting review, and call out migrations or backfills in the description.