How angeloscode/next-arch works
next-arch combines a project-scaffolding CLI with an ESLint plugin that enforces the generated Feature-Sliced Design boundaries. The main user workflow is invoking a CLI command to initialize, generate, inspect, or remove project structures; initialization gathers selections and applies templates and package choices. The plugin analyzes imports to enforce layer direction, feature public APIs, and server/client separation. The README documents the scaffold’s app-to-view-to-widget/feature composition. Some command internals and templates were not sampled, so their relationships are included only where the README or source index supports them.
Main entry points: src/index.ts CLI commands · src/index.ts ESLint rules · init.ts Initialize project · page.ts Add page preset
Components 23
Project CLI
- CLI commands
packages/next-arch/src/index.ts - Initialize project
packages/next-arch/src/commands/init.ts - Add page preset
packages/next-arch/src/commands/page.ts - Generate slice
packages/next-arch/src/commands/generate.ts - Check architecture
packages/next-arch/src/commands/doctor.ts - Remove slice
packages/next-arch/src/commands/remove.ts - Architecture checks
packages/next-arch/src/lib/doctor-checks.ts - Importer scan
packages/next-arch/src/lib/find-importers.ts
Scaffolding
- Init selections
packages/next-arch/src/lib/init-prompts.ts - Package templates
packages/next-arch/src/lib/packages.ts - Project template
packages/next-arch/src/lib/copy.ts - Page presets
packages/next-arch/src/lib/page-presets.ts - Template rendering
packages/next-arch/src/lib/template.ts
Architecture linting
- ESLint rules
packages/eslint-plugin-next-arch/src/index.ts - Layer resolution
packages/eslint-plugin-next-arch/src/utils/layers.ts - Import visitors
packages/eslint-plugin-next-arch/src/utils/import-visitors.ts - Import boundaries
packages/eslint-plugin-next-arch/src/rules/no-upward-imports.ts - Feature public API
packages/eslint-plugin-next-arch/src/rules/no-deep-imports.ts - Server/client boundary
packages/eslint-plugin-next-arch/src/rules/no-server-in-client.ts - Feature isolation
packages/eslint-plugin-next-arch/src/rules/no-cross-feature-imports.ts
Generated app model
- App layers
packages/next-arch/templates/app/src/app/page.tsx - Domain page presets
packages/next-arch/templates/pages
Other components
- Developer
Connections 26
- Developer → CLI commands: runs commands
packages/next-arch/src/index.ts - CLI commands → Initialize project: dispatches init
packages/next-arch/src/index.ts - CLI commands → Add page preset: dispatches page
packages/next-arch/src/index.ts - CLI commands → Generate slice: dispatches generate
packages/next-arch/src/index.ts - CLI commands → Check architecture: dispatches doctor
packages/next-arch/src/index.ts - CLI commands → Remove slice: dispatches remove
packages/next-arch/src/index.ts - Initialize project → Init selections: collects selections
packages/next-arch/src/commands/init.ts - Initialize project → Package templates: applies selections
packages/next-arch/src/commands/init.ts - Initialize project → Project template: copies template
packages/next-arch/src/commands/init.ts - Add page preset → Page presets: selects preset
packages/next-arch/src/commands/page.ts - Add page preset → Template rendering: renders files
packages/next-arch/src/commands/page.ts - Generate slice → Add page preset: delegates pages
packages/next-arch/src/commands/generate.ts - Check architecture → Architecture checks: runs checks
packages/next-arch/src/commands/doctor.ts - Remove slice → Importer scan: checks importers
packages/next-arch/src/commands/remove.ts - ESLint rules → Import boundaries: registers rule
packages/eslint-plugin-next-arch/src/index.ts - ESLint rules → Feature public API: registers rule
packages/eslint-plugin-next-arch/src/index.ts - ESLint rules → Server/client boundary: registers rule
packages/eslint-plugin-next-arch/src/index.ts - ESLint rules → Feature isolation: registers rule
packages/eslint-plugin-next-arch/src/index.ts - Import boundaries → Import visitors: visits imports
packages/eslint-plugin-next-arch/src/rules/no-upward-imports.ts - Import boundaries → Layer resolution: resolves layers
packages/eslint-plugin-next-arch/src/rules/no-upward-imports.ts - Feature public API → Import visitors: visits imports
packages/eslint-plugin-next-arch/src/rules/no-deep-imports.ts - Feature public API → Layer resolution: resolves feature paths
packages/eslint-plugin-next-arch/src/rules/no-deep-imports.ts - Server/client boundary → Import visitors: visits imports
packages/eslint-plugin-next-arch/src/rules/no-server-in-client.ts - Server/client boundary → Layer resolution: checks server paths
packages/eslint-plugin-next-arch/src/rules/no-server-in-client.ts - App layers → Domain page presets: scaffolds layouts
- Developer → ESLint rules: runs lint