Skip to content

SmeetPatil/RentSphere

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

47 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏠 RentSphere

A secure, feature-rich online rental marketplace connecting users directly for tech equipment and item rentals.

License Node.js PostgreSQL

🌟 Features

Core Functionality

  • πŸ“¦ Rental Marketplace - Browse, search, and rent items with detailed listings
  • πŸ—ΊοΈ Location-Based Search - Interactive map with nearby rentals
  • πŸ’¬ Real-Time Messaging - Direct communication between renters and listers
  • πŸ“Έ Image Management - Google Drive integration with 2TB storage
  • πŸ” Secure Authentication - Passport.js with local and OAuth strategies

Advanced Features

  • 🚚 Delivery System

    • Home delivery or self-pickup options
    • Real-time delivery tracking with status updates
    • Distance-based cost calculation
    • Automatic status progression (shipped β†’ en route β†’ delivered)
  • ⭐ Dual Rating System

    • Delivery ratings (delivery speed, item condition, communication)
    • Owner ratings (overall experience)
    • Aggregate ratings displayed on listings
  • πŸ’³ Payment Processing

    • Rental payments with platform fee (10%)
    • Delivery fee handling
    • Transaction receipts

πŸš€ Quick Start

Prerequisites

  • Node.js >= 18.0.0
  • PostgreSQL 14+
  • Google Drive OAuth credentials (for image storage)

Installation

  1. Clone the repository

    git clone https://github.com/SmeetPatil/rent-sphere.git
    cd rent-sphere
  2. Install dependencies

    # Install backend dependencies
    npm install
    
    # Install frontend dependencies
    cd client
    npm install
    cd ..
  3. Configure environment variables

    Create a .env file in the root directory:

    # Database
    DATABASE_URL=postgresql://user:password@host:port/database
    
    # Session
    SESSION_SECRET=your-session-secret
    
    # Google Drive OAuth (for image storage)
    GOOGLE_CLIENT_ID=your-client-id
    GOOGLE_CLIENT_SECRET=your-client-secret
    GOOGLE_REFRESH_TOKEN=your-refresh-token
    
    # Server
    PORT=8085
  4. Initialize the database

    node setup/initdb.js
    node setup/rental-tables-setup.js
    node setup/messaging-tables.js
  5. Run the application

    # Development mode (with hot reload)
    npm run dev
    
    # Production mode
    npm run project
  6. Access the application

πŸ“ Project Structure

rent-sphere/
β”œβ”€β”€ client/                 # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/    # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ Dashboard/
β”‚   β”‚   β”‚   β”œβ”€β”€ Messaging/
β”‚   β”‚   β”‚   └── Rentals/   # Rental, delivery, rating components
β”‚   β”‚   └── App.js
β”‚   └── build/             # Production build
β”œβ”€β”€ routes/                # Express API routes
β”‚   β”œβ”€β”€ api.routes.js
β”‚   β”œβ”€β”€ auth.routes.js
β”‚   β”œβ”€β”€ delivery-rating.routes.js
β”‚   β”œβ”€β”€ image.routes.js
β”‚   β”œβ”€β”€ messaging.routes.js
β”‚   └── rental.routes.js
β”œβ”€β”€ auth/                  # Authentication logic
β”‚   β”œβ”€β”€ passport.js
β”‚   └── userService.js
β”œβ”€β”€ middleware/            # Express middleware
β”œβ”€β”€ services/              # Business logic
β”‚   β”œβ”€β”€ googleDriveService.js
β”‚   └── simpleImageService.js
β”œβ”€β”€ setup/                 # Database setup scripts
β”œβ”€β”€ public/               # Static files
└── server.js             # Express server entry point

πŸ”§ Tech Stack

Backend

  • Runtime: Node.js
  • Framework: Express.js
  • Database: PostgreSQL (Neon)
  • Authentication: Passport.js
  • Session Management: express-session
  • File Upload: Multer
  • Storage: Google Drive API

Frontend

  • Framework: React
  • Routing: React Router
  • HTTP Client: Axios
  • Maps: Leaflet (OpenStreetMap)
  • Styling: CSS3

πŸ“– API Documentation

Authentication

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login
  • POST /api/auth/logout - User logout

Rentals

  • GET /api/rentals - Get all listings
  • GET /api/rental/:id - Get listing details
  • POST /api/rentals - Create new listing
  • PUT /api/rentals/:id - Update listing
  • DELETE /api/rentals/:id - Delete listing
  • POST /api/rental-requests - Create rental request

Delivery & Tracking

  • POST /api/calculate-delivery-cost - Calculate delivery cost
  • POST /api/choose-delivery-option - Select delivery method
  • POST /api/pay-delivery - Process delivery payment
  • GET /api/delivery-tracking/:requestId - Get tracking info
  • GET /api/simulate-delivery-progress - Update delivery statuses

Ratings

  • POST /api/rental-requests/:id/rate - Submit delivery rating
  • POST /api/rental-requests/:id/rate-owner - Submit owner rating
  • GET /api/listings/:id/delivery-ratings - Get listing ratings

Messaging

  • GET /api/conversations - Get user conversations
  • GET /api/conversations/:id/messages - Get messages
  • POST /api/messages - Send message

πŸ› οΈ Development

Running Tests

# Test database connection
node setup/test-connection.js

# Reset delivery data (for testing)
node setup/reset-delivery-payments.js

Building for Production

# Build frontend
cd client
npm run build

# Start production server
npm start

πŸ” Google Drive Setup

RentSphere uses Google Drive for image storage with OAuth2 authentication.

  1. Create Google Cloud Project

  2. Create OAuth Credentials

    • Go to "Credentials" section
    • Create OAuth 2.0 Client ID
    • Add authorized redirect URIs
    • Download credentials
  3. Get Refresh Token

    node services/get-refresh-token.js
  4. Update .env file

    GOOGLE_CLIENT_ID=your-client-id
    GOOGLE_CLIENT_SECRET=your-client-secret
    GOOGLE_REFRESH_TOKEN=your-refresh-token

πŸ“Š Database Schema

Key Tables

  • users - User accounts and authentication
  • listings - Rental item listings
  • rental_requests - Rental bookings and transactions
  • delivery_events - Delivery tracking history
  • delivery_ratings - Delivery experience ratings
  • user_ratings - Owner/renter ratings
  • conversations - Messaging conversations
  • messages - Chat messages

See OVERVIEW.md for detailed schema documentation.

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘€ Author

Smeet Patil

πŸ™ Acknowledgments

  • OpenStreetMap for map tiles
  • Google Drive API for storage
  • Neon for PostgreSQL hosting
  • All contributors and users

πŸ“ž Support

For support, please open an issue on GitHub or contact the maintainer.


Made with ❀️ by Smeet Patil

About

A secure online tech-based rental service connecting users with each other directly

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors