BILYART

CLAUDE.md — Billiard SaaS + IoT Platform

You are the lead architect and engineer for this repository. Read this file fully before every task.

0. Communication with the owner

1. Source of truth (read in this order)

  1. docs/SPEC.md — the original master specification (business requirements). Never violate it.
  2. docs/ARCHITECTURE.md — chosen stack and the decisions resolving contradictions between the spec and the hosting.
  3. docs/DATABASE.md, docs/SECURITY.md, docs/DEVICE_PROTOCOL.md, docs/DEPLOYMENT.md.
  4. docs/ROADMAP.md — phases and per-phase acceptance criteria.
  5. docs/PROGRESS.md — what is done. Update it at the end of every work session.

If the SPEC and ARCHITECTURE disagree, ARCHITECTURE wins only where it explicitly documents the reason (hosting limits). Otherwise stop and ask the owner.

2. How the owner drives work

The owner will write messages like “Phase 3 ni boshla” or “Phase 3 davom et”. For each phase:

  1. Read ROADMAP.md for that phase + PROGRESS.md.
  2. Write a short plan (in Uzbek) of what you will build in this session.
  3. Implement in small commits.
  4. Run the tests (composer test, npm test, pio test as relevant). Fix failures.
  5. Update docs touched by the phase + PROGRESS.md (done / remaining / known issues).
  6. Push to a branch phase-N-short-name and open a PR into main with a checklist of acceptance criteria. The owner authorized Claude (2026-09-30) to merge the PR itself — the owner does not merge. Merge only when CI is green on the PR head and no critical errors remain; use a merge commit. A PR may also be merged mid-phase when the owner needs something from main (e.g. a manual workflow), as long as CI is green.
  7. Do not start the next phase while critical errors or failing tests remain.

3. Non-negotiable rules

4. Repository layout (target)

apps/api            Laravel 13 backend (REST API, scheduler, Telegram, storage)
apps/web-admin      React + Vite + TS SPA (Super Admin + Client Admin)
apps/tablet         React + Vite + TS PWA (customer kiosk UI)
apps/android-kiosk  Kotlin WebView shell (Lock Task / kiosk, auto-start, camera)
devices/esp32       PlatformIO (Arduino-ESP32) firmware
packages/protocol   JSON Schemas + TS types for tablet & device protocol (single source)
infrastructure/     deployment scripts, cron definitions, backup scripts
docs/               all documentation
.github/workflows/  CI (tests), build (web, apk, firmware), deploy

5. Commands (keep this section updated as the project grows)

6. Definition of done for any feature