Skip to content

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 

Repository files navigation



PG Dhundo 🏠

A production-grade PG discovery platform for students and working professionals.
Search, shortlist, chat, and book verified PG accommodations β€” no brokers, no hassle.

🌐 Live Demo Β Β·Β  πŸ“¦ Backend API Docs Β Β·Β  πŸš€ Deploy Your Own


✨ Features

Category Feature
πŸ” Discovery Smart search by location, gender, price range with instant results
πŸ—ΊοΈ Map View Interactive Leaflet map with PG markers and routing
πŸ’¬ Live Chat Real-time WebSocket chat between tenant and owner, with automated greetings
πŸ” Auth JWT-based sessions, bcrypt password hashing, protected routes
πŸ’³ Payments Razorpay checkout integration (test & live mode)
🏠 Owner Portal Hosts submit and manage listings from their own dashboard
πŸ›‘οΈ Admin Panel Secure OTP-protected admin console for platform management
πŸ“£ Notifications Custom animated toast system β€” no browser alerts
🎨 Premium UI Glassmorphic design, Framer Motion animations, fully responsive

πŸ› οΈ Tech Stack

Frontend

Tool Purpose
React 19 + Vite 6 Component framework + blazing fast build tool
Tailwind CSS v4 Utility-first styling
Framer Motion Page transitions & micro-animations
React Leaflet Interactive maps
Lucide React Icon system
Axios HTTP client
Socket.io-client WebSocket chat

Backend

Tool Purpose
FastAPI Async REST + WebSocket API
Uvicorn ASGI production server
SQLAlchemy 2.0 ORM & query builder
Pydantic v2 Request/response validation
python-jose JWT token creation & verification
bcrypt Password hashing

Infrastructure

Layer Service
Frontend Hosting Vercel (global CDN, auto HTTPS)
Backend Hosting Render (free tier, auto-deploy)
Database Neon PostgreSQL (serverless, free)
Gmail SMTP via App Password

πŸ“ Project Structure

pg_dhundo/
β”œβ”€β”€ backend/                    # Python FastAPI application
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ core/               # Config, security, JWT helpers
β”‚   β”‚   β”œβ”€β”€ models/             # SQLAlchemy database models
β”‚   β”‚   β”œβ”€β”€ routes/             # API routers
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.py         # Register, Login, Token refresh
β”‚   β”‚   β”‚   β”œβ”€β”€ pgs.py          # PG listings CRUD + search
β”‚   β”‚   β”‚   β”œβ”€β”€ chat.py         # WebSocket real-time chat
β”‚   β”‚   β”‚   └── admin.py        # Admin dashboard endpoints
β”‚   β”‚   β”œβ”€β”€ schemas/            # Pydantic request/response schemas
β”‚   β”‚   β”œβ”€β”€ database.py         # DB engine & session factory
β”‚   β”‚   └── main.py             # App entry, middleware, CORS
β”‚   β”œβ”€β”€ requirements.txt
β”‚   β”œβ”€β”€ Procfile                # Render / Railway start command
β”‚   β”œβ”€β”€ .env.example            # Environment variable template
β”‚   └── run.py                  # Local dev runner
β”‚
β”œβ”€β”€ frontend/                   # React + Vite SPA
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ features/       # Domain components (listings, chat, auth)
β”‚   β”‚   β”‚   └── ui/             # Shared UI primitives
β”‚   β”‚   β”œβ”€β”€ context/            # Auth, Toast, Notification providers
β”‚   β”‚   β”œβ”€β”€ pages/              # Route-level views
β”‚   β”‚   └── App.jsx             # Router & layout wrapper
β”‚   β”œβ”€β”€ vite.config.js          # Build config + dev proxy
β”‚   β”œβ”€β”€ vercel.json             # SPA rewrites + security headers
β”‚   └── .env.example
β”‚
└── vercel.json                 # Root-level Vercel config

πŸš€ Local Development

Prerequisites

  • Python 3.10+
  • Node.js 18+
  • PostgreSQL (local, or a free Neon cloud DB)

1 β€” Clone the repo

git clone https://github.com/YOUR_USERNAME/pg-dhundo.git
cd pg-dhundo

2 β€” Backend Setup

cd backend

# Create virtual environment
python -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Configure environment
cp .env.example .env
# β†’ Open .env and fill in DATABASE_URL, SECRET_KEY, etc.

# Start API server (auto-reloads on file changes)
python run.py

API will be live at http://localhost:8000
Swagger docs at http://localhost:8000/docs

3 β€” Frontend Setup

# In a new terminal
cd frontend

npm install

# Configure environment
cp .env.example .env
# β†’ VITE_API_URL=http://127.0.0.1:8000  (already set for local dev)

npm run dev

App will be live at http://localhost:5173

The Vite dev server proxies all /pgs, /auth, /chat, /ws requests to the local backend β€” no CORS issues in dev.


🌐 Deployment

Full step-by-step deployment guide β†’ DEPLOYMENT.md

TL;DR free-tier setup:

Database  β†’ Neon.tech   (free PostgreSQL)
Backend   β†’ Render.com  (free web service, auto-deploys from GitHub)
Frontend  β†’ Vercel.com  (free hosting, global CDN)

Required environment variables:

Variable Where Description
DATABASE_URL Render Neon PostgreSQL connection string
SECRET_KEY Render 48-char random hex for JWT signing
ALLOWED_ORIGINS Render Your Vercel frontend URL
ENVIRONMENT Render production
SMTP_USER Render Gmail address for email notifications
SMTP_PASSWORD Render Gmail App Password (16 chars)
VITE_API_URL Vercel Your Render backend URL
VITE_RAZORPAY_KEY Vercel Razorpay public key ID

πŸ”‘ Environment Variables

Backend (backend/.env)

DATABASE_URL=postgresql://user:pass@host/dbname?sslmode=require
SECRET_KEY=<generate: python -c "import secrets; print(secrets.token_hex(48))">
ALLOWED_ORIGINS=http://localhost:5173
ENVIRONMENT=development
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your@gmail.com
SMTP_PASSWORD=xxxx xxxx xxxx xxxx

Frontend (frontend/.env)

VITE_API_URL=http://127.0.0.1:8000
VITE_RAZORPAY_KEY=rzp_test_YOUR_KEY_HERE

⚠️ Never commit .env files. Both are in .gitignore. Use .env.example as the reference.


πŸ“‘ API Reference

Method Endpoint Auth Description
POST /auth/register β€” Create user account
POST /auth/login β€” Login, returns JWT
GET /pgs β€” List/search PG listings
GET /pgs/{id} β€” Single PG details
POST /pgs Owner Create listing
PUT /pgs/{id} Owner Update listing
WS /ws/chat/{room} JWT Real-time chat
GET /admin/listings Admin All listings (moderation)

Full interactive docs available at /docs (Swagger UI) and /redoc.


🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Commit your changes: git commit -m 'feat: add your feature'
  4. Push to the branch: git push origin feature/your-feature
  5. Open a Pull Request

Please follow conventional commits (feat:, fix:, chore:, docs:) for clean history.


πŸ“œ License

This project is licensed under the MIT License β€” see LICENSE for details.


Built with ❀️ for students and professionals tired of broker fees.

⬆ Back to top

About

this website is a part of college project work ease user finding pg's

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors