stnd.build

Application Code Inside src Directory

Error: [ERR_SRC_NOT_MINIMAL] Found application feature components directly in src/components/. Law #5: src/ minimal — place app code in modules/.


The Problem

Application feature components, pages, or domain logic are located inside a flat src/ directory instead of vertical-slice feature modules under modules/.

my-app/
├── src/
│   ├── components/       <-- Violation: flat application components
│   │   ├── Writer.astro
│   │   └── Feed.svelte

The Why

Standard architecture organizes features by vertical slices, not technical types (Law #5).

  1. Vertical slice encapsulation: A feature contains its own models, components, routes, and styles in a self-contained module under modules/<name>/.
  2. Minimal entry point: In a Standard application, src/ is reserved strictly for framework wiring, the root layout, and entry pages that mount modules.
  3. Preventing flat dumping grounds: Flat directories like src/components/ and src/utils/ inevitably turn into unmaintainable dumping grounds where dependencies become unmanageable.

The Solution

Scaffold or move the feature code into a designated module inside modules/:

# Use stnd CLI to scaffold a new vertical slice
stnd module writer

Resulting compliant structure:

my-app/
├── modules/
│   ├── writer/
│   │   ├── index.module.js
│   │   ├── components/
│   │   └── actions/
└── src/
    └── pages/