How lukehollanddev/algorithm-animator works
Project Type and Purpose
• This is a client-only Single Page Application (SPA) built with React.js, intended to aid learning by animating and visualizing graph-based (and eventually other) algorithms in the browser.
• There is no backend service—everything runs client-side—and it is hosted as a static site on GitHub Pages, with CI/CD pipelines in GitHub Actions.
File-Structure Analysis
• Top-level:
• public/ (static HTML/CSS/manifest for browser entry point)
• src/ (React source code)
• .github/workflows/ (CI/CD pipeline definitions)
• src/ subdirectories:
• algorithms/ (algorithm implementations: bfs.js, dijkstra.js)
• util/ (helpers, e.g. createStep)
• constant/ (configuration)
• assets/ (static images/fonts if any)
• __tests__ under components—unit tests run via Jest.
Architecture Overview from the README
• React.js for UI
• Node.js & Yarn for local dev/build
• ESLint & Jest for quality and testing
• GitHub Actions for build/test/deploy (three workflows: all.yml, develop.yml, prod.yml)
• GitHub Pages for static hosting (prod and dev URLs)
Main Components
A. Developer & CI/CD Pipeline
1. Developer Machine
• Node.js + Yarn + local Git repo
• IDE / code edits → src/ + public/
2. GitHub Repository
• .github/workflows/all.yml (runs lint + test)
• .github/workflows/develop.yml (build + deploy to dev URL)
• .github/workflows/prod.yml (build + deploy to prod URL)
3. GitHub Pages
• Hosts static bundle at https://amazonpriime.github.io/indproj (prod)
• Secondary for dev
B. Client (Browser)
1. Entry Point
• public/index.html → loads bundled JS/CSS
2. React Application
• App.js (root component)
• State Management (useState/useReducer hooks hold graph state, steps, playback index, speed)
3. UI Layer (components/)
• GraphBuilder ← user adds/edits nodes & edges
• AlgorithmSelector ← choose BFS, Dijkstra
• Graph ← visual node/edge rendering
• Playback ← controls (play/pause/step/speed)
• CodeViewer ← show pseudocode & highlight current step
• AlgInfo ← show description & complexity
4. Algorithm Engine (algorithms/)
• bfs.js, dijkstra.js export a function( graph, source, dest, directed ) → steps[]
• Steps created by util/createStep (in util/util.js)
5. Configuration & Constants
6. Assets & Styling
• CSS modules alongside each component
• index.css & App.css
• Developer → (push code) → GitHub Actions → (build/test) → GitHub Pages
• Browser → (HTTP GET) → GitHub Pages → returns index.html + bundle
• User interacts in Browser:
• GraphBuilder → updates App state → passes graph data to Algorithm Engine → returns steps[] → stored in App state
• Playback controls iterate through steps[] → trigger re-render of Graph + CodeViewer → animate changes
• Component Hierarchy: App.js at top → passes props & callbacks down to child components → child events bubble up
Architectural Patterns & Principles
• SPA (Single‐Page Application) hosted statically
• Component‐Based UI (React) with unidirectional data flow
• Separation of Concerns: UI vs. algorithm logic vs. utility vs. config
• CI/CD as code (GitHub Actions workflows)