System Architecture
The design targets AWS serverless (Lambda, EventBridge, S3, RDS). The prototype simulates it locally with Docker Compose: each container plays the part of an AWS service, so it ran without cloud costs.
Input Layer
REST API upload
(CI/CD webhook in design)
API Gateway
FastAPI
Port: 8000
Analysis Engine
Pattern Detection
Tool Orchestration
Storage
PostgreSQL
MinIO S3
Dashboard
HTML/JS (Nginx)
Port: 3000
Key Components
- ✅ Multi-tool integration (SonarQube, Roslyn, ArchUnit concepts)
- ✅ Result normalisation into one common issue format
- ✅ Conflict-resolution design: semantic similarity, location & pattern-type matching
- ✅ Unified reporting interface
- ✅ RESTful API for CI/CD integration
Docker Containers (simulating AWS services)
8 containers defined in docker-compose.yml. Started with one command: docker-compose up -d
🔌 API Service
FastAPI backend
≈ API Gateway + Lambda
📊 Dashboard
HTML/JS via Nginx
Port: 3000🗄️ PostgreSQL
Results & metadata
≈ Amazon RDS
📦 MinIO
Artifact storage
≈ Amazon S3
🔍 SonarQube
Code Analysis
Port: 9002⚡ Redis
Cache & sessions
≈ ElastiCache
🛠️ Roslyn
.NET Analysis
Tool container☕ ArchUnit
Java Analysis
Tool containerDetection Flow
Analysis Pipeline
A project is submitted via
POST /api/analysis (FastAPI)
SonarQube, Roslyn and ArchUnit concepts analyse the code (simplified implementations)
Real code analysis in
simple_real_detector.py and dataset_specific_analyzer.py
Each finding converted to one schema: type, severity, file & line, description, fix, confidence (0–1)
Design: match duplicates by location, pattern type, description similarity and timing; keep the higher-confidence result
Results via
GET /api/analysis/{id}/results and the dashboard at localhost:3000
Validation Results
Detection Metrics (2 files, 6 known patterns)
Performance
Example Patterns Detected
- ✅ Hardcoded connections, endpoints & credentials
- ✅ Synchronous blocking
- ✅ Shared persistence
- ✅ Distributed monolith
- ✅ Cyclic dependencies / missing API gateway
- ✅ Inappropriate service intimacy / missing idempotency
- ✗ Missed in validation: God Service, hardcoded credentials (need deeper analysis)
Test Projects
- 📁 gs-spring-boot (15 files) → 2 patterns, ~5 s
- 📁 spring-petclinic-microservices (42 files) → 4 patterns, ~15 s
- 📁 sock-shop (38 files, polyglot) → 5 patterns, ~20 s
- 📁 eShopOnContainers (67 files, .NET) → 6 patterns, ~35 s
Code Structure
📁 microservice-antipattern-detector/ ├── 📄 docker-compose.yml (Container orchestration) ├── 📄 README.md ├── 📁 services/ │ ├── 📁 api/ (Main API service) │ │ ├── 📄 Dockerfile │ │ ├── 📄 requirements.txt │ │ └── 📁 app/ │ │ ├── 📄 main.py (FastAPI application, API endpoints) │ │ ├── 📄 real_integrated_analyzer.py (Main analyzer) │ │ ├── 📄 simple_real_detector.py (Pattern detection) │ │ ├── 📄 dataset_specific_analyzer.py (Dataset patterns) │ │ ├── 📄 sonarqube_real.py · archunit_real.py · roslyn_simple.py (Tool concepts) │ │ └── 📁 sample-microservice/ (Test files) │ ├── 📁 dashboard/ (Web interface) │ │ ├── 📄 Dockerfile │ │ └── 📁 src/ │ │ ├── 📄 index.html │ │ ├── 📄 dashboard.js │ │ └── 📄 styles.css │ ├── 📁 sonarqube/ (SonarQube container) │ ├── 📁 archunit/ (ArchUnit container) │ └── 📁 roslyn/ (Roslyn container) └── 📁 validation/ (Validation results) ├── 📄 simple_validation.py └── 📄 validation_summary.md
Key Detection Algorithms (in simple_real_detector.py)
- Keyword Matching: Detects hardcoded connections and database patterns
- Pattern Analysis: Identifies synchronous blocking operations
- Regular Expressions: Finds credentials and method counts
- Dependency Analysis: Detects circular dependencies between services
- Complexity Metrics: Identifies god services (too many methods/dependencies)
•
simple_real_detector.py - Core detection algorithms•
real_integrated_analyzer.py - Orchestrates detection•
dataset_specific_analyzer.py - Handles known test datasets
Frontend & Backend
The prototype has a web dashboard (frontend) that talks to a FastAPI service (backend). The screenshots show it running locally on four real projects.
🖥️ Frontend: dashboard
- Plain HTML, CSS and JavaScript (
services/dashboard/src) - Served by Nginx in its own container at
localhost:3000 - Shows the headline metrics, lets you pick one of the 4 test projects, and starts the analysis
- Lists each finding with its severity, tool, file & line and a suggested fix
⚙️ Backend: REST API
- Python + FastAPI (
services/api/app/main.py) atlocalhost:8000 - Plays the role of API Gateway + Lambda in the AWS design
- Runs the detectors and returns results as JSON
| GET | /api/health | Is the service up? |
| POST | /api/analysis | Start an analysis |
| GET | /api/analysis/{id} | Analysis status |
| GET | /api/analysis/{id}/results | Detected anti-patterns |
Screenshots: the dashboard on each test project
Click any image to open it full size.







