# React Native/Expo workspace API guide

This target generates a local-first Expo application backed by `expo-sqlite`.
Open the database once, inject the TeaQL data service into `UserContext`, and
pass only that context to generated execute/save methods. Every query needs
purpose and comment; every write needs an audit reason.

## First verification

Run `npm install`, `npm test`, then `npm start`. `npm test` performs the full
generated TypeScript check against the real Expo types. On first application
launch the runtime opens the configured database and ensures the generated
schema automatically; no SQLite file or hand-written migration is required.

Read `App.tsx` first, then the generated `Q.ts`, request, and entity sources.
Application code may change `App.tsx` and add services or screens, but must not
edit `src/generated/` or guess generated method names.

## Local customization

Keep database opening, authentication setup, and other runtime dependencies at
the application boundary. Inject the resulting service while initializing one
`UserContext`. A generated request is configured before `purpose(...)`; after
purpose it exposes execution, with the context as its only argument. Do not
place database handles, tenant identity, permissions, or policy in dynamic JSON.

The runtime hard limit protects outer list queries. A trusted local application
may override it in code for an exceptional use case, but ordinary screens should
retain the 10,000-row default and paginate. This policy is deliberately absent
from the federation payload.

For writes, create or modify the generated entity, attach `auditAs(...)`, and
then save with the same context. The SQLite runtime uses transactions and
optimistic versions; stale updates fail instead of silently overwriting data.

The optional TFP client uses the same generated model against a TeaQL server.
Remote JSON cannot configure the local hard limit or trusted tenant, identity,
permission, and purpose policy. Those remain server-controlled.