web hosting – Create a scalable heroku project

I am starting a project and I have been working with Heroku for some time with small projects / tests.

I have to create a project that will run a Django Python backend (with Django Rest Framework as an API) and a nodeJs interface (I'm not a frontend developer, another person will take care of this part of the development).

I was wondering how to make it scalable and how to optimize our workflow.

For now, we are developing separate Heroku apps (with free dynos), so one for the frontend and one for the backend.

We have a workflow as follows:

  • backend-dev
  • frontend-dev
  • backend-staging
  • staging frontend
  • back-production
  • frontend production

which makes a total of six heroku apps (I feel we do not do it well, there is surely a better way but I do not know which one)

We have a domain name and we would like to access the website like that

  • dev.domain.com (dev)
  • test.domain.com (staged)
  • domain.com (production)

Should I create subdomains for the API? As below? Or is there a better way to work?

  • dev.api.domain.com (dev)
  • test.api.domain.com (staged)
  • api.domain.com (production)

Would it be possible (on Heroku) to run the backend and the frontend in the same application with separate Dynos?

Thank you for your precious help and your time.