How to auto-start strapi service when I run the app that uses it?

[details=“System Information”]

  • Strapi version: v3.3.4
  • OS: OS X Big Sur
  • *database: None
  • Node version: v10.16.3
  • NPM Version: 6.14.10
  • Yarn Version: 1.19.1

Hi there, I have an issue while using strapi.

Let me give you more details.

I’ve made an app on Nuxt and use Strapi as a CMS to get and post data hosted in it.
Locally, here’s my structure folder

project

—my-project (contains the strapi part)

—project (contains the Nuxt app)

I have to start both Strapi server and the app with yarn start and npm serve to run it locally.

As a nuxt project it is renderd server side (SSR) and hosted online via a heroku Dyno.

First Issue

-There is no hydration and therefore no data content in the html structure when navigating on a smartphone (any browser).

Second issue

-I have to manualy start the strapi server part anyway from the terminal and that sucks. I would like this command to be executed as soon as the request from the browser is send to the heroku Node.js server that generate the html back to the browser.

Hope I made myself clear,

Cheers,

Sylvain


Heroku, much like containers (docker) expect that each application have it’s own service. Heroku suggests using multiple dynos for this and you can use the same git repo.

I would suggest adopting this method as the goal of a “headless cms” is to operate independent of the frontend (headless) and run as it’s own service.

Hello, thanks you for your kind reply.
It makes sens. I’l try this solution asap.
Have a good day