Files
publisher-dashboard/packages/db/README.md
igm 01f1e1c9e3 Add READMEs for remaining packages
- db-schema: Database schema types from kysely-codegen
- db: Database client and helper functions
- testing: Overview of testing packages
- test-helpers: Database testing utilities
- virtual-authenticator: WebAuthn virtual authenticator

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

34 lines
842 B
Markdown

# @reviq/db
Database client and helper functions for the RevIQ platform.
## Usage
```typescript
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