π‘ NeighborNodes
A location-aware community borrowing platform β borrow what you need, lend what you don't use.
NeighborNodes is a full-stack web application that lets people within the same neighborhood borrow and lend rarely-used household items β think power drills, projectors, camping tents, or kitchen appliances.
Many expensive household items sit idle 99% of the time. You buy a βΉ15,000 drill for one weekend project, a βΉ50,000 projector for two movie nights a year, or a camping tent that collects dust in your closet. Meanwhile, your neighbor three streets away just bought the exact same thing.
NeighborNodes connects neighbors within the same pincode into a trusted sharing community. Instead of buying, you borrow. Instead of hoarding, you lend β and earn.
In simple terms: Itβs like a neighborhood library, but for everything.
| Feature | What it Does | Why it Matters |
|---|---|---|
| πΊοΈ Community Map | Interactive Leaflet.js map showing available items near you | Visual discovery β see whatβs available at a glance |
| π Pincode-Based Communities | Items are filtered by pincode β you only see whatβs in your area | Ensures items are within walking/short-driving distance |
| π Privacy-First Addresses | Exact addresses are hidden until a borrow request is accepted | Protects user safety; only approximate locality shown on map |
| π Full Borrow Lifecycle | Pending β Accepted β Collected β Returned with status tracking |
Both parties always know where things stand |
| π‘οΈ Race Condition Prevention | PostgreSQL row-level locking (SELECT ... FOR UPDATE) on borrow/accept |
Two people canβt accidentally borrow the same item simultaneously |
| π€ AI Assistant Chatbot | Keyword-driven chatbot that helps find items and answers FAQs | Guided discovery without manual browsing |
| π Notification Badges | Dashboard badge showing pending incoming + outgoing request count | Never miss a borrow request |
| π Contact & Feedback | Structured feedback form with category tagging | Users can report issues, suggest features, or reach out |
| π JWT Authentication | Secure login/signup with bcrypt password hashing and JWT tokens | Industry-standard auth β sessions survive page reloads |
| π¦ 7 Item Categories | Utility Tools, Hardware, Electronics, Camping, Gaming, Home Appliances, Kitchen | Organized browsing with emoji-tagged category bar |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FRONTEND β
β Vanilla HTML/CSS/JS β’ Leaflet.js Maps β’ No build step β
β β
β index.html βββ Landing page + Map + Item grid β
β auth.html ββββ Login / Signup with pincode registration β
β Dashboard.html Lender + Borrower request management β
β Borrow.html ββ Item detail + date picker + reservation β
β ListItem.html β Form to post new item listings β
β Contact.html ββ Feedback/support form β
β script.js βββββ All frontend logic (single shared file) β
β style.css βββββ Complete design system (~50KB) β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β HTTP (REST API)
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BACKEND (Node.js + Express 5) β
β β
β server.js βββββββ Entry point, middleware, route mounting β
β db.js βββββββββββ PostgreSQL connection pool (pg) β
β β
β Controllers/ β
β βββ authController.js ββββββ Register (with pincode β
β β coords) + Login (JWT) β
β βββ borrowController.js ββββ Create request, pickup β
β β address reveal, collect, β
β β return (with transactions) β
β βββ lenderController.js ββββ CRUD items, accept/reject β
β β requests (row-level locking) β
β βββ locationController.js ββ Nearby items by pincode β
β β with Haversine distances β
β βββ assistantController.js β Keyword-based AI chatbot β
β βββ contactController.js βββ Feedback submission + admin β
β βββ itemController.js ββββββ General item queries β
β β
β Utils/ β
β βββ haversine.js ββββ Distance calculation (km) β
β βββ pincodeMap.js ββββ 100+ Mumbai/Pune pincode β lat/lng β
β βββ geocode.js βββββββ Geocoding helpers β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β SQL (pg driver)
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DATABASE (PostgreSQL) β
β β
β users βββββββββββ id, name, email, phone, password, β
β role, trust_score, locality, pincode, β
β full_address, latitude, longitude β
β β
β items βββββββββββ id, owner_id (FKβusers), item_name, β
β description, category, price_per_day, β
β status, image_url β
β β
β borrow_requests β id, item_id (FKβitems), β
β borrower_id (FKβusers), start_date, β
β end_date, total_price, request_status β
β β
β feedback ββββββββ id, user_id (FKβusers), name, email, β
β category, subject, message, status β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Before you begin, make sure you have these installed on your machine:
| Tool | Version | Download |
|---|---|---|
| Node.js | v18 or higher | nodejs.org |
| PostgreSQL | v14 or higher | postgresql.org |
| Git | Any recent version | git-scm.com |
π‘ New to these tools?
- Node.js is the JavaScript runtime that powers the backend server.
- PostgreSQL is the database where all data (users, items, requests) is stored.
- Git is for cloning (downloading) this repository.
git clone https://github.com/Bhushan0455/NeighborNodes.git
cd NeighborNodes
Open your PostgreSQL client (pgAdmin, psql CLI, or DBeaver) and run the SQL from Database_Queries.sql:
-- This creates 4 tables: users, items, borrow_requests, feedback
-- Open Database_Queries.sql and execute all CREATE TABLE statements
Then run the lifecycle migration to enable the full borrow status flow:
-- Open lifecycle_migration.sql and run it
-- This adds: pending, accepted, rejected, collected, returned
π‘ Beginner tip: If youβre using pgAdmin, open the Query Tool (Tools β Query Tool), paste the SQL, and click the βΆ Execute button.
The Database_Queries.sql file includes INSERT INTO items (...) statements with 42 sample items across 7 categories (utility tools, hardware, electronics, camping, gaming, home appliances, kitchen) β all with real Unsplash image URLs. Run those inserts to populate your database with demo data.
Create a .env file inside the Backend/ folder:
cd Backend
Create the file Backend/.env with the following content:
DB_USER=postgres
DB_HOST=localhost
DB_NAME=neighbornodes
DB_PASSWORD=your_postgres_password
DB_PORT=5432
JWT_SECRET=your_secret_key_here
| Variable | What it is |
|---|---|
DB_USER |
Your PostgreSQL username (default is postgres) |
DB_HOST |
Database host (localhost for local development) |
DB_NAME |
Name of the database you created in Step 2 |
DB_PASSWORD |
Your PostgreSQL password |
DB_PORT |
PostgreSQL port (default 5432) |
JWT_SECRET |
Any random string β used to sign authentication tokens |
β οΈ Security: The
.envfile is listed in.gitignoreand will never be committed to Git. Do not share it publicly.
cd Backend
npm install
This installs the following packages:
| Package | Purpose |
|---|---|
express |
Web server framework |
pg |
PostgreSQL client for Node.js |
bcrypt |
Password hashing (one-way encryption) |
jsonwebtoken |
JWT token generation and verification |
cors |
Cross-Origin Resource Sharing (lets the frontend talk to the backend) |
dotenv |
Loads .env variables into process.env |
nodemon (dev) |
Auto-restarts the server when you edit code |
npm start
You should see:
π Server running on http://localhost:5000
To verify the database connection, open your browser and visit:
http://localhost:5000/
You should get a JSON response like:
{
"message": "NeighborNodes Backend is Live",
"db_time": "2026-04-17T15:19:00.000Z"
}
The frontend is plain HTML β no build step required. Simply open any .html file in your browser:
Frontend/index.html β βOpen with Live ServerβFrontend/index.html to open it directly in your browserπ‘ Why Live Server? It auto-reloads the page when you edit HTML/CSS/JS, and avoids some browser file:// restrictions with fetch requests.
All endpoints are prefixed with http://localhost:5000/api.
| Method | Endpoint | Body | Description |
|---|---|---|---|
POST |
/api/auth/register |
{ name, email, phone, password, role, locality, pincode, address } |
Create a new user account. Pincode is validated against the supported pincode map. Coordinates are auto-assigned based on pincode center + random offset (~200m). |
POST |
/api/auth/login |
{ email, password } |
Authenticate and receive a JWT token + userId. |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/location/nearby/:userId |
Get all available items within the userβs pincode, with map coordinates and distances. |
GET |
/api/lender/items/:id |
Get a single itemβs details with owner info. |
GET |
/api/items |
Get all items (general query). |
| Method | Endpoint | Body | Description |
|---|---|---|---|
POST |
/api/borrow |
{ item_id, borrower_id, start_date, end_date } |
Submit a borrow request (uses row-level locking). |
GET |
/api/borrow/address/:requestId/:userId |
β | Get pickup address (only visible after request is accepted). |
PATCH |
/api/borrow/:requestId/collect |
{ borrower_id } |
Borrower marks item as physically collected. |
PATCH |
/api/borrow/:requestId/return |
{ borrower_id } |
Borrower marks item as returned (item becomes available again). |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/lender/my-items/:ownerId |
Get all items listed by a specific user. |
GET |
/api/lender/dashboard/:userId |
Get all incoming borrow requests for the lenderβs items. |
POST |
/api/lender/list-item |
Post a new item listing. |
PATCH |
/api/lender/request/:requestId |
Accept or reject a borrow request ({ status: "accepted" | "rejected" }). |
DELETE |
/api/lender/item/:itemId |
Delete an item listing. |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/borrower/requests/:userId |
Get all borrow requests made by a specific user. |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/notifications/count/:userId |
Get total pending request count (incoming + outgoing). |
| Method | Endpoint | Body | Description |
|---|---|---|---|
POST |
/api/assistant/chat |
{ message } |
Send a message to the keyword-based chatbot. Returns category-matched items or FAQ responses. |
| Method | Endpoint | Body | Description |
|---|---|---|---|
POST |
/api/contact |
{ name, email, category, subject, message, user_id } |
Submit feedback or contact message. |
GET |
/api/contact/all |
β | Admin: retrieve all feedback entries. |
users (1) ββββββ< (N) items
β β
β β
(1) (1)
β β
βΌ βΌ
(N) borrow_requests (N)
β
(1)
β
βΌ
(N) feedback
ββββββββββββ Lender accepts ββββββββββββ Borrower picks up βββββββββββββ
β PENDING β βββββββββββββββββββΊ β ACCEPTED β ββββββββββββββββββββββΊ β COLLECTED β
ββββββββββββ ββββββββββββ βββββββββββββ
β β
β Lender rejects Borrower returns β
βΌ βΌ
ββββββββββββ ββββββββββββ
β REJECTED β β RETURNED β
ββββββββββββ ββββββββββββ
(item β available)
* OVERDUE is computed dynamically: if status = 'collected' AND end_date < today
NeighborNodes/
β
βββ Frontend/ # Client-side (no build tools needed)
β βββ index.html # Landing page β hero, map, item grid, chatbot
β βββ auth.html # Login / Signup with pincode + locality fields
β βββ Dashboard.html # Lender items, incoming requests, borrower requests
β βββ Borrow.html # Item detail page with date picker + reservation
β βββ ListItem.html # Form to post a new item for lending
β βββ Contact.html # Feedback / Contact Us form
β βββ script.js # All frontend JavaScript logic (~48KB)
β βββ style.css # Complete design system (~50KB)
β
βββ Backend/ # Server-side (Node.js + Express)
β βββ server.js # Entry point β middleware, routes, notification endpoint
β βββ db.js # PostgreSQL connection pool configuration
β βββ package.json # Dependencies and scripts
β βββ .env # β οΈ Not committed β database + JWT credentials
β β
β βββ Controller/ # Business logic (one file per domain)
β β βββ authController.js # Register (pincode β coords) + Login (JWT)
β β βββ borrowController.js # Create request, address reveal, collect, return
β β βββ lenderController.js # Item CRUD, accept/reject with row-level locking
β β βββ locationController.js# Nearby items query with Haversine distance
β β βββ assistantController.js# Keyword-based AI chatbot
β β βββ contactController.js # Feedback submission + retrieval
β β βββ itemController.js # General item queries
β β
β βββ routes/ # Express route definitions (thin layer)
β β βββ authRoutes.js
β β βββ borrowRoutes.js
β β βββ lenderRoutes.js
β β βββ locationRoutes.js
β β βββ assistantRoutes.js
β β βββ contactRoutes.js
β β βββ itemRoutes.js
β β
β βββ utils/ # Shared helper functions
β βββ haversine.js # Haversine formula for distance (km) between coordinates
β βββ pincodeMap.js # 100+ Indian pincodes β { lat, lng, area } mapping
β βββ geocode.js # Geocoding utility functions
β βββ geocode-existing-users.js # One-time migration script for existing user coords
β
βββ Database_Queries.sql # Full schema + 42 seed items across 7 categories
βββ lifecycle_migration.sql # Adds collected/returned statuses to borrow_requests
βββ fix_user_coordinates.sql # Migration to fix user lat/lng from pincode centers
βββ .gitignore # Excludes .env, node_modules, logs, OS files
βββ README.md # You are here
The platform currently supports 100+ pincodes across:
| Region | Example Areas |
|---|---|
| Thane District | Thane West/East, Naupada, Wagle Estate, Kolshet, Manpada, Ghodbunder Road |
| Kalyan / Dombivli | Kalyan West/East, Dombivli West/East, Ambernath |
| Navi Mumbai | Vashi, Nerul, Kopar Khairane, Airoli, Ghansoli, Panvel, Kharghar, Kamothe |
| Mumbai City | Fort, Kalbadevi, Girgaon, Grant Road, Byculla, Parel, Dadar, Worli, Sion |
| Mumbai Suburbs | Bandra, Andheri, Goregaon, Malad, Kandivali, Borivali, Powai, Mulund |
| Mira-Bhayander | Mira Road, Bhayander West/East |
| Vasai / Virar | Virar West/East, Vasai West, Nalasopara |
| Pune | Camp, Station, Deccan, Shivajinagar, Hinjewadi, Hadapsar, Kothrud, Baner, Wakad |
To add a new pincode, simply add an entry to the
PINCODE_COORDSobject inBackend/utils/pincodeMap.js.
| Layer | Technology | Why this choice |
|---|---|---|
| Frontend | HTML5, CSS3, Vanilla JavaScript | Zero build step β open and run. Fast iteration. |
| Maps | Leaflet.js + OpenStreetMap | Free, open-source, no API key needed. |
| Backend | Node.js + Express 5 | Lightweight, async-native, huge ecosystem. |
| Database | PostgreSQL | ACID transactions, row-level locking, robust for concurrent operations. |
| Auth | bcrypt + JWT | Industry-standard password hashing + stateless token-based sessions. |
| DB Driver | pg (node-postgres) | Direct SQL β no ORM overhead, full control over queries. |
After setup, verify everything works by checking these endpoints:
| # | Test | Expected Result |
|---|---|---|
| 1 | Visit http://localhost:5000/ |
JSON with "NeighborNodes Backend is Live" |
| 2 | Open Frontend/index.html in browser |
Landing page loads with hero, category bar, and map |
| 3 | Sign up with a supported pincode (e.g., 400601) |
Account created, redirected to explore page |
| 4 | Check the dashboard after login | Shows βItems Listedβ, βPending Requestsβ, βItems Borrowedβ stats |
| 5 | Click any item β Reserve with dates | Borrow request created, visible on dashboard |
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the ISC License.
Built with π for communities β NeighborNodes