GitHunt
LA

Ladanividhi/FixItNow-AT_Project

FixItNow connects users with reliable local service professionals including electricians, plumbers, carpenters, beauticians, and many more. Whether you need a quick fix or a full service, we’ve got you covered.

🛠️ FixItNow

Your one-stop solution for all local home services!

FixItNow is a full-stack web application that connects users with reliable local service professionals including electricians, plumbers, carpenters, beauticians, appliance repair specialists, and many more. Whether you need a quick fix or a full service, we've got you covered.


📋 Table of Contents


✨ Features

  • 🔍 Service Catalog - Browse through various service categories with detailed subservices
  • 👤 User Dashboard - Manage bookings, view service history, and rate providers
  • 🏢 Provider Dashboard - Accept/decline requests, manage profile, and view ratings
  • 📅 Booking System - Schedule services with preferred date and time
  • Rating & Reviews - Rate and review service providers
  • 🔐 Authentication - Secure user and provider authentication

🔧 Prerequisites

Before you begin, ensure you have the following installed on your system:

  • Node.js (v14 or higher recommended) - Download Node.js
  • npm (comes with Node.js) or yarn
  • MongoDB (local installation or MongoDB Atlas account) - Download MongoDB
  • Git (for cloning the repository)

📦 Installation

🔙 Backend Setup

  1. Navigate to the backend directory:

    cd backend
  2. Install dependencies:

    npm install
  3. Create a .env file in the backend directory (see Environment Variables section below)

🎨 Frontend Setup

  1. Navigate to the frontend directory:

    cd frontend
  2. Install dependencies:

    npm install

🔐 Environment Variables

Backend .env File

Create a .env file in the backend directory with the following variables:

# MongoDB Connection
MONGO_URI=mongodb://localhost:27017/fixitnow

# JWT Secret (change this in production!)
JWT_SECRET=your_super_secret_jwt_key_here

📝 Environment Variables Explained:

  • MONGO_URI (Optional): MongoDB connection string. Defaults to mongodb://localhost:27017/fixitnow if not provided
  • JWT_SECRET (Optional): Secret key for JWT token generation. Defaults to supersecret if not set (⚠️ Change this in production!)
  • SMTP Variables (Optional): If not provided, the server will use Ethereal (test-only) email service for local development

Example .env File

If you're using MongoDB Atlas (cloud), your .env might look like:

MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/fixitnow?retryWrites=true&w=majority
JWT_SECRET=my_super_secret_key_12345

🗄️ Database Setup

You have two options to set up your database:

The seed script will populate your database with default services and subservices.

  1. Make sure MongoDB is running (local or cloud)

  2. Navigate to backend directory:

    cd backend
  3. Run the seed script:

    node src/seedServices.js

    You should see:

    📦 Connected to MongoDB. Seeding services...
    ✅ Services inserted successfully!
    

Option 2: Restore Database Dump 📥

If you have a MongoDB dump file:

  1. Make sure MongoDB is running

  2. Restore the dump:

    mongorestore --db fixitnow /path/to/your/dump

    Or if using MongoDB Atlas:

    mongorestore --uri="mongodb+srv://username:password@cluster.mongodb.net/fixitnow" /path/to/your/dump

⚠️ Note: The seed script will automatically create the database and collections if they don't exist. Make sure your MongoDB connection is working before running the seed script.


🚀 Running the Project

Start Backend Server

  1. Navigate to backend directory:

    cd backend
  2. Start the development server:

    node index.js

    You should see:

    ✅ MongoDB connected
    🚀 Server running on port 5000
    

Start Frontend Development Server

  1. Open a new terminal window/tab

  2. Navigate to frontend directory:

    cd frontend
  3. Start the development server:

    npm start

    The React app will automatically open in your browser at http://localhost:3000

🎯 Quick Start Commands

# Terminal 1 - Backend
cd backend && node index.js

# Terminal 2 - Frontend  
cd frontend && npm start

📁 Project Structure

FixItNow/
├── backend/                 # Backend server
│   ├── src/
│   │   ├── controllers/    # Request handlers
│   │   ├── models/          # MongoDB models
│   │   ├── routes/          # API routes
│   │   ├── seedServices.js  # Database seed script
│   │   └── index.js         # Server entry point
│   ├── .env                 # Environment variables (create this)
│   └── package.json
│
├── frontend/                # React frontend
│   ├── src/
│   │   ├── pages/           # React components
│   │   ├── api.js           # API helper
│   │   └── App.js           # Main app component
│   └── package.json
│
└── README.md

🔌 API Reference

Base URL

http://localhost:5000

Key Endpoints

Authentication

  • POST /auth/register - Register a new user
  • POST /auth/login - Login (user or provider)
  • POST /auth/provider-register - Register as a service provider

Services

  • GET /services - Get all available services
  • GET /services/providers?service=Plumber&subservice=Tap Installation - Get providers by service
  • POST /services/book - Book a service

Requests

  • GET /requests - Get requests (supports query params: userId, providerId, status)
  • PATCH /requests/:id/accept - Accept a request (provider)
  • PATCH /requests/:id/decline - Decline a request (provider)
  • PATCH /requests/:id/complete - Mark request as completed

Feedback

  • GET /feedback?userId=... - Get user's ratings
  • GET /feedback?providerId=... - Get provider's ratings

🐛 Troubleshooting

Common Issues

❌ MongoDB Connection Error

  • Problem: MongoDB connection error
  • Solution:
    • Make sure MongoDB is running: mongod (for local) or check your Atlas connection string
    • Verify your MONGO_URI in .env file is correct

❌ Port Already in Use

  • Problem: Port 5000 is already in use
  • Solution:
    • Change the port in backend/src/index.js or kill the process using port 5000
    • For Windows: netstat -ano | findstr :5000 then taskkill /PID <PID> /F

❌ Services Not Appearing

  • Problem: No services showing in the frontend
  • Solution: Run the seed script: cd backend && node src/seedServices.js

❌ npm install Fails

  • Problem: Errors during npm install
  • Solution:
    • Delete node_modules and package-lock.json
    • Run npm install again
    • Make sure you're using Node.js v14 or higher

🔍 Debugging Tips

  • Check server console logs for detailed error messages
  • Use browser DevTools (F12) to check network requests
  • Verify environment variables are loaded correctly
  • Test API endpoints directly using Postman or curl

📝 Additional Notes

  • The server automatically seeds services on first GET /services request if the database is empty
  • Email notifications use Ethereal (test service) if SMTP is not configured
  • All service providers are verified and rated by real customers
  • The application uses JWT tokens for authentication

🎉 You're All Set!

Once both servers are running:

Start by registering as a user or provider and explore the platform!


Happy Coding! 🚀