Backend: - Add me.invites endpoints (list, get, accept, decline) to API contract - Create invites procedures for fetching user's pending invites - Only show invites if email matches and is verified - Refactor me routes into me/_routes.ts for consistency Frontend: - Add pending invitations section to /dashboard page - Create /account/org-invites/[inviteId] page for accept/decline - Show invite details (org, role, inviter, dates) - Redirect to org dashboard after accepting Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@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)