Files
publisher-dashboard/packages/api-contract
RevIQ 8f3f711af0 Add ESLint to all packages and reorganize CLI
ESLint:
- Add @macalinao/eslint-config and eslint to all packages/apps
- Add lint scripts to all package.json files
- Create eslint.config.js for all apps
- Add lint task to turbo.json
- Add @macalinao/eslint-config and @types/bun to catalog

Biome:
- Exclude docs/ from biome checks

CLI Reorganization:
- Restructure CLI to use route maps with one command per file
- Move commands to routes/ directory structure
- Use func property instead of async loaders
- Route maps in _command.ts files for each directory

Environment:
- Use Bun.env instead of process.env for env vars
- Add DATABASE_URL and PORT to turbo.json globalEnv

Lint Fixes:
- Fix nullish coalescing operator usage
- Update deprecated Zod API (z.email() instead of .string().email())
- Fix import sorting

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

@reviq/api-contract

Contract-first API definitions using oRPC and Zod for the Publisher Dashboard authentication system.

Overview

This package defines the complete API contract for all RPC procedures served at /api/v1/rpc. It uses:

  • @orpc/contract - Contract-first RPC framework
  • Zod - Runtime type validation and schema definitions
  • libphonenumber-js - Phone number validation and formatting

Structure

src/
├── index.ts              # Main exports
├── contract.ts           # oRPC contract with all procedure signatures
└── schemas/
    ├── common.ts         # Shared schemas (email, slug, phone)
    ├── auth.ts           # Authentication schemas
    ├── user.ts           # User profile and settings schemas
    ├── org.ts            # Organization schemas
    └── admin.ts          # Admin operation schemas

Usage

import { contract } from "@reviq/api-contract";
import type { loginRequestInputSchema, loginRequestOutputSchema } from "@reviq/api-contract";

// Use the contract to implement server handlers
// Use the schemas for validation and type inference
type LoginRequestInput = z.infer<typeof loginRequestInputSchema>;

API Procedures

Auth (auth.*)

  • Signup, login, logout flows
  • Email verification
  • Password reset
  • WebAuthn (passkey) support

User (me.*)

  • Profile management
  • Password and passkey management
  • Session and device management

Organizations (orgs.*)

  • Org CRUD operations
  • Member management
  • Invitations
  • Site management

Admin (admin.*)

  • Superuser-only operations
  • User and org management
  • Site assignments

Development

# Build the package
bun run build

# Watch mode
bun run dev

# Type checking
bun run typecheck

Notes

  • All emails are automatically transformed to lowercase
  • Phone numbers are stored in E.164 format
  • Slugs follow domain name rules (2-63 chars, lowercase alphanumeric with hyphens)