It doesn't really matter, you can build your backend with whatever it is you feel comfortable with, you just need to make sure to build an API REST.
Ionic is going to connect to your API to interact with your database.
If you want to try a chat app you could take a look at http://firebase.com it is a Backend as a Service with real time data push, really easy to build a chat with that one.