back to work
2023 · marketplace

Real Estate.

stack
  • node.js
  • react
  • mongodb
  • firebase
  • tailwind
status
built

README.md

dilrukshax/Real-Estate-Marketplace

GitHub

Real Estate Marketplace

A MERN-stack real-estate marketplace where users browse, list, search, and inquire about properties, with Google OAuth (Firebase) plus JWT/cookie auth, a user dashboard for listings and inquiries, and filtering by price and location. Styled with Tailwind CSS.

A live demo is deployed at https://real-estate-marketplace-v6ch.onrender.com.

Project Status

Portfolio project. The listing, auth, dashboard, and search flows are implemented. Not under active development.

Key Features

  • User registration and login with email/password and Google OAuth (Firebase)
  • Property marketplace: list, search, and explore properties
  • Detailed property views with image galleries and descriptions
  • Inquiry/contact forms for properties
  • User dashboard for managing listings and inquiries
  • Advanced search and filtering by price, location, and other criteria
  • Cookie/JWT-based session auth (Express backend); role/ownership checks on listing mutations

Architecture

Loading architecture diagram…

Diagram source
flowchart TD
    B["Express backend (api/)<br/>port 3000"] -->|/api/auth| AR["auth.routes<br/>signup, signin, google, signout"]
    B -->|/api/user| UR["user.routes<br/>CRUD user + user's listings"]
    B -->|/api/listing| LR["listing.routes<br/>CRUD listings, search"]
    B --> SL["Serves built client<br/>client/dist"]
    AR --> DB[(("MongoDB"))]
    UR --> DB
    LR --> DB
    C["React client (client/)<br/>Vite + Tailwind + Redux Toolkit"] -->|VITE_FIREBASE_API_KEY| FB["Firebase<br/>(Google OAuth)"]
    C -->|fetch /api/*| B

In production, the Express server (port 3000) also serves the built React client from client/dist. In development, run the backend and the Vite dev server separately.

Technology Stack

  • Frontend: React 18, Vite + SWC, Tailwind CSS, Redux Toolkit + redux-persist, react-router-dom, react-icons, swiper, Firebase (Google OAuth web SDK)
  • Backend: Node.js, Express, Mongoose, bcryptjs, jsonwebtoken, cookie-parser, dotenv
  • Database: MongoDB (Atlas or local)
  • Auth: Firebase Google OAuth on the client; cookie/JWT verification on the server (api/utils/verifyUser.js)
  • Deployment: Render (single web service hosting both API and built client)

Repository Structure

.
├── api/
│   ├── index.js          # Express app, mongoose connect, serves client/dist in prod
│   ├── routes/
│   │   ├── auth.route.js     # /api/auth: signup, signin, google, signout
│   │   ├── user.route.js    # /api/user: user CRUD + user's listings
│   │   └── listing.route.js # /api/listing: listing CRUD + search
│   ├── controllers/      # auth/user/listing controllers
│   ├── models/           # user.model, listing.model
│   └── utils/            # verifyUser (JWT), error handling
├── client/
│   ├── src/
│   │   ├── firebase.js   # Firebase web config (uses VITE_FIREBASE_API_KEY)
│   │   ├── redux/        # user slices + redux-persist
│   │   ├── components/ # pages/ # store
│   ├── vite.config.js
│   ├── tailwind.config.js
│   └── package.json
├── package.json          # backend deps + build/dev scripts
└── README.md

Prerequisites

  • Node.js 18+
  • MongoDB (local instance or MongoDB Atlas connection string)
  • A Firebase project with Google sign-in enabled, and its web API key (for the client)

Getting Started

  1. Clone the repository:

    git clone https://github.com/dilrukshax/Real-Estate-Marketplace
    cd Real-Estate-Marketplace
    
  2. Install backend dependencies (the backend package.json lives at the repo root):

    npm install
    
  3. Configure environment variables. Create a .env file in the repo root from .env.example:

    cp .env.example .env
    

    Set MONGODB_URI to your MongoDB connection string and JWT_SECRET to a long random value.

  4. Start the backend:

    npm run dev      # nodemon api/index.js (http://localhost:3000)
    
  5. In a second terminal, install and start the client:

    cd client
    npm install
    npm run dev      # Vite dev server (http://localhost:5173)
    

    Set VITE_FIREBASE_API_KEY in client/.env so Google OAuth works in the Vite dev server.

Environment Variables

Backend (.env at the repo root; see .env.example)

MONGODB_URI=your-mongodb-connection-string
JWT_SECRET=your-jwt-secret
PORT=3000

Client (client/.env)

VITE_FIREBASE_API_KEY=your-firebase-web-api-key

The remaining Firebase web config (authDomain, projectId, appId, measurementId) is present in client/src/firebase.js and is safe to keep in source (Firebase web config is public by design).

API Endpoints

All routes are prefixed as below; the server runs on port 3000.

MethodEndpointNotes
POST/api/auth/signupEmail/password signup
POST/api/auth/signinSign in, sets cookie
POST/api/auth/googleGoogle OAuth login
GET/api/auth/signoutSign out
POST/api/user/update/:idUpdate a user (auth)
DELETE/api/user/delete/:idDelete a user (auth)
GET/api/user/listings/:idList a user's listings (auth)
GET/api/user/:idGet a user (auth)
POST/api/listing/createCreate a listing (auth)
GET/api/listing/getSearch/list listings
GET/api/listing/get/:idGet one listing
POST/api/listing/update/:idUpdate a listing (auth)
DELETE/api/listing/delete/:idDelete a listing (auth)

Database Setup

MongoDB schema is created by Mongoose from api/models/. No migrations to run — Mongoose creates collections on first write.

Running with Docker

There is no Dockerfile or docker-compose file in this repository; the production deployment uses Render.

API Documentation

No OpenAPI/Swagger file is present. The endpoint table above is derived from api/routes/*.js.

Testing

There is no automated test suite (no test script in either package.json); tests were not executed.

Deployment

The deployed demo runs on Render at https://real-estate-marketplace-v6ch.onrender.com. The build runs the root npm run build script, which installs backend and client deps and runs vite build in client/; the Express server then serves client/dist on port 3000. Use Render's npm run start-equivalent (node api/index.js).

Screenshots

Marketplace Property view Dashboard Create listing

Contributing

This is a personal portfolio project. If you'd like to suggest improvements, please open an issue first to discuss the change.

License

Licensed under the MIT License.

Author

Dilan Dilruksha
Software Engineer | Backend & Full-Stack Development
Portfolio: https://dilandilruksha.dev
LinkedIn: https://www.linkedin.com/in/dilan-dilruksha
GitHub: https://github.com/dilrukshax

overview

Property marketplace with secure registration and Google OAuth login, advanced search with filtering and sorting by price and location, and rich property listings with image galleries, detailed descriptions, and contact forms.

approach

Node.js and Express.js REST API with MongoDB and Firebase for auth and storage. React and Tailwind CSS frontend. Advanced search indexes listings by price, location, and other criteria, while image galleries and contact forms complete the end-to-end browsing experience.