# Data rules for this app (Yasad)

This app keeps all of its data in its Yasad workspace. The owner can see, export and reuse that data
from Yasad, and other apps in the workspace share it.

- Store every record and every piece of app state in Yasad. Use native records (customers,
  resources, reservations, orders, payments) where they fit. Create a custom collection for
  anything else: settings, menus, capacity, notes, statuses, queues and outboxes.
- Never add another database or a data file. That includes SQLite (`node:sqlite`,
  `better-sqlite3`), PostgreSQL, MySQL, MongoDB, Prisma, Drizzle, Knex, TypeORM, Sequelize,
  Supabase, Firebase and JSON or CSV files used as storage.
- Redis (or Upstash, Vercel KV, Memcached) is optional and only for caching and temporary
  coordination. Allowed: a read cache of Yasad data with an expiry, rate limits, locks, short-lived
  sessions, and job signals that carry only Yasad IDs. Rules: write to Yasad first, give every key
  an expiry, re-read from Yasad on a miss, and keep the app working if Redis is emptied. Not
  allowed: the only copy of a customer, order, booking, payment or any other business record, or
  keys without an expiry that hold business data.
- Allowed outside Yasad: secrets in a private env file, and caches the app can rebuild from Yasad.
- Missing permission is not a reason to store data elsewhere. Ask the owner to approve an operator
  credential for this app in Yasad.
- Before finishing any change, run the data check from the project root and fix what it reports:

  ```sh
  curl -fsS https://api.staging.yasad.app/agent/check.mjs -o yasad-check.mjs && node yasad-check.mjs .
  ```
