Rails needs more opinionated decision on frontend story. Just pick ReactJS instead ? Not a bad idea. Or VueJS ? Neither a bad choice. It's the main reason i don't choose Rails over a universal Node.js stack for the HTML rendering part.
If you want it right from the start, you can create an api only rails project: https://guides.rubyonrails.org/api_app.html