How johntheo/brokeniceberg works
Project type and purpose
• This is a single‐page application (SPA) built with React and Vite, focused purely on frontend functionality.
• Purpose: display random icebreaker questions, support i18n (English, Spanish, Portuguese), allow copying/sharing via URL, and track user events via GA4. It is deployed as static assets on Firebase Hosting.
File structure
• Top level:
• index.html, public/ — static entry point and public assets
• src/ — all React/TS source code
• src/pages/Home.tsx — main page component
• src/components/… — UI components (InfoModal, QuestionDisplay, LanguageSelector)
• src/components/ui/… — low-level Shadcn UI primitives (button, card, dialog, etc.)
• src/assets/*.json — translation files
• src/lib/utils.ts — utility functions (e.g., random selection)
• main.tsx → mounts <App />
• App.tsx → wraps router, context, analytics init
• Config/deploy:
• vite.config.ts → build tool config
• tailwind.config.js, postcss.config.js → styling
• firebase.json → hosting deployment settings
• package.json → dependencies (React, react-ga4, Shadcn, Firebase CLI)
README for additional insights
• Confirms tech stack: React, TypeScript, Vite, Shadcn UI, Firebase Hosting, GA4 via react-ga4.
• Features section highlights user flows: language selection, URL-driven state, copy/share, analytics events.
a. Main components
1. User’s Browser (Client)
2. Firebase Hosting + CDN
3. Static Assets (index.html, JS/CSS bundles, translation JSON)
4. React SPA
• App shell (App.tsx → React Router if used)
• Core UI components (QuestionDisplay, LanguageSelector, InfoModal)
• Utility layer (utils.ts)
5. External Service: Google Analytics 4
b. Relationships and interactions
• Browser → Firebase Hosting (HTTP GET) → receives index.html + bundles + assets
• React SPA bootstraps in browser; loads translation JSON on demand
• User interactions (click “new question,” select language) trigger state updates in the SPA
• SPA writes to URL query string for shareable link
• SPA calls Clipboard API for “copy”
• SPA sends analytics events via GA4 HTTP calls
c. Architectural patterns and design principles
• SPA architecture (client-side routing, static hosting)
• Component-based design (atomic UI primitives in src/components/ui, composite components in src/components)
• Configuration-driven i18n (JSON files loaded per language)
• Separation of concerns: utilities separated from UI components
d. Relevant technologies/frameworks
• React + React Router
• Vite for build/dev
• TypeScript for typing
• Tailwind CSS + Shadcn UI components
• Firebase Hosting for static asset delivery
• Google Analytics 4 with react-ga4 integration
Essential details to capture
• Static asset delivery path via Firebase + CDN
• Runtime component hierarchy in the browser
• i18n asset loading flow
• URL-driven state and share logic
• Analytics integration flow