Separate frontend and backend with Heroku
<p>I have an application, let's call it derpshow, that consists of two repositories, one for the frontend and one for the backend. </p>

<p>I would like to deploy these using Heroku, and preferably on the same domain. I would also like to use pipelines for both parts separate, with a staging and production environment for each.</p>

<p>Is it possible to get both apps running on the same domain, so that the frontend can call the backend on <code>/api/*</code>? Another option would be to serve the backend on <code>api.derpshow.com</code> and the frontend on <code>app.derpshow.com</code> but that complicates security somewhat.</p>

<p>What are the best practices for this? The frontend is simply static files, so it could even be served from S3 or similar, but I still need the staging and production environments and automatic testing and so and so forth.</p>

<p>Any advice is greatly appreciated!</p>