Behind MacOS Portfolio: Building a Desktop GUI at 60 FPS in the Browser
Architectural walkthrough of recreating the macOS Sequoia desktop in the browser: GSAP parabolic dock magnification, window collision management, and a Groq-powered Siri AI companion.
Rendering Target
60 FPS Compositor
Interactive Apps
25+ Built-in
AI Companion
Siri (Groq LPU)
Window Engine
GSAP + Zustand
1. The Audacious Goal: A Real Operating System Experience in the Browser
Most developer portfolios follow a predictable layout: vertical scroll sections with cards and text. I wanted to build something that would challenge the limits of modern browser rendering: a complete macOS Sequoia desktop simulation featuring a realistic boot sequence, an interactive lock screen with session persistence, menu bar controls, a dynamic notch, and 25+ functional applications.
To provide a first-class experience on any device, the system features a dual layout: desktop viewports (>=768px) launch the multi-window desktop with draggable shortcuts and dock magnification, while mobile devices (<768px) seamlessly render an iOS-style home screen with swipeable Control Center and an Assistive Touch quick-action orb.
Building an operating system in the browser requires treating the DOM like a native window compositor.
2. 60 FPS Dock Physics: The Exponential Decay Proximity Curve
The hallmark of macOS is its iconic magnification dock. When the cursor glides across the dock, icons scale smoothly based on proximity. Standard CSS hover pseudo-classes cannot compute neighbor influence in real-time.
In useDock.js, we compute the distance between the cursor and each icon's horizontal center, applying an exponential decay curve to calculate scaling intensity. Transforms are executed via GSAP hardware-accelerated transforms (transform: translate3d and scale), avoiding layout recalculation and paint cycles.
๐ Key Engineering Takeaways:
- โExponential decay curves provide authentic Apple-like magnification.
- โElastic easing curves ensure playful, physics-driven icon recovery.
- โPurging inline styles during app reordering prevents layout tearing during drag events.
3. Window Management & Dock Collision Detection (windowWrapper.jsx)
Managing multiple overlapping windows requires handling z-index stacking, dragging boundaries, 8-direction resizing, and minimize/maximize animations. We architected a higher-order component (windowWrapper.jsx) paired with a Zustand store enhanced by Immer middleware.
When a window is focused, only its z-index increments (state.nextZIndex++), preventing wasteful re-renders of the entire desktop. When a window is dragged over the dock, checkDockCollision inspects bounding rect overlaps and automatically toggles isDockHiddenByCollision to keep window contents unobstructed.
4. Voice-Enabled Siri AI Assistant Powered by Groq
A desktop experience wouldn't be complete without Siri. We integrated a multimodal AI assistant capable of speech recognition, conversational intelligence, and text-to-speech feedback.
Incoming audio is transcribed using Groq's high-speed Whisper endpoint (/api/groq/transcribe), then passed to a custom Next.js API route (/api/groq/chat) running llama-3.1-8b-instant. The system prompt equips Siri with contextual awareness of the developer's projects, experience, technical proficiencies, and contact information.
Groq's ultra-low inference latency allows Siri to respond almost instantaneously, mimicking native device assistants.
5. The 25+ App Ecosystem & Performance Takeaways
To make the desktop feel genuinely alive, we built 25+ interactive applications: an xterm.js terminal emulator with custom commands, dynamic notch with Jamendo music streaming, live weather from wttr.in, OpenStreetMap geolocation, and in-browser PDF resume viewing.
By employing Next.js dynamic code splitting, initial bundle sizes remain under 150kB gzipped. Offloading window coordinates and animations to the GPU compositor thread ensures that even with 5 windows open simultaneously, frame rates never drop below 60 FPS.
๐ Key Engineering Takeaways:
- โAnimate purely with transform3d and opacity to keep animations off the main thread.
- โZustand with Immer allows surgical state updates without cascading component re-renders.
- โPairing voice transcription with Groq LPU inference elevates web portfolios into memorable interactive experiences.
โ Kuldeep Rajput โ๏ธ
Software Developer ยท building ambitious full-stack web apps