Cross-platform Expo application for palm scanning and fortune prediction backed by a Flask API and Firebase. Users can scan their palm, store the analysis in Firestore, request an AI-generated reading, and review their scan history inside the app.
- 📷 Palm Scan – Capture palm images with Expo Camera, toggle flash/torch, and retake shots.
- 🔍 Image Analysis – Upload scans to the Flask backend for processing (OpenCV/Mediapipe pipeline).
- 🔐 Firebase Auth/Profile – Email/password authentication with persisted user profiles.
- 🔮 AI Fortune – Send scan summaries and user context to DeepSeek for palmistry-inspired predictions. The answer is saved to
users/{uid}/fortunes. - 📚 History Viewer – Display each saved fortune with a quick preview and access to full details.
- ⏳ Loading Experience – Custom loading overlay while images upload & fortunes generate.
.
├── client/ # Expo app (TypeScript/React Native)
│ ├── app/ # Screens & routing
│ ├── components/ # Shared UI components
│ ├── services/ # Auth & Firestore helpers
│ └── utils/ # Fortune parsing, constants, etc.
├── server/ # Flask backend
│ ├── serve_flask.py # REST endpoints
│ ├── python.py # Image analysis pipeline
│ ├── firebase-key.json # Service account (private)
│ └── requirements.txt
└── README.md
- Node.js 18+ & npm (or yarn)
- Expo CLI (
npm install -g expo-cli) - Python 3.10+
- Firebase project (Firestore + Authentication enabled)
- DeepSeek API key for fortune predictions
EXPO_PUBLIC_FIREBASE_API_KEY=...
EXPO_PUBLIC_FIREBASE_AUTH_DOMAIN=...
EXPO_PUBLIC_FIREBASE_PROJECT_ID=...
EXPO_PUBLIC_FIREBASE_STORAGE_BUCKET=...
EXPO_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=...
EXPO_PUBLIC_FIREBASE_APP_ID=...
EXPO_PUBLIC_FIREBASE_MEASUREMENT_ID=... (optional)
DEEPSEEK_API_KEY=sk-...
DEEPSEEK_BASE=https://api.deepseek.com # optional override
GOOGLE_APPLICATION_CREDENTIALS=/abs/path/to/firebase-key.json
# Tune DeepSeek timeouts if needed:
# DEEPSEEK_CONNECT_TIMEOUT=10
# DEEPSEEK_READ_TIMEOUT=75
If GOOGLE_APPLICATION_CREDENTIALS is not set, the Flask app falls back to server/firebase-key.json.
# client
cd client
npm install
# server
cd ../server
python -m venv .venv
. .venv/Scripts/activate # PowerShell: .\.venv\Scripts\Activate
pip install -r requirements.txtSet the backend URL in client/utils/constants.ts:
export const API_BASE = "http://<your-local-ip>:8000";Use 10.0.2.2 for Android emulator, 127.0.0.1 for iOS simulator, or your LAN IP for devices on the same network.
cd server
. .venv/Scripts/activate
python serve_flask.pycd client
npx expo startChoose your target (web, emulator, or Expo Go on device). When a scan is taken, the client uploads to the server and shows a modal with the latest fortune, plus a history tab for previous readings.
- The history tab listens to
users/{uid}/fortunesand renders each document throughFortuneResultCard. client/utils/fortune.tsparses the AI response into sections (Love/Career/Finance/Health) and creates previews to reduce bandwidth.- Flask endpoints:
POST /analyze– process palm imagePOST /scan/save– store summarized scan data under the userPOST /fortune/predict– request DeepSeek prediction & save to FirestoreGET /fortune/list– list previous fortunes (client uses Firestore SDK directly instead)
- Ensure the service account JSON is not committed to public repositories.
network request failedon Expo: confirmAPI_BASEpoints to a reachable IP and the server is running. Check firewall rules if using Windows.- HTTP 402 from
/fortune/predict: DeepSeek credits exhausted or API key invalid; updateDEEPSEEK_API_KEY. - Firebase permissions: Firestore rules must allow authenticated users to read/write their own
users/{uid}/...documents.
- Add unit tests for fortune parsing.
- Provide UI controls to set fortune language/style before sending requests.
- Allow exporting scan results or sharing fortunes with friends.
Happy palm reading! ✋✨