The paper presents an approach to designing a digital twin as a core of the domain-aware digital platform. Methodological aspects of digital transformation and platform design are discussed. The model-based digital twin architecture and development process are elaborated. To formalize and automate this process, we propose to apply novel mathematical methods based on category theory, such as a flexible multicomma construction. The generic distribution of the digital twin models across components of the platform and applications is presented. We illustrate our approach with examples from the electric power energy sector, where energy management platforms emerge while the power system digital twin technology is gradually overcoming the difficulties associated with design and deployment.