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
- Prerequisites
- Installation
- Environment Variables
- Database Setup
- Running the Project
- Project Structure
- API Reference
- Troubleshooting
✨ 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
-
Navigate to the backend directory:
cd backend -
Install dependencies:
npm install
-
Create a
.envfile in thebackenddirectory (see Environment Variables section below)
🎨 Frontend Setup
-
Navigate to the frontend directory:
cd frontend -
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 tomongodb://localhost:27017/fixitnowif not providedJWT_SECRET(Optional): Secret key for JWT token generation. Defaults tosupersecretif 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:
Option 1: Run Seed Script (Recommended for Development) 🌱
The seed script will populate your database with default services and subservices.
-
Make sure MongoDB is running (local or cloud)
-
Navigate to backend directory:
cd backend -
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:
-
Make sure MongoDB is running
-
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
-
Navigate to backend directory:
cd backend -
Start the development server:
node index.js
You should see:
✅ MongoDB connected 🚀 Server running on port 5000
Start Frontend Development Server
-
Open a new terminal window/tab
-
Navigate to frontend directory:
cd frontend -
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 userPOST /auth/login- Login (user or provider)POST /auth/provider-register- Register as a service provider
Services
GET /services- Get all available servicesGET /services/providers?service=Plumber&subservice=Tap Installation- Get providers by servicePOST /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 ratingsGET /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_URIin.envfile is correct
- Make sure MongoDB is running:
❌ Port Already in Use
- Problem:
Port 5000 is already in use - Solution:
- Change the port in
backend/src/index.jsor kill the process using port 5000 - For Windows:
netstat -ano | findstr :5000thentaskkill /PID <PID> /F
- Change the port in
❌ 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_modulesandpackage-lock.json - Run
npm installagain - Make sure you're using Node.js v14 or higher
- Delete
🔍 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 /servicesrequest 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:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
Start by registering as a user or provider and explore the platform!
Happy Coding! 🚀