How epicweb-dev/advanced-vitest-patterns works
Project type and purpose
• This is an educational monorepo that powers the “Advanced Vitest Patterns” workshop. It contains:
• A Node-based CLI plugin (under epicshop/) that integrates with the Epic Workshop CLI to scaffold the workshop.
• A static-site/front-end layer (the public/ directory provides the assets).
• A set of independent exercise packages (under exercises/) for hands-on Vitest training.
• The README confirms it’s a workshop, not a customer-facing full-stack app.
File structure
• Top-level:
• Config & tooling: .github/workflows/validate.yml, eslint.config.js, tsconfig.json, vitest.workspace.js.
• Root package.json and lockfiles orchestrate all sub-projects via npm workspaces.
• epicshop/: Node CLI code (Dockerfile, package.json, helper scripts) that the Epic Workshop CLI uses to add this workshop to a user’s machine.
• public/: static assets (images, CSS/JS) served by the workshop’s front-end.
• exercises/: subdivided into chapters (01.setup, 02.context, 03.assertions, 04.performance), each containing individual exercise folders. Every exercise is a standalone TypeScript + Vitest mini-project with its own package.json, tsconfig*.json, and vitest.config.ts.
README for additional insights
• Confirms TypeScript + Vitest usage.
• Instructs users to install via npx epicshop@latest add advanced-vitest-patterns.
• Mentions CI (validate.yml) and Docker (in epicshop/Dockerfile) for packaging.
Main components & interactions
a. Components:
• Epic Workshop CLI + plugin (epicshop/) (NodeJS backend)
• Static front-end (served from public/)
• Exercise modules (many small TypeScript/Vitest projects)
• CI/CD pipeline (GitHub Actions)
• Containerization/deployment artifacts (Dockerfile, fly.yaml)
• External services: npm registry, GitHub Actions runner, Fly.io (for deployments)
b. Relationships & data flows:
• User runs npx epicshop ... → CLI plugin downloads or links exercises + static assets.
• CLI writes into user’s file system, installs dependencies from npm.
• Front-end reads exercise content (Markdown/MDX) and assets from public/.
• Vitest runner (root-level via vitest.workspace.js) can execute tests in every exercise sub-folder.
• CI pipeline triggers validate.yml → installs root workspace → runs lint, build, test across all modules.
• Dockerfile packages the CLI plugin for containerized distribution; fly.yaml configures Fly.io deployment.
c. Architectural patterns & principles:
• Monorepo with npm workspaces for isolation and shared config
• Plugin architecture: epicshop/ extends a parent CLI
• Convention-over-configuration for exercises (tsconfig.*.json, identical project layout)
• CI enforcement of consistency across all exercises
• Static asset bundling for front-end distribution
d. Key technologies:
• Node.js, npm workspaces
• TypeScript
• Vitest + Vitest workspace runner
• Docker + Fly.io (deployment)
• GitHub Actions (CI)
Elements
• Clear labels: “Epic Workshop CLI Plugin”, “Static Front-end”, “Exercise Modules (Vitest Workspaces)”, “CI/CD Pipeline”, “Docker & Fly.io”
• CLI → npm registry (install)
• CLI → user FS (scaffold exercises + front-end)
• Vitest workspace → exercise modules (test execution)
• CI → repo → build/test pipeline → Docker → Fly.io
• Green for static assets/front-end
• Yellow for exercise modules cluster
• Gray for infra (Docker, Fly.io, npm registry, GitHub Actions)