Skip to content

Conversation

@orbitstabilizer
Copy link
Contributor

@orbitstabilizer orbitstabilizer commented Nov 23, 2025

Close #658

  1. Changed mobile config to use environment variable for backend url:
export const API_CONFIG = {
  BASE_URL: Constants.expoConfig?.extra?.apiBaseUrl || 'https://nutrihub.fit/api',
  TIMEOUT: 10000,
};

Default target ishttps://nutrihub.fit/api and EXPO_PUBLIC_API_BASE_URL environment variable can override that variable.
The previous local built should not be affected by this change, please verify this on your end.

  1. I added expo web to mobile to test if the dockerized build works.
  2. To start the dockerized app, run docker-compose up --build from ./mobile/ directory. The compose file creates a separate instance of backend/db together with mobile app that exposes port 8081 for expo web.
    Note:
  • We don't actually need a separate backend instantiation, having a single docker-compose to start the backend/db is enough. But, then EXPO_PUBLIC_API_BASE_URL should be set to http://10.0.2.2:8080/api or whichever port it runs on your current machine. (the original docker-compose doesn't expose backend, so one need to add `ports: "8080:9000" for it to work.

- expo web is accessible from localhost
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I understand the functionality correctly?
If the mobile developers don't run the container before running the mobile app, BARE_URL will nutrihub.fit as it has been.
If the docker container is run, then BASE_URL will direct to the container.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, url routing is needed for the mobile to discover backend. You can test if the mobile still connects prod backend with current config. The default backend address is nurihub.fit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the PR description.

Copy link
Contributor

@onurkck928 onurkck928 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried running the app locally and encountered an error caused by mismatched React versions (react: 19.2.0 vs react-native-renderer: 19.1.0), which prevents the app from starting error1

Since react-native-renderer is tied to the Expo SDK, upgrading it directly via package.json isn’t feasible without also upgrading the Expo SDK.

Given that, I suggest we revert the changes to package.json and package-lock.json unless they are strictly required, to avoid breaking the current Expo setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dockerized build for mobile

4 participants