A full-stack e-commerce application built with React Native (Expo) frontend and Node.js/Express backend with MongoDB.
- ποΈ Product catalog with categories (Casual, Formal, Streetwear, Seasonal, Special)
- π Search and filter products
- π Shopping cart functionality
- β€οΈ Wishlist management
- π€ User authentication (Email/Phone OTP + Google Sign-in)
- π³ Checkout and payment processing
- π± Responsive design with NativeWind (Tailwind CSS)
- π¨ Modern UI with smooth animations
- π JWT-based authentication
- π§ Email/SMS OTP verification
- π Google OAuth integration
- ποΈ Product management with variants
- π Cart and wishlist APIs
- π³ Stripe payment integration
- π¦ Order management
- π Security middleware (Helmet, Rate limiting, CORS)
- π Admin panel for order management
- React Native with Expo
- TypeScript for type safety
- NativeWind (Tailwind CSS for React Native)
- Zustand for state management
- Expo Router for navigation
- Expo Auth Session for Google OAuth
- Node.js with Express.js
- MongoDB with Mongoose ODM
- JWT for authentication
- Stripe for payments
- Passport.js for OAuth
- Nodemailer for email OTP
- Twilio for SMS OTP
- Cloudinary for image storage
- Node.js (v16 or higher)
- MongoDB Atlas account
- Google Cloud Console account (for OAuth)
- Stripe account (for payments)
- Twilio account (for SMS OTP)
- Gmail account (for email OTP)
git clone <repository-url>
cd react-appcd backend
npm installCreate a .env file in the backend directory:
PORT=5000
# MongoDB Atlas connection
MONGO_URI=mongodb+srv://ujeshyadav007_db_user:2q8TaUcZQ8ZMigwo@casapp.7t1zwgh.mongodb.net/ecommerce?retryWrites=true&w=majority&appName=casapp
# Google OAuth
GOOGLE_CLIENT_ID=948047525047-2j18q6nme6furh2t06sl5hv69i70ppt0.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your_google_client_secret_here
GOOGLE_CALLBACK_URL=http://localhost:5000/api/auth/google/callback
# JWT Secret
JWT_SECRET=casa_ecommerce_jwt_secret_key_2024_secure_random_string
# Session Secret
SESSION_SECRET=casa_ecommerce_session_secret_2024_secure_random_string
# Stripe Payment
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key_here
STRIPE_PUBLISHABLE_KEY=pk_test_your_stripe_publishable_key_here
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here
# Email Configuration (for OTP)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password_here
# Twilio (for SMS OTP)
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE_NUMBER=your_twilio_phone_number
# Cloudinary (for image uploads)
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret
# Environment
NODE_ENV=developmentnpm run seednpm run devThe backend will be running on http://localhost:5000
cd frontend
npm installnpm startPOST /api/auth/send-otp- Send OTP to email/phonePOST /api/auth/login-email- Login with email OTPPOST /api/auth/login-phone- Login with phone OTPPOST /api/auth/google- Google OAuth loginGET /api/auth/profile- Get user profilePUT /api/auth/profile- Update user profile
GET /api/products- Get all products (with filtering)GET /api/products/featured- Get featured productsGET /api/products/:id- Get product by IDGET /api/products/category/:category- Get products by categoryGET /api/products/search/:query- Search productsPOST /api/products/:id/reviews- Add product review
GET /api/cart- Get user's cartPOST /api/cart/add- Add item to cartPUT /api/cart/update- Update cart item quantityDELETE /api/cart/remove- Remove item from cartDELETE /api/cart/clear- Clear cartGET /api/cart/count- Get cart item countPOST /api/cart/validate- Validate cart before checkout
GET /api/wishlist- Get user's wishlistPOST /api/wishlist/add- Add item to wishlistDELETE /api/wishlist/remove- Remove item from wishlistDELETE /api/wishlist/clear- Clear wishlistGET /api/wishlist/check/:productId- Check if item is in wishlistGET /api/wishlist/count- Get wishlist item countPOST /api/wishlist/move-to-cart- Move item from wishlist to cart
POST /api/orders/create- Create order and payment intentPOST /api/orders/confirm-payment- Confirm paymentGET /api/orders/my-orders- Get user's ordersGET /api/orders/:id- Get order by IDPUT /api/orders/:id/cancel- Cancel order
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URIs:
http://localhost:5000/api/auth/google/callback- For mobile: Use your Expo client URL
- Create a Stripe account
- Get your API keys from the dashboard
- Set up webhooks for payment events
- Add webhook endpoint:
http://localhost:5000/api/orders/webhook
- Create a Twilio account
- Get your Account SID and Auth Token
- Purchase a phone number for SMS
- Enable 2-factor authentication on your Gmail account
- Generate an App Password
- Use the App Password in EMAIL_PASS
react-app/
βββ backend/
β βββ config/
β β βββ database.js
β βββ middleware/
β β βββ auth.js
β β βββ validation.js
β βββ models/
β β βββ User.js
β β βββ Product.js
β β βββ Cart.js
β β βββ Wishlist.js
β β βββ Order.js
β βββ routes/
β β βββ auth.js
β β βββ products.js
β β βββ cart.js
β β βββ wishlist.js
β β βββ orders.js
β βββ scripts/
β β βββ seedDatabase.js
β βββ package.json
β βββ server.js
βββ frontend/
β βββ app/
β β βββ index.tsx
β β βββ login.tsx
β β βββ cart.tsx
β β βββ wishlist.tsx
β β βββ checkout.tsx
β β βββ checkout-success.tsx
β β βββ profile.tsx
β βββ src/
β β βββ components/
β β βββ data/
β β βββ lib/
β β β βββ api.ts
β β βββ state/
β β βββ auth.ts
β β βββ cart.ts
β β βββ wishlist.ts
β βββ package.json
βββ README.md
-
Start the backend server:
cd backend npm run dev -
Start the frontend:
cd frontend npm start -
Open the app:
- Scan the QR code with Expo Go app on your phone
- Or press 'w' to open in web browser
- Or press 'a' for Android emulator
- Or press 'i' for iOS simulator
-
Authentication:
- Try email/phone OTP login
- Test Google Sign-in
- Verify user profile management
-
Shopping:
- Browse products by category
- Search for specific items
- Add items to cart and wishlist
- Test cart quantity updates
-
Checkout:
- Add items to cart
- Proceed to checkout
- Test payment flow (use Stripe test cards)
- Verify order confirmation
- Set up environment variables in your hosting platform
- Deploy the backend code
- Update frontend API URLs to point to production backend
- Configure EAS Build
- Build for production
- Submit to app stores
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
For support, email support@casa.com or create an issue in the repository.
Note: Make sure to replace all placeholder values in the environment variables with your actual credentials before running the application.