This system has the following tech stack:
- Laravel as frontend (web)
- React Native as frontend (mobile)
- Laravel as backend
React and React Native interface with Laravel through APIs. The endpoints are to be specified.
Important: Client and Server have the best chance of working if they have the same domain.
If the server is hosted, i.e. php artisan serve --host 0.0.0.0
, then the client must be served with the same IP address as well.
As such, the entries SESSION_DOMAIN
and SANCTUM_STATEFUL_DOMAINS
in server/.env
must point to the IP address or domain name of the client.
- Copy and edit the
.env.example
file to.env
- Check and update dependencies by running
composer update
composer install
php artisan key:generate
- Make sure to have a mysql connection. If you are using a virtualhost, run a mysql server
php artisan migrate
npm run dev
ornpm run build
php artisan serve
- The database name is "comelec_database"
php artisan serve --host 0.0.0.0
On Linux, other ports may not be able to be forwarded, so try this instead
sudo php artisan serve --host 0.0.0.0 --port=80
The mobile portion of this application is handled with Expo.
Source files are located in the app/
folder. Expo Router is a file-based routing system, so its structure must be followed.
- Download the Expo app on your phone
- Run
npm i -D
- Host the server first. When the server is hosted, copy and paste the URL to the
extra/API_URL
entry in themobile/app.json
file. - Run
npm run start
ornpm run android
to develop- Note: You may want to connect your android device first. Try with the QR Code, IP address, or directly connecting through USB and doing
npm run android
.
- Note: You may want to connect your android device first. Try with the QR Code, IP address, or directly connecting through USB and doing
cd
tomobile/
eas build --profile preview --platform android
- Remove
mobile/package-lock.json
Try connecting through tunnel instead of LAN. Note: It may be slower to connect, so it is not recommended to use. See this StackOverflow question
npm i @expo/ngrok
- Install ngrok for your system. Good luck.
ngrok http 3000
(Run this in another terminal window)npx expo start --tunnel