Registry / database / crea-ddf

crea-ddf

JSON →
library0.0.6jsnpmunverified

An Effect-native TypeScript SDK for the CREA DDF API (Canadian Real Estate Association's Data Distribution Facility). Provides two consumption paths: direct API calls against the live OData endpoint, and a database-first approach that syncs listings, members, offices, and open houses into PostgreSQL via Drizzle ORM. The sync saves watermarks for incremental updates and supports telemetry via OpenTelemetry. Version 0.0.6 requires Effect 4.0.0-beta.71 and Node.js >=24.14.0 or Bun >=1.3.0. Ships TypeScript types and is ESM-only. Differentiators include full integration with Effect's structured concurrency, Drizzle for type-safe queries, and a frontend-ready database client that avoids exposing CREA credentials.

npm install crea-ddf
INSTALL
IMPORT
SIG · CREA-DDF
C
crea-ddf
databasejavascriptv0.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

listProperties
import { listProperties } from 'crea-ddf'
import listProperties from 'crea-ddf'
Named export. Default export is not available.
DdfDbClient
import { DdfDbClient } from 'crea-ddf/db'
import { DdfDbClient } from 'crea-ddf'
Database client is exported from the /db subpath. Importing from the main entry will not include it.
makeDdfLayerFromEnv
import { makeDdfLayerFromEnv } from 'crea-ddf'
const { makeDdfLayerFromEnv } = require('crea-ddf')
This package is ESM-only. CommonJS require() will fail.
type DdfDbClient
import type { DdfDbClient } from 'crea-ddf/db'
Type imports are recommended when only using the type for annotations.

Queries synced database using DdfDbClient with filters, includes, and pagination. Requires DATABASE_URL in environment.

import { Effect } from 'effect'; import { DdfDatabase, DdfDbClient } from 'crea-ddf/db'; const dbReadLayer = DdfDbClient.layer.pipe( Layer.provide(DdfDatabase.layerConfig), ); const program = Effect.gen(function* () { const ddf = yield* DdfDbClient; const listings = yield* ddf.properties.list({ filters: { active: true, city: 'Toronto', minBedrooms: 2 }, include: { media: { select: ['mediaUrl'] } }, limit: 10, }); return listings; }).pipe(Effect.provide(dbReadLayer)); Effect.runPromise(program).then(console.log).catch(console.error);
Debug
Known issues
breakingRequires Node.js >=24.14.0 or Bun >=1.3.0. Older runtimes will fail.
fix
Upgrade Node.js to version 24.14.0 or later, or use Bun 1.3.0+.
affects: >=0.0.0
breakingEffect v4 beta dependency – API stability not guaranteed between beta releases.
fix
Pin effect and @effect/sql-pg to exact versions. Use bun update with --exact or lockfile.
affects: >=0.0.0
deprecatedSync with live API client is deprecated in favor of database-first workflow.
fix
Use syncDdfDatabaseOnce and DdfDbClient instead of direct listProperties calls.
affects: >=0.0.0
gotchaOpen houses are synced only from listings in the database, not via a DDF replication endpoint. A 30-day date window is used by default.
fix
Ensure listings are synced before open houses, or adjust the date window via configuration.
affects: >=0.0.0
gotchaDatabase client (DdfDbClient) must be provided via Effect layer; it is not a singleton.
fix
Create the layer with DdfDbClient.layer and Layer.provide(DdfDatabase.layerConfig) before use.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'crea-ddf/db' or its corresponding type declarations.
Import path does not exist in the package’s exports map or tsconfig.json.
fix
Use import { DdfDbClient } from 'crea-ddf/db' (lowercase 'db'). Ensure tsconfig.json has moduleResolution: 'bundler' or 'node16'.
TypeError: require() of ES Module is not supported.
Package is ESM-only; CommonJS require() is not supported.
fix
Use `import` statements. If you must use CJS, set `"type": "module"` in your package.json or use dynamic import().
Error: Layer not provided: DdfDbClient
DdfDbClient was used outside of an Effect context without providing the required layer.
fix
Wrap the usage in `Effect.provide(dbReadLayer)` where dbReadLayer includes DdfDbClient.layer and DdfDatabase.layerConfig.
Upgrade
Version history
0.0.6latest on npm
Audit
Dependencies
@effect/platform-bunoptionalRuntime layer for Effect on Bun
@effect/sql-pgrequiredPostgreSQL integration via Effect
drizzle-ormrequiredORM for database schema and migrations
effectrequiredCore Effect library for structured concurrency and error handling
pgrequiredPostgreSQL driver
Agent activity
50 hits · last 30 days
node
44
OpenAI (training)
1
Resources
crea-ddf — npm install crea-ddf · libregistry