Public API
This page documents the current public entrypoints of @life-manager/db as defined by the package exports.
Important Boundary
Section titled “Important Boundary”There are two kinds of public API in this package:
- package-level subpath exports such as
@life-manager/db/core,@life-manager/db/hooks/actions/work, or@life-manager/db/entities/work/project - generated API reference pages under
/api/db/, which currently only cover the root Typedoc entrypoints and not every entity subpath
Recommended Import Strategy
Section titled “Recommended Import Strategy”Prefer the narrowest stable subpath that matches what you need.
- Use
@life-manager/db/corefor runtime setup - Use
@life-manager/db/schemafor the PowerSync schema - Use
@life-manager/db/supabasefor generated database types - Use
@life-manager/db/hooks/queries/*and@life-manager/db/hooks/actions/*for app consumption - Use entity subpaths for mutation hooks and entity-local contracts
- Avoid the root
@life-manager/dbentrypoint unless you explicitly want the broad legacy barrel
Package Entry Points
Section titled “Package Entry Points”Core Runtime
Section titled “Core Runtime”| Import path | Purpose |
|---|---|
@life-manager/db | legacy broad barrel |
@life-manager/db/core | runtime setup, collections, provider, connector, PowerSync context |
@life-manager/db/schema | AppSchema and PowerSync database type |
@life-manager/db/supabase | generated Supabase Tables, Enums, Constants |
@life-manager/db/context | collections context provider |
@life-manager/db/init | initCollections, getDb, getCollections |
@life-manager/db/collection-registry | collection registry type/runtime |
@life-manager/db/BaseConnector | base Supabase connector |
@life-manager/db/PowerSyncProvider | PowerSync status context |
@life-manager/db/collections-types | adapters and context contracts |
@life-manager/db/shared | guard, workflow, and mutation infrastructure |
Hook Barrels
Section titled “Hook Barrels”| Import path | Purpose |
|---|---|
@life-manager/db/hooks/queries | broad query barrel |
@life-manager/db/hooks/queries/work | work query hooks |
@life-manager/db/hooks/queries/finance | finance query hooks |
@life-manager/db/hooks/queries/system | system query hooks |
@life-manager/db/hooks/actions | broad action barrel |
@life-manager/db/hooks/actions/work | work action hooks |
@life-manager/db/hooks/actions/finance | finance action hooks |
@life-manager/db/hooks/actions/system | system action hooks |
There is currently no @life-manager/db/hooks/mutations export. Mutation hooks are consumed through entity subpaths.
Entity Subpaths
Section titled “Entity Subpaths”Each entity has its own export barrel:
| Domain | Subpaths |
|---|---|
| work | @life-manager/db/entities/work/project, .../time-entry, .../appointment, .../folder, .../time-tracker |
| finance | @life-manager/db/entities/finance/single-cashflow, .../recurring-cashflow, .../finance-project, .../bank-account, .../contact, .../tag, .../payout, .../project-adjustment |
| system | @life-manager/db/entities/system/profile, .../settings, .../notification |
Entity subpaths export the full local surface:
- types
- schemas
- guards
- workflows
- raw mutations
- action hooks
- mutation hooks
- query hooks
Compatibility Barrels
Section titled “Compatibility Barrels”| Import path | Purpose |
|---|---|
@life-manager/db/types | broad type barrel |
@life-manager/db/types/work | work domain types |
@life-manager/db/types/finance | finance domain types |
@life-manager/db/types/system | system domain types |
@life-manager/db/schemas | schema barrel |
@life-manager/db/guards | guard barrel |
@life-manager/db/workflows | workflow barrel |
Practical Import Examples
Section titled “Practical Import Examples”App-level query and action usage
Section titled “App-level query and action usage”import { useWorkProjects } from "@life-manager/db/hooks/queries/work";import { useWorkProjectActions } from "@life-manager/db/hooks/actions/work";Entity-level mutation hook usage
Section titled “Entity-level mutation hook usage”import { useWorkProjectMutations } from "@life-manager/db/entities/work/project";Root runtime setup
Section titled “Root runtime setup”import { initCollections, getCollections, CollectionsProvider,} from "@life-manager/db/core";Shared guard/workflow infrastructure
Section titled “Shared guard/workflow infrastructure”import { enforceGuard, resolveDeleteWithWarnings, type ConfirmationResolution,} from "@life-manager/db/shared";Generated API Reference Scope
Section titled “Generated API Reference Scope”The generated API section at /api/db/ is built from packages/db/src/index.ts with an expanded Typedoc entrypoint strategy.
That makes it useful for:
- root runtime exports like
initCollections - root schema exports like
AppSchema - exported root types like
PowerSyncDatabase - connector/runtime contracts like
SupabaseConfig
It is not currently the best reference for entity-level hooks and contracts. For those, use the package guide pages in this section.