# lib/

Shared utilities and service clients. Anything imported by both server and
client code lives here. Server-only utilities (Stripe secret, Prisma) must
never be imported into a client component — Next.js will warn.

Per LAUNCH.md §6, target inventory:

- `ai.ts` — AI provider factory (OpenAI ↔ Gemini, admin-switchable)
- `auth.ts` — NextAuth v5 configuration + `auth()` helper
- `db.ts` — Prisma client singleton (HMR-safe)
- `encryption.ts` — AES-256-GCM helpers for `AdminSetting` (AI keys)
- `plans.ts` — Plan feature gates (FREE / PRO / BUSINESS)
- `rate-limit.ts` — Per-user LRU rate limiter for AI routes
- `utils.ts` — `cn()` Tailwind class merger
- _coming:_ `stripe.ts`, `paypal.ts`, `geocode.ts`, `weather.ts`, `pdf.ts`,
  `email.ts`, `usage.ts`, `slug.ts`
