Skip to content

alexgherghiceanu/rentAI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RentAI MVP

An end-to-end demo that mixes classic property filtering with AI ranking and AI powered market insights. The repo bundles a NestJS + Prisma backend, a Vite/React frontend, a Dockerized Postgres database, and Python helpers for LLM ranking and POI precompute.

Our problem

We all know how tedious finding the perfect new home in a big city can be. From having to doomscroll through thousands of properties, to fake properties that don't exist, to duplicate announcements and to having to chat with tens of owners/agents. This is where we come in.

Our vision

We provide a filtered, fully personalized and automated experience for our clients. Log into our platform, create an account, and desribe what you are looking for. From your profile description, we run an analysis on the available properties and use our AI-powered reasoning system to find you the properties best tailored for your needs.

Features

Current :

  • Best-match real estate AI-powered lookup
  • AI-powered property price comparison to surrounding similar offers
  • Fully automated chat with agent/owner
  • Smart-filter that determines individual benefits for each property

Upcoming :

  • Address validation for each listing
  • AI powered description of each listing based on the listed images

NOTE : In order to test the functionality locally, on your device you will need Gemini and Grok API keys

Quick start

git clone https://github.com/nchristiann/rentAI.git
cd rentAI/project

# 1) start Postgres
cd infrastructure
docker compose up -d

# 2) configure backend env & deps
cd ../backend
cp .env.example .env      # add your secrets manually afterwards
npm install
npx prisma db push
npx prisma generate

# 3) run backend
npm run start:dev

# 4) configure frontend env & deps
cd ../frontend
cp .env.example .env.local   # optional, only if you need custom base URL
npm install

# 5) run frontend
npm run dev

Backend runs on http://localhost:3000, the Vite dev server defaults to http://localhost:5173 with a proxy so the React app can call /api/... without CORS issues.

Backend stack

Layer Details
Framework NestJS with feature modules (listings, preferences, ai, grok, auth, etc.)
ORM Prisma connected to Postgres via DATABASE_URL
Database Postgres (Docker compose file in infrastructure/docker-compose.yml)
AI helpers Python scripts in backend/src/ai (LLM reranker, POI precompute) + the new GrokClient

Important commands (run inside backend/):

npm install              # install dependencies
npx prisma db push       # sync schema to local DB
npx prisma generate      # regenerate Prisma client
npm run start:dev        # start Nest in watch mode

AI reranking + Grok

The /api/ai/rerank endpoint now auto-detects which provider to use:

  1. If RERANK_LLM=grok or GROK_API_KEY is present, the Nest service calls Grok directly via the new GrokClient.
  2. Otherwise it falls back to Gemini (same payload/prompt, still available if you keep the Python dependency installed).

To enable Grok everywhere, add to backend/.env:

GROK_API_KEY="sk-your-key"
GROK_MODEL="grok-beta"         # optional override
GROK_API_URL="https://api.x.ai/v1/chat/completions"

Restart the backend after editing .env.

Frontend stack

  • Vite + React single-page app (frontend/src).
  • Context providers for auth/preferences, a Listings.jsx page with algorithmic filters, two-step AI flow, and Grok badges.
  • Leaflet map overlay (components/MapOverlay.jsx) for spatial exploration.

Key commands (inside frontend/):

npm install
npm run dev        # start Vite dev server with proxy
npm run build      # production build (requires Node 22.12+ per .nvmrc)

To point the UI at a different backend origin, edit frontend/.env.example (or .env.local) and set VITE_API_BASE_URL.

Database + seed data

  1. docker compose up -d inside infrastructure/ starts Postgres on port 5432 with deterministic seed SQL scripts (listings, sellers, etc.).
  2. Optional extras: run infrastructure/init/add_images_unsplash.sql or seed_listings_extra.sql to load demo imagery and neighborhoods.
  3. For POI metrics, execute python backend/src/ai/precompute_worker_v2.py --force once Postgres is populated.

Use Prisma Studio (npx prisma studio) or plain psql to inspect data.

Troubleshooting cheatsheet

Symptom Likely cause Fix
Frontend overlay says "[AI Fallback]" /api/ai/rerank failed (missing key, timeout) Inspect backend logs; ensure Grok/Gemini env vars are set
Cannot find module '@google/genai' Backend deps not installed npm install in backend/
npm run build warns about Node version Node < 22.12.0 nvm install 22.12.0 && nvm use
404 /api/listings in dev Proxy misconfigured Run frontend via npm run dev (Vite proxy) or set VITE_API_BASE_URL
Empty listings table Seeds not applied docker compose exec postgres psql ... -f infrastructure/init/seed_listings.sql

Contributing

  1. Create a feature branch, keep commits scoped.
  2. Run lint/build/tests for both backend and frontend where relevant.
  3. Ensure new environment variables have sane defaults and are documented here.
  4. Open a PR with a short demo note or screenshots.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 27.2%
  • Python 26.1%
  • TypeScript 23.7%
  • CSS 22.8%
  • Other 0.2%