Welcome to Mirror, a mobile application to get skin and hair product recommendations!
Prerequisites: The following steps require Node.js to be installed on your system. You'll also need Expo Go on your mobile device for testing. For the backend server, you'll need MongoDB installed locally or access to a MongoDB Atlas account.
- Clone this repository:
git clone https://github.com/ashwin-333/mirror.git
cd mirror
- Install dependencies:
npm install
- Set up environment variables:
- Create a
.env
file in the root directory by copying the example file:
cp .env.example .env
- Edit the
.env
file with your specific settings:
MONGODB_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key PORT=5002 DEVELOPER_IP=your_ip_address GEMINI_API_KEY=your_gemini_api_key
- Create a
To find your IP address:
On macOS/Linux:
ifconfig | grep "inet " | grep -v 127.0.0.1
The output will show your IP address, typically something like 192.168.1.100
or 10.0.0.174
.
On Windows:
ipconfig
Look for the "IPv4 Address" under your active network adapter.
Navigate to the backend directory and start the server:
cd backend
npm run dev
The server should start and connect to your MongoDB database. It will run on port 5002 by default and will be accessible from your physical device.
If you need the machine learning model server for recommendations:
cd server
./start_server.sh
In a new terminal, start the Expo development server:
npx expo start
This will display a QR code in your terminal. Scan this QR code with the Expo Go app on your mobile device to run the application.
-
Install the Expo Go app from:
-
Scan the QR code from the terminal with your device's camera (iOS) or directly within the Expo Go app (Android).
If your physical device cannot connect to the server:
-
Double check your IP address - Your computer's IP might change when switching networks. Update the
DEVELOPER_IP
in your.env
file when this happens. -
Firewall settings - Make sure your firewall allows connections on the port (default: 5002).
-
Same network - Ensure your phone and computer are on the same network.
-
Restart servers - Sometimes, restarting the backend server and Expo server can resolve connectivity issues.
The app includes a complete authentication system with:
- User registration
- Login/logout functionality
- JWT-based authentication
- Protected routes
Create a production build:
expo build:android # For Android
expo build:ios # For iOS
npx expo export:web # For web
assets/
- Contains images, fonts, and other static assetssrc/
- Source code for the applicationcomponents/
- Reusable UI componentsscreens/
- App screenscontext/
- Context providers including AuthContextservices/
- API service configurations
backend/
- MongoDB backend server codemodels/
- MongoDB schemasroutes/
- API endpointscontrollers/
- Business logicmiddleware/
- Authentication middleware
server/
- Machine learning model server for recommendations
- React Native
- Expo
- TypeScript
- Google Gemini API
- MongoDB
- Express.js
- JWT Authentication