# TradingBite Platform — Project Rules

**Project root:** `C:\Users\akfai\Downloads\Cursor Project\TradingBite-Platform`

These rules are **non-negotiable** for all Cursor sessions and contributors.

## 1. Isolation from other projects

- This repository is the **web platform only** (charts, data, backtest).
- **Do not modify:**
  - `../TradingBite/` (Pine Script / legacy indicator sources)
  - Any TradingBite production app or Community project (outside this repo)
  - YardDeals, Dulce Bonito, or any unrelated repository
  - Production databases, VPS deployments, or live environments
- If work is not under `TradingBite-Platform/`, **stop** and confirm with the user.

## 2. No paid recurring services

- Target **$0 recurring** software/service cost where technically and legally possible.
- No purchases, paid API tiers, paid cloud plans, or infrastructure that silently converts to paid.
- Free broker demo APIs and legally permitted free tiers are allowed when:
  - terms allow the use case;
  - no payment is required;
  - rate limits are respected.
- If a capability cannot be provided for free, **document the limitation** and propose a free/legal alternative — do not bypass restrictions.

## 3. Legal and terms compliance

- No scraping TradingView or copying proprietary UI, assets, code, or data.
- No reverse-engineering, bypassing auth, paywalls, or rate limits.
- No redistribution of broker data where terms prohibit it.
- Goal: **TradingView-like workflow**, not an illegal clone. Use OSS libraries and permitted data sources.

## 4. Production and data safety

- Never delete historical market data without explicit instruction.
- Never overwrite datasets without verification; record source, symbol, timeframe, range, timezone, import date.
- Never run destructive migrations casually.
- Never expose API keys, broker tokens, or secrets in Git or client bundles.
- Use environment variables; commit only `.env.example` templates.
- Never reset or replace production data with dev data.

## 5. Roadmap discipline

- Primary roadmap: `docs/phases/ROADMAP-A-to-Z.md` (copied from project kickoff; see also legacy reference in `../TradingBite/docs/` if needed).
- Complete and verify each **major phase** before starting the next.
- Do not implement backtesting, auth, FXCM, drawings, etc. until their phase is active.

## 6. Development philosophy

**Small → test → checkpoint → document → continue**

- Minimum diff for each task; no unrelated refactors or dependency upgrades “for freshness.”
- Every meaningful change: version entry in `CHANGELOG.md`, rollback notes, tests where applicable.
- Priority order: **Safety → Legal → Data protection → Reversibility → Correctness → Testing → Documentation → Performance → Features**

## 7. Infrastructure

- Start simple: Node/TypeScript, optional Python for quant later, SQLite/PostgreSQL as needed.
- Do **not** add Redis, Kafka, Kubernetes, or heavy ops stack without a demonstrated requirement.

## 8. Chart and indicators

- Chart: open-source (e.g. TradingView **Lightweight Charts**, MIT — verify license at implementation time).
- Indicators: TypeScript ports from Pine with golden/reference tests — **no Pine runtime in browser** unless explicitly approved and legal.

## 9. Stop conditions

Stop and report if:

- a required API needs payment or unclear terms;
- license conflict on a dependency;
- unrelated project files would be affected;
- architecture forces a paid service;
- uncertainty about breaking existing (external) systems.

## 10. Session reporting

End implementation sessions with the **TRADINGBITE PROJECT STATUS** block defined in the master start instruction (version, phase, tests, build, security, rollback, deployment).

## 11. Instructions to the user (manual steps)

When asking the user to run commands (including `npm`), always give:

1. **When** — timing/context (before/after what).
2. **Where** — full path: `C:\Users\akfai\Downloads\Cursor Project\TradingBite-Platform`.
3. **What** — complete copy-paste commands (`cd` + exact `npm run …`), not vague “run npm” or “restart dev”.

See [docs/communication/USER-ACTION-INSTRUCTIONS.md](./docs/communication/USER-ACTION-INSTRUCTIONS.md).
