This document provides setup instructions for the React Native + Expo mobile app project. Follow these steps to fork the repository, install dependencies, configure Android Studio, set up the backend server, and run the app on a real device or emulator.
- Fork the repository to your GitHub account.
- Clone your forked repository:
Example:
git clone https://github.com/23abdul23/SE.git
cd SE
Do not run the above example as-is—replace with your details.
- Create a
.envfile in the project root with the following content:
MONGODB_URI=mongodb://localhost:27017/aegis-id
JWT_SECRET=secret
JWT_EXPIRE=7d
API_HOST=YOUR_LAPTOP_IP
PORT=3000
- Tip: Install MongoDB and MongoDB Compass for database management.
In the SE folder, run:
npm install
npm install --legacy-peer-deps If some error arises
npm install -g expo-cli
- Download Android Studio
- During setup, install:
- Android SDK
- Android SDK Platform Tools
- Android Emulator
- Add Android SDK to your system
PATH:
- Linux/macOS:
export ANDROID_HOME=$HOME/Android/Sdk export PATH=$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator:$PATH- Add to your
~/.bashrcor~/.zshrc - Reload your shell:
source ~/.bashrc
- Add to your
- Windows:
Edit Environment Variables in System Properties.
- Enable Developer Options & USB Debugging on your phone.
- Connect the device via USB.
- Verify connection:
adb devices
- Open Android Studio → Device Manager
- Create a new Virtual Device (Pixel, API 34 recommended)
- Start the emulator
In the SE folder, run:
npx expo start --tunnel
Metro Bundler will start, and the app will launch on your device or emulator.
- To start the backend server, run the following command in your
SEfolder:
nodemon server.js
- Ensure nodemon is installed (
npm install -g nodemonif needed).
- Error:
spawn adb ENOENT
Ensureadbis in your systemPATH. - Device not detected
Try:
adb kill-server
adb start-server
adb devices
- Further issues? Contact Abdul for assistance.
Follow these steps to connect your phone app to the backend server running on your laptop:
# Windows Command Prompt
ipconfig
# Look for "IPv4 Address" under your active network adapter
# Example: 192.168.1.100 or 172.19.x.x- Open
.envfile - Replace the IP address in
YOUR_LAPTOP_IPwith your laptop's IP OR Edit in the./ server/api.js
const API_BASE_URL = `http://YOUR_LAPTOP_IP:3000/api`;
// Example: const API_BASE_URL = `http://192.168.1.100:3000/api`;- Windows Security → Firewall & network protection
- Allow an app through firewall → Change Settings
- Allow another app → Browse and select Node.js
- Usually located at:
C:\Program Files\nodejs\node.exe
- Usually located at:
- Check both Private and Public network boxes
- Click OK
# In your SE folder
nodemon server.js
# You should see:
# 🚀 Aegis ID Backend running on port 3000
# 📦 MongoDB Connected: localhost# In your SE folder
npx expo start --tunnel
# This will show a QR code in your terminal- Ensure both devices are on the same WiFi network
- Download Expo Go app from:
- Scan QR Code:
- Android: Open Expo Go → Scan QR code from terminal
- iOS: Use Camera app → Scan QR code → Tap notification
-
Test API from phone browser:
- Open browser on phone
- Navigate to:
http://YOUR_LAPTOP_IP:3000/api/health - Should show:
{"status":"OK","message":"Aegis ID Backend is running"}
-
Test App Registration:
- Open the app on your phone
- Try registering a new user
- Check your laptop terminal for incoming requests
Problem: "Network Error" when registering
# 1. Verify server is running
curl http://localhost:3000/api/health
# 2. Check if port 3000 is accessible
netstat -an | findstr :3000
# 3. Test from phone browser
# Go to: http://YOUR_LAPTOP_IP:3000/api/healthProblem: Can't connect to laptop
- ✅ Both devices on same WiFi network
- ✅ Windows Firewall allows Node.js
- ✅ Correct IP address in
services/api.js - ✅ Backend server is running on port 3000
Problem: QR Code doesn't work
# Try tunnel mode for better connectivity
npx expo start --tunnel
# Or use direct connection
npx expo start --lanSome npm related Issues:
- run
npm install -g expo-cli - run
npm install - run
npx expo install expo-camera
- Phone → Sends registration data → Laptop API
- Laptop → Processes request → MongoDB Database
- Laptop → Returns response → Phone App
- Registration success/failure shown on phone
If you encounter any problems or installation difficulties, contact -O- Abdul ASAP (Raat me mat pareshan Karna).