This guide will walk you through setting up Diora for local development with all necessary dependencies and configurations.
Note: The backend is already deployed and live at https://diora.onrender.com. You can develop the frontend using the live backend, or set up a complete local environment for full development.
If you only want to work on the frontend and use the deployed backend:
- Clone the repository:
git clone https://github.com/https-sharif/diora-app.git
cd diora-app- Setup frontend environment:
cd frontend
npm install- Create frontend
.envfile:
API_URL=https://diora.onrender.com/api
STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key- Start frontend development:
npm run devFor complete local development with your own backend instance:
Before you begin, make sure you have:
- Node.js installed (v14 or higher)
- MongoDB installed locally or a MongoDB Atlas account
- Cloudinary account for image storage
- Stripe account for payment processing
- Create a
.envfile in the backend directory with these variables:
PORT=5010
MONGODB_URI=your_mongodb_uri
JWT_SECRET=your_jwt_secret
CLOUDINARY_CLOUD_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_cloudinary_key
CLOUDINARY_API_SECRET=your_cloudinary_secret
STRIPE_SECRET_KEY=your_stripe_secret
STRIPE_WEBHOOK_SECRET=your_webhook_secret
APP_URL=your_app_url- Create a
.envfile in the frontend directory:
API_URL=http://localhost:5010/api
STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key- Clone the repository:
git clone https://github.com/https-sharif/diora-app.git
cd diora-app- Install backend dependencies:
cd backend
npm install- Install frontend dependencies:
cd frontend
npm install- Start the frontend app:
cd frontend
npm run dev- Scan the QR code with Expo Go app on your phone, or:
- Press
wto open in web browser - Press
ito open iOS simulator - Press
ato open Android emulator
- Press
- Start the backend server:
cd backend
npm run dev-
In a new terminal, start the frontend:
cd frontend npm run dev -
(Optional) Build for web deployment:
cd frontend npm run build:web ```## Service Configuration
- Sign up at cloudinary.com
- Go to your dashboard and copy:
- Cloud name
- API Key
- API Secret
- Add them to your
.envfile
- Create an account at stripe.com
- Get your secret key from the dashboard
- Set up webhook endpoint:
http://localhost:5000/api/webhook - Copy the webhook secret
- Add both keys to your
.envfile
- Install MongoDB locally or create MongoDB Atlas account
- For local: Start MongoDB service
- For Atlas: Create cluster and get connection string
- Add connection URI to your
.envfile
- Create a Firebase project at console.firebase.google.com
- Enable Firebase Cloud Messaging
- Generate a private key for service account
- Download the JSON file and add path to
.env
Port already in use: Change PORT in your .env file to another port (e.g., 5001)
MongoDB connection failed: Ensure MongoDB is running locally or Atlas credentials are correct
Image upload fails: Check Cloudinary credentials in .env file
Payment processing errors: Verify Stripe keys and webhook configuration
- Use
npm run devfor hot reloading in both backend and frontend - Check console logs for detailed error messages
- Ensure all environment variables are set before starting
- Use the API documentation to test endpoints
- Monitor network requests in browser dev tools
Once everything is running:
- Create Account: Register a new user account
- Post Content: Try uploading an outfit post with image
- Shopping: Browse products and add to cart
- Messaging: Test real-time messaging between accounts
- Admin Features: Request shop promotion and test admin panel
- Payments: Use Stripe test cards to verify payment flow
# Server Configuration
PORT=5000
NODE_ENV=development
# Database
MONGODB_URI=mongodb://localhost:27017/diora
# Authentication
JWT_SECRET=your_super_secret_jwt_key_here
# Cloudinary (Image Storage)
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
# Stripe (Payments)
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
# Firebase (Notifications)
FIREBASE_PROJECT_ID=your_project_id
FIREBASE_PRIVATE_KEY=your_private_key
FIREBASE_CLIENT_EMAIL=your_client_emailProblem: "Error: Unable to resolve module"
# Solution: Clear Metro cache
npx expo start -c
# or
npm start -- --reset-cacheProblem: Metro bundler won't start
# Solution: Kill any running Metro processes
lsof -ti:8081 | xargs kill -9
# Then restart
npm startProblem: "Could not connect to development server"
- Ensure your Mac and device are on the same network
- Check firewall settings aren't blocking port 8081
- Try restarting the iOS simulator
# Reset iOS simulator
xcrun simctl erase allProblem: "No Xcode or CLT version detected"
# Install Xcode Command Line Tools
xcode-select --installProblem: "Unable to load script from assets"
# Solution 1: Reverse the port
adb reverse tcp:8081 tcp:8081
# Solution 2: Start dev server with local IP
npm start
# Then press 'a' for AndroidProblem: "SDK location not found"
- Set ANDROID_HOME environment variable in your shell profile:
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-toolsProblem: "Module not found" after installing new package
# Solution: Clear all caches and reinstall
rm -rf node_modules
rm package-lock.json
npm install
npx expo start -cProblem: TypeScript errors after updating packages
# Regenerate TypeScript types
npx expo customize tsconfig.jsonProblem: API calls fail on physical device
- Use your computer's local IP instead of localhost
- Update
API_URLin frontend.env:
API_URL=http://192.168.1.XXX:5010/apiProblem: CORS errors in web browser
- Backend must allow the frontend origin in CORS settings
- Check backend Express CORS configuration
Problem: Slow app performance in development
- Development builds are slower; test production build:
npx expo build:web
# or for mobile
eas build --platform iosProblem: Images not loading
- Clear Expo cache:
npx expo start -c- Check Cloudinary credentials in backend
.env - Verify image URLs are accessible
If issues persist:
- Check the Expo documentation
- Search Stack Overflow with
expotag - Visit Expo Forums
- Check the project's GitHub Issues
After successful setup:
- Explore the codebase using the Project Structure guide
- Learn about the system architecture in Architecture Overview
- Check out the API Documentation for endpoint details
- Review the Feature Showcase to understand all capabilities
- Add these to your backend
.envfile:
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret- Create a Stripe account at https://stripe.com
- Get your secret key from the Stripe dashboard
- Add to your backend
.envfile:
STRIPE_SECRET_KEY=your_stripe_secret_key- For development, use Stripe's test mode keys
- For testing payments, use Stripe's test card numbers:
- Card number: 4242 4242 4242 4242
- Any future expiry date
- Any 3-digit CVC
- Create a Firebase project at https://console.firebase.google.com
- Download your service account key (JSON file)
- Add these to your backend
.envfile:
FIREBASE_PROJECT_ID=your_project_id
FIREBASE_PRIVATE_KEY=your_private_key
FIREBASE_CLIENT_EMAIL=your_client_email