Files
publisher-dashboard/packages/db
igm c9de0b1ac5 Add sideEffects: false to all library packages
Enables tree-shaking for bundlers by marking all library packages
as side-effect-free.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 15:22:24 +08:00
..
2026-01-12 13:59:34 +08:00

@reviq/db

Database client and helper functions for the RevIQ platform.

Usage

import { createDb } from "@reviq/db";

const db = createDb(process.env.DATABASE_URL);

// Use db with Kysely queries
const users = await db.selectFrom("users").selectAll().execute();

// Clean up when done
await db.destroy();

Exports

Client

  • createDb(url) - Create a Kysely database instance

Helper Functions

  • executeBootstrap(trx, input) - Bootstrap a new database with superuser and org
  • generateToken() - Generate an API token
  • hashToken(token) - Hash a token for storage
  • parseToken(token) - Parse and validate a token
  • TOKEN_PREFIX - The reviq_ prefix for API tokens

Types

  • Database - Re-exported from @reviq/db-schema
  • BootstrapInput / BootstrapResult - Types for bootstrap operation