// one entity → a synced table + typed client
const Order = entity("Order", {
customer: field.string(),
total: field.float(),
paid: field.boolean().default(false),
});
// access rules next to the schema — deny by default
policy({ entity: "Order",
allowRead: "auth.userId != null",
allowInsert: "auth.userId == data.ownerId",
});
// the React side — live, typed, no fetch
const { data } = db.useQuery("Order");