Skip to content

adil-java/HomeFit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

151 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 HomeFitAR - Local Setup Guide

Complete guide to get the entire E-Commerce platform running on your local machine in under 10 minutes!

📋 What You'll Need

Required Software

Optional (Already Configured)

The project comes with pre-configured sample.env files. You only need to:

  • Update MySQL and other sample.env credentials
  • Add your Firebase google-services.json file
  • That's it! Ready to run.

🎯 Step-by-Step Setup

STEP 1: Extract & Install Dependencies

# Extract the ZIP file
# Navigate to the extracted folder
cd E-Commerce

# Install backend dependencies
cd backend
npm install

# Install admin dependencies
cd ../Admin
npm install

# Install mobile app dependencies
cd ../frontend
npm install

cd ..

STEP 2: Setup MySQL Database

# Login to MySQL
mysql -u root -p

# Create database
CREATE DATABASE ecommerce;
exit;

STEP 3: Update Backend Configuration

cd backend

```env
# Find this line in sample.env and update YOUR_MYSQL_PASSWORD
DATABASE_URL="mysql://root:YOUR_MYSQL_PASSWORD@localhost:3306/ecommerce"

Save and exit (Ctrl+X, then Y, then Enter)

STEP 4: Initialize Database and setup Prisma ORM

# Still in backend directory
npx prisma migrate deploy
npx prisma generate

STEP 5: Setup Firebase for Mobile App

  1. Go to Firebase Console
  2. Select the project: fir-auth01-10f58 (or create if needed)
  3. Download google-services.json:
    • Go to Project Settings → Your apps → Android app
    • Click "Download google-services.json"
  4. Copy to project:
    # Replace /path/to/downloaded/ with actual path
    cp /path/to/downloaded/google-services.json ./google-services.json

STEP 6: Update Mobile App API URL

cd ../frontend

# Get your computer's local IP address
# macOS/Linux:
ipconfig getifaddr en0

# Windows (PowerShell):
# (Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias Wi-Fi).IPAddress

# Open .env file and update YOUR_LOCAL_IP
nano .env

Update this line with your actual IP:

EXPO_PUBLIC_API_BASE_URL=http://YOUR_LOCAL_IP:8080/api
# Example: EXPO_PUBLIC_API_BASE_URL=http://192.168.1.100:8080/api

Save and exit (Ctrl+X, then Y, then Enter)

STEP 7: Start Everything! 🎉

Terminal 1 - Backend:

cd E-Commerce/backend
npm run dev

✅ Backend running at http://localhost:8080

Terminal 2 - Admin Dashboard:

cd E-Commerce/Admin
npm run dev

✅ Admin at http://localhost:5173

Terminal 3 - Mobile App:

cd E-Commerce/frontend
npm run dev

✅ Scan QR code with Expo Go app


📱 Testing the Mobile App

Option 1: Expo Go (Quick Test - Limited Features)

  1. Install Expo Go on your phone (iOS | Android)
  2. Scan QR code from Terminal 3
  3. ⚠️ Note: Google Sign-In and Stripe won't work in Expo Go

Option 2: Development Build (Full Features - Recommended)

# Install EAS CLI globally
npm install -g eas-cli

# Login to Expo (create account if needed)
eas login

# Build for Android cloud based on expo eas dashboard
cd E-Commerce/frontend
eas build --profile development --platform android

After build completes, download and install the APK/IPA on your device.

# Build for Android locally
cd E-Commerce/frontend
eas build --local --platform android --profile preview

## ✅ Verify Everything Works

### Test Backend:
```bash
curl http://localhost:8080/api/products

Should return product list (or empty array)

Test Admin:

  1. Open http://localhost:3001 in browser
  2. You should see the admin dashboard

Test Mobile:

  1. Open app on phone
  2. Browse products
  3. Test Google Sign-In (requires development build)

🐛 Common Issues & Fixes

Issue Solution
"Cannot connect to database" 1. Check MySQL is running: mysql -u root -p
2. Verify DATABASE_URL in backend/config/config.env
3. Ensure database exists: CREATE DATABASE ecommerce;
"Mobile can't reach API" 1. Use local IP (not localhost) in frontend/.env
2. Ensure phone and computer on same WiFi
3. Check firewall allows port 8080
"Prisma Client not found" Run: cd backend && npx prisma generate
"Google Sign-In error" 1. Ensure google-services.json is in frontend/ folder
2. Build development build with EAS (won't work in Expo Go)
3. Use the correct Firebase project
"Module not found" Delete node_modules folder and run npm install again
"Port already in use" Kill the process: lsof -ti:8080 | xargs kill -9 (or change PORT in config/config.env)

🎨 What's Next?

  • Add Products: Use Admin Dashboard (http://localhost:5173) to add products
  • Test Payments: Use Stripe test card: 4242 4242 4242 4242 (any future date, any CVC)
  • Explore Features: Try cart, wishlist, AR preview, and order tracking
  • Customize: Update colors, branding, and features to match your brand
  • Deploy: Follow deployment guides for production when ready

⚙️ Pre-Configured Services

The project includes pre-configured credentials for:

  • ✅ Firebase Authentication (Google Sign-In)
  • ✅ Stripe Payments (Test Mode)
  • ✅ Cloudinary (Image Storage)
  • ✅ JWT Authentication

You only need to:

  1. Update MySQL password
  2. Add google-services.json for mobile app

📚 Useful Commands

# View database in browser
cd backend 
npx prisma studio

# Reset database (⚠️ Deletes all data)
cd backend 
npx prisma migrate reset

# Check backend logs
cd backend
npm run dev


🆘 Need Help?

  1. Check the Common Issues section
  2. Verify all prerequisites are installed
  3. Ensure all environment variables are set correctly
  4. Check terminal logs for specific error messages

Authors: 
Muhammad Yaafay SE-23023
Adil Javed SE-23025

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors