Registry / database / hazo_connect

hazo_connect

JSON →
library3.3.0jsnpmunverified

A Node.js/Next.js database abstraction layer with query builder interface (v3.3.0). Supports PostgreSQL via PostgREST, SQLite, and Supabase backends. Fully independent with zero core dependencies, TypeScript-first, and enforced server-side usage. Features fluent query builder, CRUD service helper, singleton connection pooling, and optional SQLite admin UI. Useful for Next.js apps needing a unified database layer across adapters.

npm install hazo_connect
INSTALL
IMPORT
SIG · HAZO_CONNECT
H
hazo_connect
databasejavascriptv3.3.0
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.

QueryBuilder
import { QueryBuilder } from 'hazo_connect/server'
import { QueryBuilder } from 'hazo_connect'
QueryBuilder is only exported from 'hazo_connect/server'. Importing from root only gives types.
createHazoConnect
import { createHazoConnect } from 'hazo_connect/server'
const createHazoConnect = require('hazo_connect/server').createHazoConnect
Package is ESM-only; require() will fail with ERR_REQUIRE_ESM.
createHazoConnectFromEnv
import { createHazoConnectFromEnv } from 'hazo_connect/nextjs/setup'
import { createHazoConnectFromEnv } from 'hazo_connect/server'
Setup helpers are in the 'nextjs/setup' subpath, not 'server'.
createApiRouteHandler
import { createApiRouteHandler } from 'hazo_connect/nextjs'
For Next.js API route helpers, use 'hazo_connect/nextjs'.
HazoConnectConfig
import type { HazoConnectConfig } from 'hazo_connect/ui'
import { HazoConnectConfig } from 'hazo_connect'
Types for client components should be imported from 'hazo_connect/ui' to avoid importing server code.

Demonstrates Next.js API route using environment-based SQLite config, query builder with filters, sorting, and pagination.

import { createHazoConnectFromEnv } from 'hazo_connect/nextjs/setup'; import { QueryBuilder } from 'hazo_connect/server'; import { NextResponse } from 'next/server'; // Ensure environment variables are set: // HAZO_CONNECT_TYPE=sqlite // HAZO_CONNECT_SQLITE_PATH=./database.sqlite // HAZO_CONNECT_ENABLE_ADMIN_UI=true export async function GET() { const hazo = createHazoConnectFromEnv(); const users = await hazo.query( new QueryBuilder() .from('users') .select('id, name, email') .eq('active', true) .order('created_at', { ascending: false }) .limit(10) ); return NextResponse.json({ data: users }); }
Debug
Known issues
gotchaServer-side only: importing server subpaths (server, nextjs) into client components will break.
fix
Use 'hazo_connect' (types only) or 'hazo_connect/ui' for client component type imports.
affects: >=3.0.0
breakingPeer dependency requirements: hazo_core and hazo_logs are mandatory peer deps. Missing them causes runtime errors.
fix
Run: npm install hazo_core hazo_logs
affects: >=3.0.0
gotchaESM-only package. CommonJS require() will throw ERR_REQUIRE_ESM.
fix
Use dynamic import() or switch to ESM (type: module in package.json).
affects: >=3.0.0
deprecatedSupabase adapter may not be maintained; prefer direct PostgREST usage.
fix
Use type: 'postgrest' with Supabase URL and anon key.
affects: >=3.0.0
gotchaSingleton pattern may cause stale connections in hot-reload dev environments.
fix
Use createHazoConnectFromEnv() per request or implement manual connection lifecycle.
affects: >=3.0.0
Errors
Common errors & fixes
Error: Cannot find module 'hazo_connect/server'
Typo or wrong import path: using root import instead of subpath.
fix
Change import to 'hazo_connect/server' for server-side functionality.
Error: Must use import to load ES Module: /path/to/node_modules/hazo_connect/dist/index.js
Using require() in a CommonJS file; package is ESM-only.
fix
Use import statement (ESM) or dynamic import(). Add '"type": "module"' to package.json.
Error: HazoConnectConfig is not a constructor
Importing type as value from 'hazo_connect' or wrong subpath.
fix
Use import type { HazoConnectConfig } from 'hazo_connect/ui'.
Error: createHazoConnectFromEnv is not defined
Importing from wrong subpath; this function is only in 'hazo_connect/nextjs/setup'.
fix
Import from 'hazo_connect/nextjs/setup'.
Upgrade
Version history
3.3.0latest on npm
Audit
Dependencies
hazo_corerequiredCore runtime dependency for database operations
hazo_logsrequiredLogging dependency injected via dependency injection
hazo_configoptionalOptional INI config file support
hazo_uioptionalRequired for SQLite admin UI
hazo_debugoptionalRequired for SQLite admin UI
Agent activity
10 hits · last 30 days
node
10
Resources
hazo_connect — npm install hazo_connect · libregistry