Help › Mobile app › Development setup
Mobile app: development setup (Android & iOS)
Everything needed to work on the SiteCash app: prepare a PC, run the SiteCash server locally, open the app on an Android phone and an iPhone, test notifications, and the commands you use every day. Every command is explained.
The big picture
While you develop, two programs run on your PC and the app runs on your phone:
| Program | Started with | Port | What it does |
|---|---|---|---|
| SiteCash server (Next.js) | npm run dev in the main folder | 3000 | The website and the app's API (/api/mobile/v1), with a local database in .data/. |
| Expo dev server (Metro) | npx expo start in mobile/ | 8081 | Sends the app's code to the phone and reloads it the moment you save a file. |
| The app on your phone | Expo Go, or your own development build | — | Loads its code from Metro and talks to the server over Wi-Fi. |
There are two ways to open the app on a phone:
| Expo Go | Development build | |
|---|---|---|
| What it is | A free app from the store that can open any Expo project | Your own SiteCash app with developer tools, built once in Expo's cloud |
| Setup time | Minutes | About 30–60 minutes the first time |
| Accounts needed | None | Expo (free); iPhone: Apple Developer ($99/year) |
| Push notifications | No | Yes |
| Best for | Screens, forms, most daily work | Notifications, and checking the app exactly as it will ship |
Both load your latest code from your PC, so code changes never need a new build. You only rebuild a development build when native parts change (see when).
What you need
- PC: Windows 10/11 (this guide uses PowerShell) or a Mac. No Android Studio, Java or Xcode is needed — builds run in Expo's cloud.
- Phones: Android 7.0 or newer; iPhone with iOS 15.1 or newer. On the same Wi-Fi as the PC.
- Access to the SiteCash GitHub repository.
- Accounts (only for development builds): Expo (free) at expo.dev; for iPhones, the Apple Developer Program ($99 a year) at developer.apple.com.
1. Install the tools
- Node.js (version 20 or newer, LTS recommended) from nodejs.org. It includes
npm. - Git from git-scm.com.
- Check both in a new PowerShell window:
node -v # shows e.g. v24.16.0 npm -v git --version - EAS CLI, Expo's command-line tool for builds (needed from step 6):
npm install -g eas-cli eas --version-ginstalls it for the whole PC, so theeascommand works in any folder. - Optional: VS Code from code.visualstudio.com.
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned, then open a new window.2. Get the code
cd C:\Projects
git clone https://github.com/miteshec11/sitecash.git PettyCash-RealEstate
cd PettyCash-RealEstate
npm install # packages for the SiteCash server/website
cd mobile
npm install # packages for the mobile app (it has its own package.json)
cd ..
If you already have the folder, just get the latest code with git pull, then run npm install in both places again (it only adds what changed).
mobile/, add new packages with npx expo install <package>, not npm install <package>. Expo then picks the version that matches the app's Expo SDK (57).3. Run the SiteCash server
- Settings file. Copy the example and open it:
SetCopy-Item .env.example .env.local notepad .env.localSESSION_SECRETto a random value of at least 32 characters (make one with the command below). LeaveDATABASE_URLempty: the server then uses a built-in development database in.data/pglite, so no Postgres is needed.node -e "console.log(require('crypto').randomBytes(32).toString('base64url'))" - Database. Create the tables and a made-up sample company with users, sites, entries and bill photos:
Logins (passwordnpm run db:migrate npx tsx scripts/seed-sample.tssample1234):kiran@sunrise.example(site user),neha@sunrise.example(accountant),ravi@sunrise.example(owner). If your database already has users, skip this step and use those logins. - Start the server and leave this window open:
You should seenpm run devReady. Open http://localhost:3000 on the PC and log in once to check.
192.168.56.1). The server still answers on every network card, including your Wi-Fi.4. Connect phone and PC
- Put the phone on the same Wi-Fi as the PC (not mobile data, not a guest Wi-Fi).
- Find the PC's Wi-Fi address:
Look under Wireless LAN adapter Wi-Fi → IPv4 Address, for exampleipconfig192.168.1.11. Ignore adapters named VirtualBox/Ethernet 2 (192.168.56.x) or vEthernet (172.x.x.x) — the phone cannot reach those. - Test from the phone: open
http://192.168.1.11:3000in the phone's browser (use your address). The SiteCash page must appear. If it does not, see Troubleshooting (usually Windows Firewall).
Get-NetConnectionProfile (Private or Public). Home Wi-Fi is best set to Private: Settings → Network & internet → Wi-Fi → your network → Private.5. Run the app in Expo Go (Android & iPhone)
- Install Expo Go on the phone: Play Store (Android) or App Store (iPhone). Keep it updated — it must support Expo SDK 57.
- Tell the app where the server is. Create
mobile/.env.local(it is not committed to Git) with your Wi-Fi address:EXPO_PUBLIC_API_URL=http://192.168.1.11:3000 REACT_NATIVE_PACKAGER_HOSTNAME=192.168.1.11EXPO_PUBLIC_API_URLis the SiteCash server the app calls.REACT_NATIVE_PACKAGER_HOSTNAMEmakes the QR code use your Wi-Fi address instead of a virtual adapter. When you start Expo you will seeenv: load .env.local. - In a second PowerShell window, start Expo:
A QR code appears. Because the project includes development-build support, it starts in development build mode. For Expo Go, press s once — the text changes to Using Expo Go.cd C:\Projects\PettyCash-RealEstate\mobile npx expo start - Open it on the phone:
- Android: open Expo Go → Scan QR code.
- iPhone: open the Camera app, point at the QR code, tap the banner. When iOS asks to find devices on your local network, tap Allow.
- Log in with a user from step 3. If the app cannot reach the server, tap Server on the login screen and check the address.
Keys in the Expo window: r reload the app · m open the developer menu on the phone · s switch Expo Go / development build · w open in a web browser · ? all keys · Ctrl+C stop.
npx expo start (they last only for that window):
$env:EXPO_PUBLIC_API_URL = "http://192.168.1.11:3000"
$env:REACT_NATIVE_PACKAGER_HOSTNAME = "192.168.1.11"
On a Mac: export EXPO_PUBLIC_API_URL=http://192.168.1.11:3000. After changing the server address, restart with npx expo start --clear.6. Expo account (one time)
Needed for development builds, store builds and push notifications. The SiteCash app is already linked to the Expo project @dbarmai/sitecash (the id is in mobile/app.json).
cd C:\Projects\PettyCash-RealEstate\mobile
eas login # opens the browser to sign in; the terminal waits until you finish
eas whoami # shows the account you are signed in with
- Other developers need to be members of the Expo account or organization that owns the project (expo.dev → account → Members) to build it.
- Only for a new Expo project (not needed for SiteCash now):
eas initcreates it and writes its id intoapp.json.
7. Android development build
7a. Push notification key (one time)
Android notifications go through Google Firebase. The project already has mobile/google-services.json (Firebase project sitecash-pettycash) and app.json points to it. Expo also needs Firebase's private key:
- Firebase console → ⚙ Project settings → Service accounts → Generate new private key. Save the file outside the project folder (for example
Documents\sitecash-keys\). It is secret — never commit it. - Upload it to Expo:
Choose: Android → build profile development → Google Service Account → Manage your Google Service Account Key for Push Notifications (FCM V1) → Set up a Google Service Account Key for Push Notifications (FCM V1) → Upload a Google Service Account Key → type the file path (tip: Shift + right-click the file → Copy as path, then remove the quotes). Then Go back → Exit. The key belongs to the app, so it works for all build types.eas credentials
7b. Build and install
eas build -p android --profile development
-p android: platform.--profile development: the settings named "development" inmobile/eas.json(a debug app with developer tools, as an installable APK).- The first time it asks Generate a new Android Keystore? — answer yes. This is the app's signing key; Expo stores it safely.
- The build runs in Expo's cloud (about 10–30 minutes; the free plan can queue). The terminal shows a link to follow it on expo.dev, and you get an email when it finishes.
- Open the build link (or scan its QR code) on the Android phone and download the APK.
- Open the downloaded file to install. Allow "install unknown apps" for your browser or Files app when Android asks.
- Start Expo on the PC as in step 5, but don't press s — it should say Using development build.
- Open the new SiteCash app on the phone. It shows your PC's Expo server in a list (or scan the QR code from inside it) and loads your code.
8. iPhone development build
Apple only allows your own app builds on iPhones registered in your Apple Developer account. You need the paid Apple Developer Program ($99/year; approval usually takes 1–2 days — a company account needs a D-U-N-S number first).
- Register each iPhone (once per phone, up to 100 phones a year):
Choose Website and open the link it shows on the iPhone (in Safari). Install the profile it downloads: Settings → General → VPN & Device Management → install.eas device:create - Build:
It asks you to sign in with your Apple ID (and the 2-factor code). Answer yes when it offers to create or reuse: the distribution certificate, the provisioning profile (it includes the phones you registered), and the Apple Push Notifications service key — that key makes iPhone notifications work. If you add another iPhone later, runeas build -p ios --profile developmenteas device:createagain and rebuild. - Install: open the build link on the registered iPhone and tap Install.
- Developer Mode (iOS 16 and newer, once): Settings → Privacy & Security → Developer Mode → on → restart → confirm.
- Run: start Expo on the PC (development build mode, as for Android) and open the SiteCash app on the iPhone. Allow the local-network question.
com.sitecash.app (ios.bundleIdentifier in mobile/app.json). If the build says the identifier is not available, it is taken by another Apple account: change it to your own, e.g. com.achyutamtechnologies.sitecash, and build again. The Android package can stay.9. Test push notifications
Notifications only work in a development build (or later store builds), not in Expo Go.
- In the main folder's
.env.localadd the line below and restartnpm run dev. (In development the server otherwise only writes notifications to.data/outbox.)PUSH_MODE=expo - On the phone (development build), log in as an approver (owner, admin or accountant), e.g.
neha@sunrise.example, and tap Allow when asked about notifications. - On the PC browser, log in as a site user, e.g.
kiran@sunrise.example, and create a cash request. - The phone shows "… requested ₹…". Tapping it opens that request in the app. On the website's Alerts page the alert shows an App delivery chip.
How it works: after login the app asks for permission, gets an Expo push token and registers it with the server (POST /api/mobile/v1/devices/push). The server sends every alert for that user to their logged-in phones through Expo's push service, which passes it to Google (Android) or Apple (iPhone).
10. Everyday workflow
- Window 1:
npm run dev(main folder). Window 2:npx expo start(mobile/). - Open the app on the phone. Edit files in
mobile/appormobile/src; saving updates the phone at once (Fast Refresh). Press r to reload fully. - Before committing, run the checks in
mobile/:npm run typecheck # TypeScript errors npx expo-doctor # Expo SDK and package health (should say all checks passed) npx expo export --platform web # the app bundles without errors; then delete the dist folder - Commit and push as usual (
git add,git commit,git push).
When do I need a new development build?
Only when native parts change: you added a package with native code (npx expo install … of an expo-* or react-native-* package), changed app.json (permissions, plugins, icon, app id), or upgraded the Expo SDK. Screens, logic and styles never need a rebuild. Expo warns you when the installed build does not match the code.
Changing the server (API) too?
The app's API is in src/app/api/mobile/v1/[...path]/route.ts, with the contract in docs/mobile-api.md. Business rules live in src/lib/services/ and are shared with the website. After changing them, run npx tsc --noEmit in the main folder.
Command reference
| Command | Run in | What it does |
|---|---|---|
npm run dev | main folder | Starts the SiteCash server on port 3000 (applies database updates on start). |
npm run db:migrate | main folder | Creates/updates database tables. |
npx tsx scripts/seed-sample.ts | main folder | Adds the made-up sample company (only into an empty database). |
npx expo start | mobile/ | Starts the Expo dev server and shows the QR code. |
npx expo start --clear | mobile/ | Same, after clearing Expo's cache — use after changing .env.local or when changes do not show. |
npx expo start --port 8082 | mobile/ | Use another port if 8081 is busy. |
npx expo start --web | mobile/ | Opens the app in a PC browser (quick checks; camera becomes a file picker). |
npx expo install <package> | mobile/ | Adds a package in the version that matches Expo SDK 57. |
npx expo install --check | mobile/ | Lists packages whose version does not match the SDK (--fix corrects them). |
npm run typecheck | mobile/ | TypeScript check of the app. |
npx expo-doctor | mobile/ | Checks the project for common Expo problems. |
eas login / eas whoami | anywhere | Sign in to Expo / show who is signed in. |
eas credentials | mobile/ | View and upload signing keys and push keys. |
eas device:create | mobile/ | Register an iPhone for test builds. |
eas build -p android --profile development | mobile/ | Android development build (APK). |
eas build -p ios --profile development | mobile/ | iPhone development build (registered phones). |
eas build -p android --profile preview | mobile/ | Installable test APK without developer tools, for testers (needs an https server — see the release guide). |
eas build:list | mobile/ | Your recent builds with their links. |
Where the code is
| Path | Contents |
|---|---|
mobile/app/ | Screens (Expo Router: the file name is the screen's address): login, (tabs)/ Home · Sites · Requests · Approvals · More, sites/[siteId] cash book and new entry, entries/[entryId] voucher and edit, requests/, alerts, outbox/ (waiting to upload). |
mobile/src/api/ | API client and types (matches docs/mobile-api.md). |
mobile/src/auth/session.tsx | Login, secure token storage, switching company, logout. |
mobile/src/lib/ | Offline queue (outbox*.ts), push (push.tsx), network status, formatting (₹1,25,000.00, dd-MMM-yy), storage. |
mobile/src/components/ | Entry form, photo picker, pickers, cards, UI kit. |
mobile/app.json | App name, ids, icons, permissions texts, plugins, Expo project id. |
mobile/eas.json | Build types: development, preview, production. |
mobile/google-services.json | Firebase settings for Android notifications (not secret). |
Troubleshooting
| Problem | Why | Fix |
|---|---|---|
The phone's browser cannot open http://<PC address>:3000 | Different Wi-Fi, wrong address, or the firewall blocks Node.js | Same Wi-Fi; use the Wi-Fi IPv4 from ipconfig; Windows Security → Firewall → Allow an app → tick Node.js for Private and Public; or set the Wi-Fi to Private. |
QR code shows 192.168.56.x or 172.x | Expo picked a virtual network adapter | Set REACT_NATIVE_PACKAGER_HOSTNAME to the Wi-Fi address (step 5) and restart Expo. |
| App loads but login says it cannot reach the server | EXPO_PUBLIC_API_URL wrong or server not running | Check Window 1 runs npm run dev; fix the address in mobile/.env.local, then npx expo start --clear; or use Server on the login screen. |
| Scanning opens the wrong app | Expo is in development-build mode but you use Expo Go (or the other way round) | Press s in the Expo window to switch. |
| Expo Go: "Project is incompatible with this version of Expo Go" | Expo Go is older than SDK 57 | Update Expo Go from the store. |
| iPhone cannot connect to the PC | Local network permission was denied | Settings → Privacy & Security → Local Network → turn on Expo Go / SiteCash. |
| Changes do not appear | Stale cache or the app lost connection | Press r; or stop Expo and run npx expo start --clear. |
| "Port 8081 is being used" | Another Expo is running | Close the other window, or npx expo start --port 8082. |
| No notifications | Expo Go, PUSH_MODE not set, permission denied, or no push key | Use a development build; add PUSH_MODE=expo and restart the server; allow notifications in the phone's settings; upload the FCM key (7a); iPhone: answer yes to the push key during the build. |
| Android: "App not installed" | An older build signed differently is installed | Uninstall the old SiteCash app first, then install again. |
| iPhone: the build does not install | Phone not registered, or Developer Mode off | Run eas device:create for the phone and rebuild; turn on Developer Mode. |
| A build fails on expo.dev | Many causes | Open the build page, read the red step of the log; run npx expo-doctor and npx expo install --check locally. |
| TypeScript errors about routes after adding a screen | Generated route types are stale | Restart npx expo start (it regenerates them). |
Next: when the app is ready for users, follow Publish to Play Store & App Store.