When building interactive consumer micro-tools in Next.js, the fastest way to kill both profit margin and UX is putting simple deterministic math or share-card rendering behind a serverless function. Cold starts add 800ms–2s of spinner lag, Puppeteer/Satori image endpoints burn compute, and mobile users bounce before the result even appears.
While shipping three new client-side interactive tools on our site—a moon phase soulmate calculator , a soulmate by birth date calculator , and an interactive avoidant no-contact stage locator —we moved 100% of the calculation, SVG visualization, and 1080×1350 PNG share-card export into pure browser TypeScript .
Here are four real engineering lessons (including a subtle 180° geometry bug we only caught through headless Chrome visual screenshots).
1. Real Lunar Elongation in ~25 Lines of Pure TypeScript (No API Calls)
Many birthday moon tools estimate lunar phases by taking (daysSinceKnownNewMoon % 29.53) .…