How to deploy separate client and server repos on Heroku with same domain

I’m working on a project called gameportal that has two different repos - one handles the client side and another manages the server side.

I want to deploy both using Heroku but I’m not sure about the best approach. My goal is to have them both running under one domain if that’s possible. I also need pipeline setups for each part with development and live versions.

Can I make both applications work on the same domain where my client can make requests to the server using /api/* endpoints? I thought about putting the server on api.gameportal.com and client on www.gameportal.com but that might create CORS issues.

What’s the recommended way to handle this setup? My client side is just static HTML/CSS/JS files so maybe I could use something like S3 instead, but I still need the development/production workflow with automated testing.

Any suggestions would be really helpful!

yea, heroku can be a bit tricky with this stuff. i think using a proxy is smart—let the server serve your client files and keep the api at the same domain. it’ll save u from subdomain and cors issues for sure.

I just dealt with this same setup. Configure your server to serve static files from the client build - works great on Heroku. Set up API routes at /api/* and serve client files for everything else. No CORS headaches since it’s all one domain. For deployment, use GitHub Actions to build the client, copy those files to your server repo, then deploy to Heroku. I run separate dev and production Heroku apps with auto-deploys from different branches. Gives you a solid pipeline while keeping everything under one domain.

Wait, which approach works better for your team? Are you flying solo or working with other devs? What’s your current deployment setup like - got CI/CD running for either repo? That’ll probably decide whether you should go with the single-domain proxy or keep your gameportal repos separate.