Is there any way we can create the apps as a server and client in the same time ? such as wrapper?

I want to create p2p app which only involve the ionic as the server as well as client. So for example, the is code within ionic. not outside the ionic eg. code in nodejs. the target is to create serverless p2p app within ionic.