Before modernizing a legacy application, I would start with a dependency and impact assessment rather than immediately choosing between rebuilding and refactoring.
First, map the integrations: identify external APIs, payment gateways, authentication services, scheduled jobs and other systems that exchange data with the application. These dependencies can reveal hidden business-critical workflows.
Next, examine the database schema, data quality and relationships between tables. Then review the code to identify business rules, especially those that are not documented but still affect daily operations.
I would also check:
User workflows: Which features are essential to daily operations?
Logs and monitoring: Where do errors, performance issues and recurring failures occur?
Security: Are authentication, permissions and sensitive data properly protected?
Testing: Are there existing automated tests, or will critical workflows need baseline tests?
One practical step is to create a system dependency map and document the most important workflows before changing anything. This provides a clear picture of what could break, helps prioritise risks and makes it easier to decide what should be refactored, replaced or retained.
The biggest mistake is modernizing code without first understanding how the application actually supports the business.