Skip to content

Public API

This page documents the current public entrypoints of @life-manager/db as defined by the package exports.

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

Prefer the narrowest stable subpath that matches what you need.

  • Use @life-manager/db/core for runtime setup
  • Use @life-manager/db/schema for the PowerSync schema
  • Use @life-manager/db/supabase for 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/db entrypoint unless you explicitly want the broad legacy barrel
Import pathPurpose
@life-manager/dblegacy broad barrel
@life-manager/db/coreruntime setup, collections, provider, connector, PowerSync context
@life-manager/db/schemaAppSchema and PowerSync database type
@life-manager/db/supabasegenerated Supabase Tables, Enums, Constants
@life-manager/db/contextcollections context provider
@life-manager/db/initinitCollections, getDb, getCollections
@life-manager/db/collection-registrycollection registry type/runtime
@life-manager/db/BaseConnectorbase Supabase connector
@life-manager/db/PowerSyncProviderPowerSync status context
@life-manager/db/collections-typesadapters and context contracts
@life-manager/db/sharedguard, workflow, and mutation infrastructure
Import pathPurpose
@life-manager/db/hooks/queriesbroad query barrel
@life-manager/db/hooks/queries/workwork query hooks
@life-manager/db/hooks/queries/financefinance query hooks
@life-manager/db/hooks/queries/systemsystem query hooks
@life-manager/db/hooks/actionsbroad action barrel
@life-manager/db/hooks/actions/workwork action hooks
@life-manager/db/hooks/actions/financefinance action hooks
@life-manager/db/hooks/actions/systemsystem action hooks

There is currently no @life-manager/db/hooks/mutations export. Mutation hooks are consumed through entity subpaths.

Each entity has its own export barrel:

DomainSubpaths
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
Import pathPurpose
@life-manager/db/typesbroad type barrel
@life-manager/db/types/workwork domain types
@life-manager/db/types/financefinance domain types
@life-manager/db/types/systemsystem domain types
@life-manager/db/schemasschema barrel
@life-manager/db/guardsguard barrel
@life-manager/db/workflowsworkflow barrel
import { useWorkProjects } from "@life-manager/db/hooks/queries/work";
import { useWorkProjectActions } from "@life-manager/db/hooks/actions/work";
import { useWorkProjectMutations } from "@life-manager/db/entities/work/project";
import {
initCollections,
getCollections,
CollectionsProvider,
} from "@life-manager/db/core";
import {
enforceGuard,
resolveDeleteWithWarnings,
type ConfirmationResolution,
} from "@life-manager/db/shared";

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:

It is not currently the best reference for entity-level hooks and contracts. For those, use the package guide pages in this section.