DevOps6 min read

Architecture Layer Mapping: See Where Drift Lives in Your Codebase

Not all drift is created equal. Drift in your authentication layer is more urgent than drift in your utility functions. Vibgrate's Architecture Layer Mapping scanner classifies your source files into architectural layers and shows drift risk per layer — making refactoring more predictable.

Drift Has a Location

When your overall drift score is 48, the natural question is: where? Is the drift concentrated in legacy utility code that nobody touches? Or is it in your API layer, your auth stack, your data access layer — the code that handles sensitive operations and changes frequently?

The answer matters enormously for prioritisation. The Vibgrate Architecture Layer Mapping scanner provides it.

How It Works

The scanner analyzes your project structure, package dependencies, and file organization to classify your codebase into architectural layers:

Archetype Detection

First, Vibgrate identifies your project's overall archetype — the architectural pattern it follows:

  • Next.js — pages/app router, API routes, middleware
  • NestJS — modules, controllers, services, guards
  • Express — routes, middleware, handlers
  • Serverless — Lambda handlers, event processors
  • Monorepo — multi-package workspace
  • CLI — command modules, argument parsing

The archetype determines which layer schema is applied.

Layer Classification

Files are classified into layers such as:

  • Presentation: UI components, view templates, layouts
  • API / Route: Endpoint handlers, controllers, API contracts
  • Business Logic: Services, domain models, application logic
  • Data Access: Repositories, ORM models, database queries
  • Infrastructure: Config, middleware, auth, logging
  • Shared / Utility: Helpers, constants, types

Each layer gets a confidence score indicating how certain the classification is.

Per-Layer Drift Analysis

Here is where it gets powerful. For each layer, Vibgrate reports:

  • File count: How much code lives in this layer.
  • Package drift scores: The drift health of packages used primarily in this layer.
  • Risk level: A layer-specific risk assessment.
  • Tech stack attribution: Which frameworks and libraries are used in each layer.
  • Service dependencies: Which external services (databases, auth providers, cloud SDKs) are used in each layer.

Why This Matters for Migrations

Layer-aware drift analysis transforms upgrade planning:

  • Prioritise by impact: Drift in your data access layer (where you handle customer data) is more urgent than drift in your build utility scripts.
  • Scope migrations accurately: "Upgrade ORM in the data access layer" is a much better-defined ticket than "upgrade database packages."
  • Track layer health independently: Your presentation layer might be perfectly current while your infrastructure layer has drifted significantly — or vice versa.
  • Staff appropriately: Different layers require different expertise. Layer mapping helps you assign the right engineers to the right upgrade work.

Configuration

The Architecture Layer scanner is part of the extended scanner suite. To enable it (it is on by default along with other extended scanners), ensure your config includes:

scanners: {
  architectureLayers: { enabled: true },
}

The output appears in both the text report (as a layer summary) and the JSON artifact (as structured data you can query).

The Vibgrate Drift Intelligence Engine provides this layer-aware analysis because drift scoring without context is incomplete. Knowing you are behind is useful. Knowing where you are behind — by architectural layer, by service boundary, by risk surface — is actionable.


Map your drift by layer. Sign up at dash.vibgrate.com to run the architecture scanner and see exactly where your upgrade debt is concentrated.

Sources & References