Query Hooks
Query hooks live in use-<entity>-query.ts and provide read-only live query access to entity data via PowerSync and TanStack DB.
Import Paths
Section titled “Import Paths”Use the query barrels for normal app consumption:
import { useWorkProjects } from "@life-manager/db/hooks/queries/work";import { useSingleCashflows } from "@life-manager/db/hooks/queries/finance";import { useSettings } from "@life-manager/db/hooks/queries/system";Entity subpaths also export their local query hooks:
import { useWorkProjects } from "@life-manager/db/entities/work/project";Characteristics
Section titled “Characteristics”- live and reactive
- offline-first
- read-only
- strongly typed
- often the source used by action hooks to build guard input
Role In The Entity System
Section titled “Role In The Entity System”Query hooks are the read side of the architecture.
They should not:
- perform writes
- resolve workflows
- own business-rule decisions
They should:
- expose current entity state
- expose derived joined views when needed
- give action hooks the live state required to build operation input
Naming
Section titled “Naming”Current query hooks mostly follow the use<EntityPlural> pattern, for example:
useWorkProjectsuseWorkTimeEntriesuseRecurringCashflowsuseSettingsuseProfileByUserId