How migrationsverket/midas works
Project Type & Purpose
• This is a monorepo (managed with Nx and Lerna) that houses a React-based design-system (“Midas”), its documentation site, sample/demo apps, playgrounds, E2E test harnesses, and developer tools.
• The core deliverable is a publishable component library (packages/components), backed by a Docusaurus-powered docs site (apps/docs), plus example integrations (Next.js, Remix, Vite), playgrounds and test suites.
File Structure Analysis
• Root: monorepo config (lerna.json, nx.json), CI workflows (.github/workflows), lint/format tooling, and global tsconfigs.
• /packages/components: the component library (source, stories, tests, Storybook config).
• /apps/docs: Docusaurus site with MDX docs, changelog plugin, code examples, i18n, build config.
• /apps/next, /apps/remix, /apps/remix-vite: sample apps showing library integration in Next.js and Remix contexts.
• /apps/playground & /apps/playground-e2e, /apps/next-e2e: developer sandbox and Cypress E2E tests.
• /tools: custom executors, lint plugins, plop generator for code scaffolding.
Key README Insights
• Midas is a design system for UX consistency, accessibility, and reusability.
• CI badges show automated component builds, docs generation, Storybook tests, and Chromatic visual testing.
Diagramming the Architecture
• Monorepo Root (Nx/Lerna orchestrator)
• Component Library (packages/components)
• Documentation Site (apps/docs)
• Sample Apps (apps/next, apps/remix, apps/remix-vite)
• Playground (apps/playground)
• E2E Test Suites (apps/next-e2e, apps/playground-e2e)
• Developer Tools (tools/eslint, tools/dependencies, tools/stylelint-plugin, plopfile.js)
• CI/CD Pipelines (GitHub Actions workflows, Chromatic)
• External Services: npm registry (publishing), Chromatic, GitHub Pages or hosting for docs.
• Sample Apps & Docs Site → import → Component Library
• Playground → import → Component Library
• E2E Suites → test → Sample Apps / Playground
• CI Pipelines → run → builds/tests → Storybook → publish to Chromatic
• CI Pipelines → build & deploy → Docs Site
• Monorepo Tooling (Nx/Lerna) → orchestrates → build/test/publish tasks
• Developer Tools → integrated into → CI and local dev workflows
c. Architectural Patterns & Principles:
• Monorepo with logical separation: “apps/”, “packages/”, “tools/”
• Library-first approach: components are standalone, versioned, and documented
• Documentation as code: MDX in Docusaurus pulling component metadata and examples
• CI-driven quality: automated linting, unit tests, visual regression, E2E tests
• Pluggable tooling: custom executors and stylelint/plugin for consistent standards
d. Key Technologies & Frameworks:
• Nx & Lerna (monorepo management)
• TypeScript, React, Babel, Vite
• Storybook + Chromatic (component preview & visual testing)
• Docusaurus (docs site)
• Next.js & Remix (sample apps)
• Cypress (E2E)
• ESLint, Stylelint, Prettier, Husky (code quality & hooks)
• GitHub Actions (CI/CD)