ThreatLens is an Expo React Native app for personal digital safety.
Run once per project (or when rotating keys/redeploying):
npm run setup:cloud -- -ProjectId YOUR_GCP_PROJECT_ID -WriteEnvOptional for shared dev backend without API-key auth:
npm run setup:cloud -- -ProjectId YOUR_GCP_PROJECT_ID -DisableApiKeyAuth -WriteEnvWhat this script does:
- Enables required Google Cloud APIs
- Ensures Firestore exists
- Generates master key pair if missing
- Stores secrets in Secret Manager
- Deploys
registerandverifyfunctions - Writes local
.envand.setup/generated/trust-config.json
npm run setup:localThen run the app:
npx expo run:android
npx expo start --dev-clientThe script:
- Creates
.envfrom.env.exampleif missing - Applies generated backend config if available
- Installs npm dependencies
This README is for a first-time contributor who just cloned the repo and wants to run the app using either:
- Expo Go on a physical phone
- Android Studio emulator on desktop (Windows or macOS)
- Node.js 18+ (Node.js 20 LTS recommended)
- npm
- Git
- Android Studio (for Android emulator flow)
- JDK 17 (required for Android build toolchain)
git clone https://github.com/Kishalll/threat_lens.git
cd threat_lens
npm installCreate a file named .env in project root.
Tip: this is automatic if you run npm run setup:local.
EXPO_PUBLIC_GEMINI_API_KEY=your_gemini_api_key
EXPO_PUBLIC_TRUST_REGISTRY_BASE_URL=https://us-central1-your_project_id.cloudfunctions.net
EXPO_PUBLIC_TRUST_REGISTRY_API_KEY=your_registry_api_key
EXPO_PUBLIC_MASTER_PUBLIC_KEY_PEM="-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----"For backend deployment details (/register + /verify, Firestore, cert setup), see cloud-function/README.md.
Automated setup scripts are available in scripts/setup.
If you change .env, restart Metro with cache clear:
npx expo start -cUse this for fastest testing loop.
- Install Expo Go on your phone.
- Connect laptop and phone to the same Wi-Fi network.
- Start the project:
npx expo start- Scan the QR code from Expo Go.
If the phone cannot connect, run tunnel mode:
npx expo start --tunnelNote: Expo Go does not include custom native modules from this app, so native notification interception features are limited in Expo Go.
In Android Studio, open SDK Manager and install:
- Android SDK Platform (API 34 or newer)
- Android SDK Build-Tools
- Android SDK Platform-Tools
- Android SDK Command-line Tools (latest)
- Android Emulator
Set User variables:
JAVA_HOME=C:\Users\<your-user>\.jdk\jdk-17.x.xANDROID_HOME=C:\Users\<your-user>\AppData\Local\Android\SdkANDROID_SDK_ROOT=C:\Users\<your-user>\AppData\Local\Android\Sdk
Add to User Path:
%JAVA_HOME%\bin%ANDROID_HOME%\platform-tools%ANDROID_HOME%\emulator%ANDROID_HOME%\cmdline-tools\latest\bin
Open a new terminal and verify:
java -version
adb version
emulator -list-avds- Android Studio > Device Manager > Create device > Start it.
- From project root:
npx expo run:android- In a second terminal:
npx expo start --dev-client- Press
ato open on the running emulator.
In Android Studio, install the same components listed in the Windows section.
Add this to ~/.zshrc:
export ANDROID_HOME=$HOME/Library/Android/sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
export PATH=$JAVA_HOME/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator:$ANDROID_HOME/cmdline-tools/latest/bin:$PATHApply and verify:
source ~/.zshrc
java -version
adb version
emulator -list-avds- Android Studio > Device Manager > Create device > Start it.
- From project root:
npx expo run:android- In a second terminal:
npx expo start --dev-client- Press
ato open on the running emulator.
Android SDK paths are missing from Path. Add platform-tools and open a new terminal.
Move Java 17 path above old Java paths in Path, then reopen terminal.
Start emulator first, then run adb devices and retry npx expo run:android.
Already configured in app.json with scheme: threatlens.
- Never commit
.env. - If any API key is exposed, rotate it immediately.
- Never commit
master_private.pem; store it in Google Secret Manager only.