Monolithic software encapsulates all functional ca- pabilities into a single deployable unit. But man- aging it becomes harder as the demand for new functionalities grow. Microservice architecture is seen as alternate as it advocates building an applica- tion through a set of loosely coupled small services wherein each service owns a single functional re- sponsibility. But the challenges associated with the separation of functional modules, slows down the migration of a monolithic code into microservices. In this work, we propose a representation learning based solution to tackle this problem. We use a het- erogeneous graph to jointly represent software arti- facts (like programs and resources) and the differ- ent relationships they share (function calls, inher- itance, etc.), and perform a constraint-based clus- tering through a novel heterogeneous graph neural network. Experimental studies show that our ap- proach is effective on monoliths of different types.