FeaturesArchitectural Analysis

Architectural Analysis

New in v2.0 β€” Architectural Analysis has been completely rebuilt with improved detection and insights.

Mesrai’s Architectural Analysis helps you maintain clean, scalable code architecture by detecting anti-patterns and providing design recommendations.

Overview

Architectural Analysis goes beyond line-by-line code review to evaluate:

  • Layer violations β€” Ensuring proper separation of concerns
  • Circular dependencies β€” Detecting and preventing dependency cycles
  • Coupling analysis β€” Identifying tightly coupled components
  • Cohesion metrics β€” Ensuring modules have focused responsibilities

Key Features

Dependency Analysis

Mesrai analyzes your codebase to understand:

  • How modules depend on each other
  • Potential circular dependency issues
  • Overly complex dependency chains
  • Unused or redundant dependencies

Anti-Pattern Detection

Mesrai detects common architectural anti-patterns:

Anti-PatternDescriptionSeverity
God ClassClass with too many responsibilitiesHigh
Circular DependencyModules that depend on each otherHigh
Feature EnvyClass using another class’s data excessivelyMedium
Shotgun SurgeryChanges requiring many small editsMedium
Long Parameter ListFunctions with too many parametersLow

Layer Boundary Checks

Mesrai validates that your code follows proper architectural layers:

  • Presentation layer shouldn’t directly access database
  • Business logic should be separate from UI components
  • Infrastructure code should be isolated

How It Works

Automatic Analysis

Architectural analysis runs automatically on every PR:

PR #123: Add user management feature

Architecture Analysis Results:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
βœ… No circular dependencies introduced
βœ… Code follows established patterns
⚠️ Consider splitting UserService - it handles both auth and profile

Review Comments

When architectural issues are found, Mesrai provides:

  • Clear explanation of the issue
  • Why it matters for maintainability
  • Suggestions for improvement
  • Links to best practices

Configuration

All settings are configured through the Mesrai Dashboard β€” no config files needed!

How to Configure

  1. Go to app.mesrai.com
  2. Select your Repository
  3. Navigate to Settings β†’ Architecture
  4. Configure your preferences

Available Settings

SettingDescription
Enable/DisableTurn architectural analysis on or off
Strictness LevelHow strict the analysis should be
Focus AreasWhich patterns to prioritize
ExclusionsFiles or folders to skip

Strictness Levels

LevelBehavior
StrictFlag all potential architectural issues
ModerateBalance between thoroughness and noise
RelaxedFocus on critical issues only

What Gets Analyzed

Code Organization

  • Module structure and boundaries
  • File and folder organization
  • Naming conventions
  • Code grouping

Dependencies

  • Import/export relationships
  • Third-party library usage
  • Internal module dependencies
  • Circular reference detection

Design Patterns

  • Proper use of design patterns
  • SOLID principle adherence
  • Clean architecture practices
  • Separation of concerns

Best Practices

  1. Start with moderate settings β€” Begin with standard strictness and adjust based on your codebase
  2. Incremental adoption β€” Don’t try to fix all issues at once
  3. Review regularly β€” Check architectural insights periodically
  4. Team alignment β€” Ensure your team agrees on architectural standards

Metrics & Insights

Track architectural health over time in your dashboard:

  • Dependency count β€” Total and per-module dependencies
  • Issue trends β€” How architectural issues change over time
  • Common patterns β€” Most frequent issues in your codebase
  • Improvement tracking β€” Progress on fixing issues

Next Steps