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-Pattern | Description | Severity |
|---|---|---|
| God Class | Class with too many responsibilities | High |
| Circular Dependency | Modules that depend on each other | High |
| Feature Envy | Class using another classβs data excessively | Medium |
| Shotgun Surgery | Changes requiring many small edits | Medium |
| Long Parameter List | Functions with too many parameters | Low |
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 profileReview 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
- Go to app.mesrai.com
- Select your Repository
- Navigate to Settings β Architecture
- Configure your preferences
Available Settings
| Setting | Description |
|---|---|
| Enable/Disable | Turn architectural analysis on or off |
| Strictness Level | How strict the analysis should be |
| Focus Areas | Which patterns to prioritize |
| Exclusions | Files or folders to skip |
Strictness Levels
| Level | Behavior |
|---|---|
| Strict | Flag all potential architectural issues |
| Moderate | Balance between thoroughness and noise |
| Relaxed | Focus 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
- Start with moderate settings β Begin with standard strictness and adjust based on your codebase
- Incremental adoption β Donβt try to fix all issues at once
- Review regularly β Check architectural insights periodically
- 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