# From Monolithic ERP to Microservices Using Agent Mode

Source: https://www.youtube.com/watch?v=Ht8qzmGYKjI
Recap page: https://rapidrecap.app/video/Ht8qzmGYKjI
Generated: 2025-12-31T14:03:31.727+00:00

---
## Quick Overview

The demonstration successfully refactors a monolithic Enterprise Resource Planning (ERP) application into a microservices architecture using Postman's Agent Mode, which analyzes the codebase, generates comprehensive documentation including cross-module dependencies and a refactoring strategy, and then creates fully documented Postman collections with mock servers for each proposed microservice.

**Key Points:**
- The demonstration starts with an ERP Monolith application featuring eight interconnected modules (HR, Payroll, Accounting, Finance, Billing, Procurement, Supply Chain, Inventory) sharing a single codebase, database, and runtime.
- Agent Mode analyzes the codebase structure, identifying current application stack (Node.js/TypeScript, Express.js, PostgreSQL) and detailing cross-module dependencies via direct service calls, such as Payroll depending on HR and Accounting.
- A phased refactoring strategy is proposed, prioritizing decoupling core services like Accounting and Employee services first, followed by transaction-heavy services, and finally supporting services.
- Key refactoring patterns involve replacing direct calls with REST APIs and implementing event-driven communication via an Event Bus to decouple services.
- After analyzing the code, Agent Mode generates detailed documentation files (e.g., MICROSERVICES_ARCHITECTURE.md, EVENT_SCHEMAS.md) and proposes an architecture split into 8 independent microservices with specific ports.
- The user prompts Agent Mode to create Postman collections for all 8 microservices, which results in the creation of 8 mock servers and environment variables configured with the mock server URLs.
- The final outcome shows fully documented Postman collections for services like Finance Service API and Billing Service API, ready for contract testing and implementation planning.

![Screenshot at 00:00: The initial dashboard of the ERP Monolith system displays eight interconnected modules \(Human Resources, Payroll, Accounting, Finance, Billing, Procurement, Supply Chain, Inventory\) running as a single unit, highlighting the tightly coupled nature of the monolithic architecture.](https://ss.rapidrecap.app/screens/Ht8qzmGYKjI/00-00-00.jpg)

**Context:** The video presents a tutorial demonstrating how to use Postman's Agent Mode to facilitate the complex process of migrating a large, monolithic Enterprise Resource Planning (ERP) system into a modern microservices architecture. The initial monolithic application is shown to have tight coupling between its eight business modules, which poses scaling and maintenance challenges that microservices aim to solve.

## Detailed Analysis

The presenter begins by showing the dashboard of an existing ERP Monolith application, which consists of eight integrated modules (HR, Payroll, Accounting, Finance, Billing, Procurement, Supply Chain, Inventory) sharing a single codebase, database, and runtime stack (Node.js/TypeScript, Express.js, PostgreSQL). The presenter highlights the tight coupling between modules, exemplified by Payroll depending on HR for employee data and Accounting for journal entries. The goal is to refactor this monolith into independent microservices using Postman Agent Mode. Upon connecting Agent Mode to the local codebase, the tool analyzes the directory structure and generates comprehensive documentation, including API contracts, database strategy, event schemas, and a visual architecture diagram for the proposed microservices setup. The analysis also outlines a structured, three-phase refactoring strategy: Phase 1 focuses on decoupling core services (Accounting and Employee), Phase 2 handles transaction-heavy services (Billing, Procurement, Payroll), and Phase 3 addresses supporting services (Inventory, Supply Chain, Finance). Key refactoring patterns include replacing direct calls with REST APIs and using event-driven communication. Following the analysis, Agent Mode successfully creates Postman collections for all eight proposed microservices, complete with API documentation, examples, and mock servers configured with environment variables pointing to the mock server URLs, ready for contract testing and further development.

### Monolith Overview

- ERP Monolith dashboard showing 8 modules (HR, Payroll, Accounting, Finance, Billing, Procurement, Supply Chain, Inventory)
- System Status healthy
- Architecture Monolithic
- Total Modules 8

### Codebase Structure Analysis

- Directory structure shows separate frontend and backend folders, with backend modules organized under src/modules/ (accounting, billing, finance, human-resources, inventory, payroll, procurement, supply-chain)
- Documentation files like MICROSERVICES_ARCHITECTURE.md and EVENT_SCHEMAS.md generated

### Refactoring Strategy

- Phase 1 (Decouple Core Services) extracts Accounting Service first, then Employee Service
- Phase 2 extracts Transaction-Heavy Services (Billing, Procurement, Payroll)
- Phase 3 extracts Supporting Services (Inventory, Supply Chain, Finance)

### Key Refactoring Patterns

- Replace Direct Calls with REST APIs (showing before/after code snippets)
- Implement Event-Driven Communication (publishing events like 'PayrollProcessed' instead of direct calls)

### Postman Collection Creation

- Prompted Agent Mode to create Postman collections for all 8 microservices with API documentation
- Agent Mode successfully created 8 mock servers and updated environment variables with mock server URLs

### Final State

- Postman collections are visible in the sidebar for all 8 services (e.g., Finance Service API, Billing Service API), populated with endpoints, examples, and utilizing the mock server URLs via environment variables

![Screenshot at 00:07: Dashboard view of the ERP Monolith showing the eight core modules integrated into a single application unit.](https://ss.rapidrecap.app/screens/Ht8qzmGYKjI/00-00-07.jpg)
![Screenshot at 00:14: Detailed view of the Payroll module dashboard, showing cross-module dependencies on HR and Accounting services.](https://ss.rapidrecap.app/screens/Ht8qzmGYKjI/00-00-14.jpg)
![Screenshot at 01:06: Postman setup screen showing the workspace connected successfully to the local file system, indicating Agent Mode has read the code.](https://ss.rapidrecap.app/screens/Ht8qzmGYKjI/00-01-06.jpg)
![Screenshot at 01:38: The generated documentation summary showing the Current Application Structure \(Tech Stack\) and the Project Structure of the monolith.](https://ss.rapidrecap.app/screens/Ht8qzmGYKjI/00-01-38.jpg)
![Screenshot at 03:54: Postman interface showing the Finance Service API collection opened, with environment variables updated to point to the generated mock servers.](https://ss.rapidrecap.app/screens/Ht8qzmGYKjI/00-03-54.jpg)
