Back-end And Front-end React App

I have a React app that in the main directory there’s the back-end configured (APIs) and the main directory contains a directory that’s the front-end.
On Heroku I can run both in the same time, but I don’t see how to do it on Cloudflare Pages because I can only build the front-end app and if I run only the back-end app, it doesn’t get published but it runs.
Any suggestions?
I believe ‘functions’ would be an alternative, but this means to rewrite the entire back-end.