How sagigl/split-connectivity works
Project type and purpose
• This is a full-stack real-time web application built with Next.js/React on the frontend and a standalone Node.js/Socket.IO server on the backend.
• Purpose: launch multiple synchronized browser windows that communicate in real time, animate “sphere” components, and display live data via WebSockets.
File structure
• Top-level:
• pages/index.tsx → Next.js entry point for the UI
• server/server.js → Node/Express + Socket.IO real-time server
• components/… → React UI components, including sphere visuals and link lines
• styles/, tailwind.config.ts, postcss.config.mjs, globals.scss → styling via Tailwind, Sass, CSS-in-JS
• types/Windows.type.ts → TypeScript types for window metadata
• openChrome.scpt → AppleScript to programmatically open new windows
• Configuration: next.config.ts, tsconfig.json, eslint.config.mjs, postcss.config.mjs, .prettierrc
Key architecture details from README
• Next.js for SSR/SSG of the React UI
• Socket.IO for real-time, cross-window synchronization
• Styled-Components (in code) + Tailwind + Sass for visual styling
• No external database—state is held in memory and broadcast via Socket.IO
Main components and their relationships
a. Frontend (Next.js/React)
• pages/index.tsx loads React app
• React components (Container, NewWindowButton, sphere subcomponents) handle visuals & user interactions
• openChrome.scpt can be invoked to spawn new browser windows pointing to the same URL
b. Backend (Node.js + Socket.IO)
• server/server.js sets up an HTTP + WebSocket endpoint
• Maintains connection registry and relays events (window join, move, sphere updates)
c. Communication flow
• HTTP(S) GET / → Next.js server → serves initial HTML/CSS/JS
• WebSocket (Socket.IO) channel → bidirectional real-time events
• Clients emit “move” or “createSphere” events → server broadcasts to all connected clients
Architectural patterns & design principles
• Real-time Pub/Sub via Socket.IO (event bus)
• Component-based UI (React) with clear separation of concerns (Container vs. sphere visuals)
• CSS layering: global Tailwind/Sass + scoped Styled-Components
• Type safety via TypeScript