This document outlines the microservices architecture for splitting the monolithic test management platform into independently deployable services.
┌─────────────────────────────────────────────────────────────────────────┐
│ API Gateway / BFF │
│ (Express + CORS + Helmet) │
│ Port: 3000 │
└─────────────────────────────────────────────────────────────────────────┘
│
┌───────────────┼───────────────┐
│ │ │
┌───────────▼────┐ ┌──────▼─────┐ ┌─────▼──────┐
│ Event Bus │ │ Service │ │ Service │
│ (Redis/RabbitMQ│ │ Registry │ │ Discovery │
│ or In-Memory)│ │ │ │ │
└───────┬────────┘ └─────────────┘ └────────────┘
│
┌───────────┼───────────┬────────────┬────────────┬────────────┐
│ │ │ │ │ │
┌───▼────┐ ┌──▼─────┐ ┌──▼──────┐ ┌─▼──────┐ ┌─▼──────┐ ┌─▼──────┐
│ User │ │ Agile │ │ Code │ │Pipeline│ │ Test │ │Report │
│ Admin │ │ Board │ │ Tracer │ │/GitOps │ │ Mgmt │ │Service │
│Service │ │Service │ │ Service │ │Service │ │Service │ │ │
│:4001 │ │:4002 │ │ :4003 │ │ :4004 │ │ :4005 │ │ :4006 │
└────┬───┘ └───┬────┘ └────┬────┘ └────┬───┘ └───┬────┘ └───┬────┘
│ │ │ │ │ │
└──────────┴────────────┴────────────┴──────────┴───────────┘
│
┌───────────────┼───────────────┐
│ │ │
┌───────▼────────┐ ┌──▼───────┐ ┌───▼─────────┐
│ Shared Database│ │ S3/Blob │ │ Cache │
│ (PostgreSQL or │ │ Storage │ │ (Redis) │
│ JSON files) │ │ │ │ │
└────────────────┘ └──────────┘ └─────────────┘
Responsibility: User authentication, authorization, team management, role-based access control
Modules:
user-manager.tsteam-hierarchy.ts
API Endpoints:
POST /api/users/registerPOST /api/users/loginGET /api/users/:idPUT /api/users/:idDELETE /api/users/:idGET /api/teamsPOST /api/teamsGET /api/teams/:id/members
Database Schema:
- Users table
- Teams table
- Roles table
- Permissions table
Tech Stack:
- Express.js
- JWT for authentication
- bcrypt for password hashing
- PostgreSQL or JSON files
Responsibility: Agile boards, sprints, stories, backlogs, velocity tracking
Modules:
agile.tsagile-hierarchy.ts
API Endpoints:
GET /api/boardsPOST /api/boardsGET /api/boards/:idPUT /api/boards/:idDELETE /api/boards/:idGET /api/boards/:id/sprintsPOST /api/boards/:id/sprintsGET /api/sprints/:idPOST /api/sprints/:id/startPOST /api/sprints/:id/completeGET /api/storiesPOST /api/storiesPUT /api/stories/:idDELETE /api/stories/:idGET /api/stories/:id/metrics
Database Schema:
- Boards table
- Sprints table
- Stories table
- Story_Tests table (join)
- Story_Repositories table (join)
Events Published:
story.createdstory.updatedsprint.startedsprint.completed
Events Consumed:
test.executed(from Test Management Service)code.committed(from Pipeline Service)
Responsibility: Code traceability, change detection, code-to-test linkage
Modules:
code-tracer.tsrepository-viewer.ts
API Endpoints:
POST /api/code/referencesGET /api/code/references/:idGET /api/code/references/:id/changedGET /api/code/file/:filePath/testsPOST /api/code/link-to-storyGET /api/repositoriesGET /api/repositories/:id/files
Database Schema:
- Code_References table
- File_Hashes table
- Code_Story_Links table
Events Published:
code.changedcode.linked
Events Consumed:
story.created(from Agile Board Service)
Responsibility: CI/CD pipeline integration, git operations, deployment tracking
Modules:
gitops.ts
API Endpoints:
POST /api/pipelinesGET /api/pipelines/:idPOST /api/pipelines/:id/triggerGET /api/pipelines/:id/statusPOST /api/git/commitsGET /api/git/commits/:shaPOST /api/deploymentsGET /api/deployments/:id
Database Schema:
- Pipelines table
- Pipeline_Runs table
- Git_Commits table
- Deployments table
Events Published:
pipeline.startedpipeline.completeddeployment.successdeployment.failedcode.committed
Events Consumed:
test.passed(from Test Management Service)test.failed(from Test Management Service)
Responsibility: Test execution, test registry, defect tracking, issue management
Modules:
test-registry.tstest-executor.tsdefect-manager.tsissue-manager.tslifecycle.ts
API Endpoints:
POST /api/testsGET /api/tests/:idPUT /api/tests/:idDELETE /api/tests/:idPOST /api/tests/:id/executePOST /api/tests/batch-executeGET /api/tests/story/:storyIdPOST /api/defectsGET /api/defects/:idPUT /api/defects/:idGET /api/defects/health-scorePOST /api/issuesGET /api/issues/:idPUT /api/issues/:idPOST /api/issues/:id/commentsGET /api/traceability-matrix
Database Schema:
- Tests table
- Test_Results table
- Test_Story_Links table
- Defects table
- Issues table
- Issue_Comments table
Events Published:
test.createdtest.executedtest.passedtest.faileddefect.createddefect.resolvedissue.createdissue.updated
Events Consumed:
story.created(from Agile Board Service)code.changed(from Code Tracer Service)
Responsibility: Dashboard generation, metrics calculation, report generation
Modules:
dashboard-reporter.tsui.ts(web interface)
API Endpoints:
GET /api/reports/dashboardGET /api/reports/jsonGET /api/reports/traceability-matrixGET /api/metrics/coverageGET /api/metrics/velocityGET /api/metrics/qualityGET /api/metrics/health-scoreGET /api/ui/dashboard(HTML)
Database Schema:
- Metrics_Cache table
- Report_Snapshots table
Events Consumed:
- All events (for metrics calculation)
Responsibility:
- Single entry point for all clients
- Request routing
- Authentication/authorization validation
- Rate limiting
- CORS handling
- Request/response logging
Routes:
/api/users/* → User Admin Service (4001)
/api/teams/* → User Admin Service (4001)
/api/boards/* → Agile Board Service (4002)
/api/sprints/* → Agile Board Service (4002)
/api/stories/* → Agile Board Service (4002)
/api/code/* → Code Tracer Service (4003)
/api/repositories/* → Code Tracer Service (4003)
/api/pipelines/* → Pipeline Service (4004)
/api/git/* → Pipeline Service (4004)
/api/tests/* → Test Management Service (4005)
/api/defects/* → Test Management Service (4005)
/api/issues/* → Test Management Service (4005)
/api/reports/* → Reporting Service (4006)
/api/metrics/* → Reporting Service (4006)
class EventBus {
private subscribers: Map<string, Array<(data: any) => void>> = new Map();
subscribe(event: string, handler: (data: any) => void): void
publish(event: string, data: any): void
}- Fast in-memory messaging
- Persistence optional
- Simple pub/sub model
- Message durability
- Complex routing
- Guaranteed delivery
interface Event {
id: string;
type: string;
timestamp: Date;
source: string;
data: any;
correlationId?: string;
}- Used for: Direct queries, immediate responses
- Example: API Gateway → Service calls
- Used for: Loosely coupled updates, notifications
- Example: Test execution → Defect creation → Story update
- Eventual Consistency: Services update asynchronously via events
- Saga Pattern: For complex multi-service transactions
user-admin-db (PostgreSQL)
agile-board-db (PostgreSQL)
code-tracer-db (PostgreSQL)
pipeline-db (PostgreSQL)
test-mgmt-db (PostgreSQL)
reporting-db (PostgreSQL)
Pros:
- True service independence
- Technology flexibility per service
- Better scalability
Cons:
- Data duplication
- Complex joins require service calls
- Eventual consistency challenges
test-mgmt-platform-db (PostgreSQL)
├── users schema
├── agile schema
├── code schema
├── pipelines schema
├── tests schema
└── reports schema
Pros:
- Easier to implement
- ACID transactions across services
- Simpler queries
Cons:
- Service coupling
- Deployment coordination needed
- Single point of failure
- Core transactional data: Separate databases per service
- Read-only reporting: Shared read replica for reporting service
- Caching layer: Redis for frequently accessed data
version: '3.8'
services:
api-gateway:
build: ./services/api-gateway
ports: ["3000:3000"]
user-admin:
build: ./services/user-admin
ports: ["4001:4001"]
agile-board:
build: ./services/agile-board
ports: ["4002:4002"]
code-tracer:
build: ./services/code-tracer
ports: ["4003:4003"]
pipeline:
build: ./services/pipeline
ports: ["4004:4004"]
test-mgmt:
build: ./services/test-mgmt
ports: ["4005:4005"]
reporting:
build: ./services/reporting
ports: ["4006:4006"]
postgres:
image: postgres:15
ports: ["5432:5432"]
redis:
image: redis:7
ports: ["6379:6379"]apiVersion: v1
kind: Service
metadata:
name: user-admin-service
spec:
selector:
app: user-admin
ports:
- port: 4001
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: user-admin
spec:
replicas: 3
template:
spec:
containers:
- name: user-admin
image: testmgr/user-admin:latest
ports:
- containerPort: 4001- Create separate folders for each service
- Extract modules into services
- Create basic Express servers
- Implement REST APIs
- Create gateway with routing
- Add authentication middleware
- Implement rate limiting
- Add logging
- Implement event bus (start with in-memory)
- Add event publishers
- Add event subscribers
- Test async communication
- Create separate database schemas
- Migrate data
- Update service DAOs
- Test data integrity
- Create Dockerfiles for each service
- Create docker-compose.yml
- Test local deployment
- Document deployment process
- Create Kubernetes manifests
- Set up CI/CD pipelines
- Deploy to staging
- Deploy to production
- Deploy agile board changes without affecting test execution
- Rollback individual services on issues
- Faster release cycles
- Use different databases per service
- Upgrade Node.js version per service
- Experiment with new technologies
- Scale reporting service independently during heavy dashboard usage
- Scale test execution service during batch runs
- Optimize resource allocation
- Different teams own different services
- Parallel development
- Clear boundaries and contracts
- Pipeline service down doesn't affect test execution
- Reporting service issues don't block agile board
- Better resilience
- Challenge: More moving parts
- Mitigation:
- Good documentation
- Service mesh (Istio) for observability
- Centralized logging (ELK stack)
- Challenge: Inter-service calls add latency
- Mitigation:
- Cache frequently accessed data
- Use async messaging where possible
- Optimize API payloads
- Challenge: Eventual consistency issues
- Mitigation:
- Implement saga pattern
- Add retry mechanisms
- Design for idempotency
- Challenge: End-to-end testing harder
- Mitigation:
- Contract testing (Pact)
- Service virtualization
- Comprehensive integration tests
Each service will define its contract using OpenAPI 3.0 specification. Example:
openapi: 3.0.0
info:
title: Agile Board Service API
version: 1.0.0
paths:
/api/boards:
get:
summary: Get all boards
responses:
'200':
description: List of boards
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Board'- Centralized: All services log to ELK stack
- Format: JSON with correlation IDs
- Levels: ERROR, WARN, INFO, DEBUG
- Tool: Prometheus + Grafana
- Metrics:
- Request rate
- Error rate
- Latency (p50, p95, p99)
- Service health
- Tool: Jaeger or Zipkin
- Distributed tracing: Track requests across services
- Correlation IDs: Link all service calls for a request
- JWT tokens issued by User Admin Service
- API Gateway validates tokens
- Services trust gateway-validated requests
- Role-based access control (RBAC)
- Service-level permissions
- Resource-level permissions
- Services communicate on private network
- Only API Gateway exposed publicly
- TLS for all communications
- Encrypt sensitive data at rest
- Secure credential management (Vault/AWS Secrets Manager)
- Audit logging for sensitive operations
- Docker Compose on single machine
- In-memory event bus
- SQLite or JSON files
- 1-2 instances per service
- Shared PostgreSQL
- Redis for events
- 3+ instances per service (HA)
- Managed database services
- Managed Redis/RabbitMQ
- Load balancers
Estimated Costs:
- Development: $0 (local)
- Staging: $50-100/month (AWS/Azure)
- Production: $500-1000/month (depending on scale)
- Review this architecture with team
- Choose database strategy (per-service vs shared)
- Choose event bus (in-memory → Redis → RabbitMQ)
- Create service directory structure
- Implement Phase 1: Extract Services
- Set up CI/CD for microservices
- Create deployment documentation