Skip to content

eco-repositories/eco-monorepo

Repository files navigation

Hardcoded values to update after forking the template

path to file path to text current text
/package.json $.name "eco-monorepo"
/package.json $.author "Dmytro Parzhytskyi <[email protected]>"
/package.json $.repository "https://github.com/eco-repositories/eco-monorepo"
/package-lock.json $.name "eco-monorepo"
/package-lock.json $.packages[""].name "eco-monorepo"
/packages/client/index.html html>head>title "Client App"

Starting the application stack

Using Docker (recommended)

Starting the application stack with npm start is the simplest approach and also recommended.

  • Set environment variables and build arguments in /docker-compose.env.local

    Read /docker-compose.yaml for the variables it uses. Also, normally, Docker produces a warning message for variables that are not set.

  • Run application stack:

    npm start
  • Observe the apps:

    • server on http://localhost:<SERVER_PORT_HOST> (try GET /v1/health)

    • client on http://localhost:<CLIENT_PORT_HOST>

  • (optionally) Stop the application stack:

    npm stop

Without Docker, all on localhost

To start the application stack without Docker, it is necessary to setup/build/start the applications manually on localhost, then run server in the background, then run client in "dev" mode.

  • Install all dependencies:

    npm ci
  • Build shared package (it has to be built first because the other packages depend on it):

    npm run -w shared build
  • Set server port as PORT environment variable in /packages/server/.env.local:

    echo PORT='<SERVER_PORT>' >> ./packages/server/.env.local
  • Build server:

    npm run -w server build
  • Start server:

    npm run -w server start
  • Share server location with the client through /packages/client/.env.local:

    echo VITE_SERVER_BASE_URL='http://localhost:<SERVER_PORT>' >> ./packages/client/.env.local
  • Start client (in dev mode):

    npm run -w client dev
  • Observe the apps:

    • server on http://localhost:<SERVER_PORT>

    • client on http://localhost:<CLIENT_PORT> (usually it is http://localhost:5173/)

  • (optionally) Stop the application stack:

    • Stop the client (press Q in the client terminal)

    • Stop the server (press Ctrl+C in the server terminal)