Skip to content

shantanuchorghe/workbnb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Workbnb - Workspace Booking Platform

Workbnb is a comprehensive workspace booking platform built with the MERN stack, similar to Airbnb but focused exclusively on workspaces. Users can search, book, and review workspaces while providers can list and manage their spaces.

🚀 Features

Core Features (MVP)

  • User Authentication: JWT-based auth with role-based access (User, Provider, Admin)
  • Workspace Search: Advanced filtering by location, category, price, amenities
  • Booking System: Real-time availability checking and booking management
  • Payment Integration: Razorpay payment gateway with secure transactions
  • Review System: User reviews and ratings for workspaces
  • Admin Dashboard: Complete system management and analytics

User Module

  • Register/Login with email verification
  • Search workspaces with advanced filters
  • Book workspaces with date/time selection
  • Online payment integration
  • Leave reviews and ratings
  • Manage bookings and profile

Provider Module

  • Register as workspace provider
  • List workspace with detailed information
  • Upload workspace images
  • Manage availability schedules
  • View and manage bookings
  • Update pricing and amenities

Admin Module

  • Dashboard with system analytics
  • Manage users, providers, and listings
  • Handle disputes and verification
  • Generate system reports
  • Monitor platform performance

🛠 Tech Stack

Backend

  • Node.js - Runtime environment
  • Express.js - Web framework
  • MongoDB - Database
  • Mongoose - ODM
  • JWT - Authentication
  • bcryptjs - Password hashing
  • Razorpay - Payment gateway
  • Cloudinary - Image storage
  • Express Validator - Input validation

Frontend

  • React.js - UI framework
  • React Router - Routing
  • Axios - HTTP client
  • Tailwind CSS - Styling
  • React Hook Form - Form handling
  • React Hot Toast - Notifications
  • React Icons - Icon library

📁 Project Structure

workbnb/
├── backend/
│   ├── controllers/          # Route controllers
│   ├── middleware/          # Custom middleware
│   ├── models/             # Database models
│   ├── routes/             # API routes
│   ├── scripts/            # Database scripts
│   ├── config/             # Configuration files
│   └── server.js           # Entry point
├── frontend/
│   ├── public/             # Static files
│   ├── src/
│   │   ├── components/     # Reusable components
│   │   ├── contexts/       # React contexts
│   │   ├── pages/          # Page components
│   │   ├── services/       # API services
│   │   └── App.js          # Main app component
│   └── package.json
├── package.json            # Root package.json
└── README.md

🚀 Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB (local or cloud)
  • npm or yarn

Installation

  1. Clone the repository

    git clone <repository-url>
    cd workbnb
  2. Install dependencies

    # Install root dependencies
    npm install
    
    # Install backend dependencies
    npm run install-server
    
    # Install frontend dependencies
    npm run install-client
  3. Environment Setup

    Create .env file in the backend directory:

    NODE_ENV=development
    PORT=5000
    MONGODB_URI=mongodb://localhost:27017/workbnb
    JWT_SECRET=your_jwt_secret_key_here
    JWT_EXPIRE=7d
    
    # 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
    
    # Razorpay (for payments)
    RAZORPAY_KEY_ID=your_razorpay_key_id
    RAZORPAY_KEY_SECRET=your_razorpay_key_secret
    
    # Email (for notifications)
    EMAIL_FROM=[email protected]
    EMAIL_HOST=smtp.gmail.com
    EMAIL_PORT=587
    EMAIL_USER=[email protected]
    EMAIL_PASS=your_app_password
  4. Seed the database

    cd backend
    npm run seed
  5. Start the application

    # Start both backend and frontend
    npm run dev
    
    # Or start individually
    npm run server    # Backend only
    npm run client    # Frontend only

Access the Application

🔐 Test Accounts

After running the seed script, you can use these test accounts:

📱 API Endpoints

Authentication

  • POST /api/auth/register - Register user
  • POST /api/auth/login - Login user
  • GET /api/auth/me - Get current user
  • PUT /api/auth/profile - Update profile

Workspaces

  • GET /api/workspaces - Get all workspaces
  • GET /api/workspaces/search - Search workspaces
  • GET /api/workspaces/:id - Get workspace details
  • POST /api/workspaces - Create workspace (Provider)
  • PUT /api/workspaces/:id - Update workspace (Provider)

Bookings

  • POST /api/bookings - Create booking
  • GET /api/bookings/my-bookings - Get user bookings
  • GET /api/bookings/availability/:workspaceId - Check availability
  • PUT /api/bookings/:id/cancel - Cancel booking

Payments

  • POST /api/payments/create - Create payment order
  • POST /api/payments/verify - Verify payment
  • GET /api/payments/history - Get payment history

Reviews

  • POST /api/reviews - Create review
  • GET /api/reviews/workspace/:workspaceId - Get workspace reviews
  • PUT /api/reviews/:id - Update review

🎨 UI Components

The frontend is built with a modern, responsive design using Tailwind CSS:

  • Responsive Design: Mobile-first approach
  • Component Library: Reusable UI components
  • Form Validation: Client-side and server-side validation
  • Loading States: Skeleton loaders and spinners
  • Error Handling: User-friendly error messages
  • Toast Notifications: Real-time feedback

🔒 Security Features

  • JWT Authentication: Secure token-based auth
  • Password Hashing: bcrypt for password security
  • Input Validation: Express-validator for sanitization
  • Rate Limiting: API rate limiting
  • CORS: Cross-origin resource sharing
  • Environment Variables: Secure configuration

📊 Database Schema

Collections

  • Users: User accounts and profiles
  • Workspaces: Workspace listings and details
  • Bookings: Booking records and status
  • Reviews: User reviews and ratings
  • Payments: Payment transactions (integrated with Razorpay)

Key Relationships

  • Users can have multiple workspaces (providers)
  • Users can make multiple bookings
  • Workspaces can have multiple bookings and reviews
  • Bookings are linked to users, workspaces, and payments

🚀 Deployment

Backend (Render)

  1. Connect your GitHub repository to Render
  2. Set environment variables in Render dashboard
  3. Deploy the backend service

Frontend (Netlify)

  1. Connect your GitHub repository to Netlify
  2. Set build command: cd frontend && npm run build
  3. Set publish directory: frontend/build
  4. Set environment variables for API URL

Environment Variables for Production

NODE_ENV=production
MONGODB_URI=mongodb+srv://username:[email protected]/workbnb
JWT_SECRET=your_production_jwt_secret
RAZORPAY_KEY_ID=your_production_razorpay_key
RAZORPAY_KEY_SECRET=your_production_razorpay_secret
CLOUDINARY_CLOUD_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_cloudinary_key
CLOUDINARY_API_SECRET=your_cloudinary_secret

🧪 Testing

Manual Testing

  1. Test user registration and login
  2. Test workspace search and filtering
  3. Test booking flow and payment
  4. Test provider workspace creation
  5. Test admin dashboard functionality

API Testing

Use tools like Postman or Thunder Client to test API endpoints:

  • Import the API collection
  • Set up authentication tokens
  • Test all CRUD operations

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

📝 License

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

🆘 Support

For support and questions:

  • Create an issue in the repository
  • Contact the development team
  • Check the documentation

🔮 Future Enhancements

  • Real-time chat between users and providers
  • Mobile app (React Native)
  • Advanced analytics and reporting
  • Multi-language support
  • Social login integration
  • Advanced booking features (recurring bookings)
  • Integration with calendar systems
  • Automated email notifications
  • Advanced search with AI recommendations

Built with ❤️ using the MERN stack

About

Workspace booking platform.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages