Skip to content
PuneethV333Public

About

completed mern based project for rental website

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

71 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏠 Co-Living Platform

A full-stack co-living platform that connects property owners with tenants using AI-powered semantic search and vector-based roommate matching. Built with React, Node.js, MongoDB, Qdrant, and Google Gemini.

🌐 Live Demo β†’ co-living-two.vercel.app πŸ”Œ API β†’ co-living.up.railway.app


✨ Features

For Tenants

  • πŸ” AI Semantic Search β€” search properties using natural language (e.g. "quiet pg near metro with wifi")
  • 🀝 Roommate Matching β€” vector similarity matching finds compatible co-tenants
  • ❀️ Save Properties β€” bookmark listings to revisit later
  • πŸ“‹ Preference Survey β€” multi-step onboarding survey to capture lifestyle and budget preferences
  • πŸ”” Real-time Notifications β€” toast notifications for property activity
  • πŸ—ΊοΈ Property Map β€” explore listings on an interactive map

For Owners

  • πŸ—οΈ List Properties β€” create detailed property listings with photos, amenities and house rules
  • πŸ›οΈ Manage Rooms β€” add individual rooms under each property with pricing and availability
  • πŸ“Š Revenue Dashboard β€” visualise rental income over time
  • πŸ“ My Properties β€” manage all owned listings in one place

Platform

  • πŸ” Firebase Auth β€” Google sign-in with phone OTP verification (Twilio)
  • ⚑ Redis Caching β€” sub-millisecond response times for hot queries
  • 🧠 Gemini Embeddings β€” gemini-embedding-001 (3072-dim) vectors for semantic search
  • πŸ—„οΈ Qdrant β€” cloud vector database for properties and roommate profiles

πŸ› οΈ Tech Stack

Layer Technology
Frontend React 19, TypeScript, Vite, Tailwind CSS v4
State / Data TanStack Query v5, Axios
Auth Firebase Auth, react-firebase-hooks
Backend Node.js, Express 5, TypeScript
Database MongoDB (Mongoose)
Cache Redis
Vector DB Qdrant Cloud
AI / Embeddings Google Gemini (@google/genai)
OTP Twilio Verify
Deployment Vercel (frontend) Β· Railway (backend)

πŸ“ Project Structure

Co-Living/
β”œβ”€β”€ frontend/                    # React + Vite SPA
β”‚   └── src/
β”‚       β”œβ”€β”€ api/                 # Axios API wrappers per resource
β”‚       β”œβ”€β”€ components/          # Shared UI components
β”‚       β”œβ”€β”€ config/              # API base URL, Firebase, data config
β”‚       β”œβ”€β”€ context/             # UI context / provider
β”‚       β”œβ”€β”€ hooks/               # TanStack Query hooks
β”‚       β”œβ”€β”€ pages/
β”‚       β”‚   β”œβ”€β”€ Home/            # Dashboard, Profile, Owner view
β”‚       β”‚   β”œβ”€β”€ Login/           # Firebase Google sign-in
β”‚       β”‚   β”œβ”€β”€ Notification/    # Notification feed
β”‚       β”‚   β”œβ”€β”€ OnBoarding/      # Multi-step onboarding flow
β”‚       β”‚   β”œβ”€β”€ property/        # Browse, Detail, Create, Saved, Map
β”‚       β”‚   └── userPropertyPriority/  # Survey, Roommate matching
β”‚       β”œβ”€β”€ services/            # Auth service, notification helpers
β”‚       └── types/               # TypeScript types per domain
β”‚
└── backend/                     # Express API
    └── src/
        β”œβ”€β”€ config/              # Qdrant, Gemini, Firebase, Redis, env
        β”œβ”€β”€ constants/           # UUID namespace
        β”œβ”€β”€ controllers/         # Request handlers
        β”œβ”€β”€ db/                  # MongoDB connection
        β”œβ”€β”€ middleware/          # Auth (Firebase JWT), Redis, Error
        β”œβ”€β”€ models/              # Mongoose schemas
        β”œβ”€β”€ routes/              # Express routers
        β”œβ”€β”€ services/            # Business logic + embedding calls
        β”œβ”€β”€ types/               # Zod schemas + TypeScript interfaces
        └── utils/               # Redis helpers, error utils

πŸš€ Getting Started

Prerequisites

  • Node.js β‰₯ 18
  • MongoDB (local or Atlas)
  • Redis (local or Upstash)
  • Qdrant Cloud account
  • Firebase project (Auth enabled)
  • Google AI API key (Gemini)
  • Twilio account (Verify service)

Backend Setup

cd backend
npm install

Create .env in /backend:

PORT=5000
FRONTEND_URL=http://localhost:5173
MONGO_URL=mongodb://localhost:27017/co-living

REDIS_URL=redis://localhost:6379

# Firebase Admin SDK
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_CLIENT_EMAIL=firebase-adminsdk-xxx@your-project.iam.gserviceaccount.com
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"

# Twilio
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your-auth-token
TWILIO_VERIFY_SERVICE_SID=VAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Qdrant
QDRANT_URL=https://your-cluster.qdrant.io
QDRANT_API_KEY=your-qdrant-api-key

# Google Gemini
GENAI_API_KEY=your-gemini-api-key

# Optional (OpenAI / Ollama fallback)
OPENAI_API_KEY=
OLLAMA_URL=http://localhost:11434/api/embeddings
npm run dev
# Server starts on http://localhost:5000

Frontend Setup

cd frontend
npm install

Create .env in /frontend:

VITE_BACKEND_URL=http://localhost:5000
VITE_FIREBASE_API_KEY=your-firebase-api-key
VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your-sender-id
VITE_FIREBASE_APP_ID=your-app-id
npm run dev
# App starts on http://localhost:5173

πŸ“‘ API Reference

All endpoints require a Firebase Bearer token: Authorization: Bearer <firebase_id_token>

Auth β€” /api/auth

Method Endpoint Description
POST / Register or login β€” creates user if first time
GET /me Get current user with populated profile
POST /on-boarding Complete onboarding (name, role, DOB, phone…)
POST /sendOtp Send OTP to phone via Twilio
POST /verifyOtp Verify OTP and mark phone as verified

Properties β€” /api/property

Method Endpoint Description
GET /get List all active properties (Redis cached)
GET /my Get owner's own properties
GET /details/:id Get single property with owner info
POST /create Create property β†’ auto-generates embedding β†’ upserts to Qdrant
POST /search Semantic search via Gemini + Qdrant vector similarity

Rooms β€” /api/room

Method Endpoint Description
GET /get All rooms sorted by rent (Redis cached)
POST /create Create room under a property (Owners only)

Preferences β€” /api/propertyPreference

Method Endpoint Description
POST /create Save tenant preference β†’ generates roommate embedding β†’ upserts to Qdrant
GET /get Get own preference profile
PUT /update Update preference + re-embed
GET /roommates Find compatible roommates via vector similarity

Users β€” /api/user

Method Endpoint Description
PUT /update Update name, bio, email, phone, profile pic
GET /saved Get saved properties
POST /saved/:propertyId Toggle save/unsave a property

Notifications β€” /api/notification

Method Endpoint Description
GET /get Get all notifications
GET /new Get unread notifications
PUT /read Mark notifications as read

🧠 How AI Features Work

Semantic Property Search

When a property is created, the backend builds a rich text document from its name, description, type, location, amenities and rules. This is passed to gemini-embedding-001 to produce a 3072-dimensional vector, which is upserted to the properties collection in Qdrant.

When a tenant searches, the query string is embedded with the same model and compared via cosine similarity in Qdrant, returning the most semantically relevant properties β€” even if the exact keywords don't match.

User query: "quiet place near Koramangala with AC"
    ↓ Gemini embedding
    ↓ Qdrant cosine search (top 20)
    ↓ MongoDB fetch by propertyId
    β†’ Ranked results

Roommate Matching

After tenants complete the preference survey, a lifestyle profile string is built from their gender preference, work mode, food preference, occupancy type, pet-friendliness and preferred locations. This is embedded and stored in the roomMate Qdrant collection. The /roommates endpoint finds the top matching tenants by vector similarity.


🌱 Seed Data

A seed script is included to populate the database with realistic dummy data for development and testing.

Creates:

  • 15 users (10 Tenants + 5 Owners with business profiles)
  • 32 properties across Bengaluru, Hyderabad, Pune, Mumbai, Chennai, Delhi
  • 50+ rooms (1–3 per property) with varied pricing and availability
  • Property preference profiles for all 10 tenants
  • Embeddings pushed to both Qdrant collections

Install dependencies:

pip install pymongo google-genai qdrant-client

Run:

python seed.py

The script auto-deletes previously seeded data before each run. If Qdrant or Gemini is unreachable it falls back gracefully β€” Qdrant unavailability stores embedding metadata in Mongo, and Gemini unavailability uses deterministic mock vectors.


πŸ—ΊοΈ Frontend Pages

Route Page Access
/login Google sign-in Public
/on-boarding Multi-step profile setup Authenticated, incomplete
/home Dashboard β€” properties + rooms Authenticated
/home/browse Filter + explore all listings Authenticated
/home/property/details/:id Property detail + map Authenticated
/home/create/Property List a new property Owners only
/home/create/Room Add room to property Owners only
/home/survey Preference survey Tenants only
/home/preferences/edit Edit preferences Tenants only
/home/roommates Roommate matches Tenants only
/home/saved Saved properties Authenticated
/home/profile User profile Authenticated
/home/profile/edit Edit profile Authenticated
/home/owner Owner analytics Owners only
/home/messages Notification feed Authenticated

βš™οΈ Environment Variables Summary

Backend

Variable Required Description
PORT βœ… Server port
FRONTEND_URL βœ… CORS allowed origin
MONGO_URL βœ… MongoDB connection string
REDIS_URL βœ… Redis connection string
FIREBASE_PROJECT_ID βœ… Firebase Admin
FIREBASE_CLIENT_EMAIL βœ… Firebase Admin
FIREBASE_PRIVATE_KEY βœ… Firebase Admin
TWILIO_ACCOUNT_SID βœ… Phone OTP
TWILIO_AUTH_TOKEN βœ… Phone OTP
TWILIO_VERIFY_SERVICE_SID βœ… Phone OTP
QDRANT_URL βœ… Vector DB URL
QDRANT_API_KEY βœ… Vector DB API key
GENAI_API_KEY βœ… Gemini embeddings
OPENAI_API_KEY βž– Optional alternative
OLLAMA_URL βž– Optional local embeddings

Frontend

Variable Required Description
VITE_BACKEND_URL βœ… Backend API base URL
VITE_FIREBASE_* βœ… Firebase client config (6 vars)

🚒 Deployment

Frontend β†’ Vercel

  1. Connect your GitHub repo to Vercel
  2. Set Framework Preset to Vite
  3. Set Root Directory to frontend
  4. Add all VITE_* environment variables
  5. Deploy

Backend β†’ Railway

  1. Create a new Railway project
  2. Connect your GitHub repo
  3. Set Root Directory to backend
  4. Add all backend environment variables
  5. Railway auto-detects Node.js and runs npm start

Ensure FRONTEND_URL in Railway matches your Vercel deployment URL for CORS to work.


πŸ“œ License

MIT β€” see LICENSE

About

completed mern based project for rental website

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages