Modules, the patterns I reuse across builds
Pick a module.Three of them you can press.
The patterns I reuse across builds, running in production at Broomstick Hub, Beeline Medical, and the platform Gravixar runs itself on. Each engagement adds to the library, so the next build is faster.
Three have a sandbox on this site. The rest open their write-up, because a pattern that runs in a client system is not the same thing as one you can safely poke at here.
3 interactive13 in the libraryno signup
operations
Review State Machine
interactiveTry itMove a deliverable through DRAFT → INTERNAL_APPROVED → SUBMITTED_FOR_CLIENT → CLIENT_APPROVED with revision branch back into the loop. Every transition writes an audit row.
Runs in Broomstick Hub
Daily Check-in (Office / WFH / Field)
interactiveTry itPick OFFICE / WFH / FIELD on first portal pageview each calendar day. Manager+ team view auto-updates. Unique constraint enforces one status per day per user.
Runs in Broomstick Hub, Beeline Medical
Credentials tracker with AI reminders
in productionReadNPI / state license / DEA / board cert / CAQH / UK GMC / other, with 90/60/30/7-day expiry windows. AI-generated reminder copy via the HIPAA-aware wrapper.
Runs in Beeline Medical
Leave management with atomic balances
in productionReadAnnual / sick / unpaid / parental / bereavement leave with pro-rated entitlements for new joiners. Balance updates run inside a Prisma transaction so balances can't desync.
Runs in Broomstick Hub, Beeline Medical
Shared core package
in productionReadThe reused parts are a private, versioned npm package, not a folder someone copies. One source for the shared modules, auth and 2FA the flagship among them, propagated by a dependency bump rather than a copy.
Runs in Broomstick Hub, Gravixar HQ, gravixar.com
audit & compliance
Audit Log + Safe-Restore
interactiveTry itTwo-tier retention (CONTRACT 7y / OPERATIONAL 1y). Allowlist-gated one-click restore on UPDATE rows. Edit something here, see the audit row appear, click restore, watch the original come back.
Runs in Broomstick Hub, Beeline Medical
Daily security-watch cron
in productionReadSweeps the audit log nightly for anomalies (mass-signup spikes, DELETE bursts, stuck inquiries) and emails admins when something trips. Quiet when nothing is wrong.
Runs in Broomstick Hub
ai & guardrails
AI Intake Wizard
in productionReadAdaptive client intake. Visitor types one or two sentences about their business, the wizard fetches their site, drafts a brand brief the PM walks into the discovery call already holding.
Runs in Broomstick Hub
HIPAA-aware AI Guardrail
in productionReadTwo independent defenses on every Claude call: a PHI sniffer regex pre-persistence, and a wrapper that prepends a stop-clause to every system prompt.
Runs in Beeline Medical
auth & permissions
Identity & Auth
in productionReadNextAuth v5 JWT with the security defaults that should be standard but usually aren't: lockout, breach-list password check, anti-enumeration, invite-only signup.
Runs in Broomstick Hub, Beeline Medical
Role hierarchy + permission guards
in productionReadSTAFF < TEAM_LEAD < MANAGER < ADMIN role ladder plus an isSuperAdmin tier. Guards make permission errors loud and uniform.
Runs in Broomstick Hub, Beeline Medical
finance
Multi-currency finance core
in productionReadEvery monetary row stores native amount + native currency + an FxRateSnapshot foreign key. Reports compute against the snapshot, never live FX.
Runs in Beeline Medical
FBR + EOBI tax engine
in productionReadProperty-tested salary engine for Pakistan's FBR slabs and EOBI rates. Forward Gross→Net + bisection Net→Gross solver. 17/17 vitest property tests green.
Runs in Beeline Medical