How rancher/dashboard works
Project Type & Purpose
• This is a monorepo for a full-stack, Vue/Nuxt-based single-page application (“shell”) that powers the Rancher Dashboard UI.
• It includes an extension/plugin mechanism (pkg/*), a shared component library (pkg/rancher-components), E2E tests (cypress/), documentation site (docusaurus/), storybook for components, and CI/CD scripts (.github/, scripts/).
File-Structure Analysis
• Top-level directories:
• shell/ – the main Vue application: components/, pages/, store/, plugins/, utils/, models/, router/
• pkg/ – extension packages (AKS, EKS, GKE, imported, kubectl-explain, rancher-components, rancher-prime, etc.) each exporting Vue components and provisioners
• cypress/ – end-to-end tests and fixtures, page-object models, commands, CI scripts
• docusaurus/ – internal developer docs site
• storybook/ – interactive component explorer
• scripts/ – build, packaging, publishing, versioning, test orchestration
• .github/ – GitHub Actions workflows for linting, tests, build & publish
• Build/config files: vue.config.js, tsconfig.json, babel.config.js, jest.config.js
Core README Insights
• Rancher Dashboard is a UI for Kubernetes cluster management with a plugin API for extensions.
• Internal docs live under docusaurus/; extension docs are external.
a. Main Components
1. Developer/CI Layer
– Developer Workstation: clone, install, run scripts
– CI/CD Pipelines (GitHub Actions, Jenkins via cypress/jenkins/)
2. Build & Package Layer
– scripts/ & package.json scripts produce:
• shell bundle (Web assets)
• npm packages for pkg/* modules
• docs site (docusaurus)
• storybook build
3. Runtime UI Application (“shell”)
– Vue/Nuxt SPA
– Vuex store (shell/store/)
– Router & navigation guards (shell/config/router/)
– Plugins loader (shell/core/, dynamic imports via shell/pkg/)
– Shared component library (pkg/rancher-components)
– Extension packages (pkg/*) dynamically loaded at runtime
4. External Services
– Rancher API Server (REST + WebSocket via steve plugin)
– Cloud-provider APIs (AWS, Azure, GCP) used by extension provisioners
5. Testing & Quality
– Unit tests (Jest in each pkg and shell/__tests__)
– E2E tests (cypress/) running in CI
– Storybook (component isolation + snapshot tests)
6. Documentation
– Docusaurus site (docusaurus/) for internal developer docs
– README, API specs under docs/
b. Relationships & Data Flows
• Developer → triggers CI pipelines → runs lint, unit, E2E, storybook, docs build → publishes npm packages & docs
• Browser loads shell bundle → initializes plugins via shell/core/plugins-loader → merges core modules + each pkg/* extension
• shell app ↔ Vuex store (synchronous state management)
• shell app → Rancher API (HTTP REST) for CRUD on k8s resources
• shell app → WebSocket to receive live updates via steve plugin
• shell app → dynamic imports pkg/* to extend UI (new pages, components, nav items)
• cypress runner → controls browser → executes page-object flows → validates UI against mock or real API
c. Architectural Patterns & Principles
• Modular plugin architecture: core + extensions loaded at runtime
• MVVM via Vue.js (views in shell/pages + components, state in Vuex store)
• Layered testing: unit, E2E, integration in storybook
• Monorepo with per-package versioning and shared dev scripts
d. Key Technologies
• Vue.js + Nuxt (shell)
• Vuex for state
• Typescript/Javascript, Babel, Webpack
• Jest for unit tests
• Cypress for E2E
• Docusaurus for docs
• Storybook for UI components
• GitHub Actions & Jenkins for CI/CD