Stage 1: Problem
Problem
You are building a configuration management system. Users create complex config templates with deeply nested objects ā database settings, cache settings, feature flags, each with sub-objects for different environments. When a user wants to create a new environment config, they pick an existing one as a base and tweak a few fields.
Your code currently creates new configs from scratch every time, requiring the user to fill in 40+ fields. When they want to "clone staging to create pre-prod," they have to manually copy each value.
Your challenge: How would you let users duplicate a complex, deeply nested config object so that changes to the copy never affect the original?
Write your approach before continuing.