MA

muhaddasgujjar/architectxpert

Developer tools
0ย stars Quality 45 Trend 8

๐Ÿ—๏ธ ArchitectXpert โ€” AI-Powered Architectural Design Platform

Overview

๐Ÿ—๏ธ ArchitectXpert โ€” AI-Powered Architectural Design Platform An intelligent, full-stack platform that helps architects, developers, and homeowners in Pakistan design floor plans, analyze blueprints, estimate construction costs, and get AI-powered advice โ€” all in one sleek interface. ArchitectXpert uses a โ€” each feature runs as an independent Node.js/Python service connected through an Express API Gateway. You'll also need: - A database โ€” Supabase free tier works perfectly - An โ€” platform.openai.com Create a .env file inside service directory: 1. Click โ†’ switch to the tab 2. Create your account 3. Explore the Workspace, Tools, and AI Chatbot 1. Open from the navigation bar 2. Set plot (in feet) 3. Type requirements: "3 bedrooms, 2 bathrooms, open kitchen, garage" 4. Click โ€” get an interactive SVG layout 5. Download as SVG or PNG 1. Go to 2. Enter: area, floors, bedrooms, bathrooms, quality level, location 3. Click 4. Compare vs side-by-side 5.

README

๐Ÿ—๏ธ ArchitectXpert โ€” AI-Powered Architectural Design Platform

An intelligent, full-stack platform that helps architects, developers, and homeowners in Pakistan design floor plans, analyze blueprints, estimate construction costs, and get AI-powered advice โ€” all in one sleek interface.


โœจ Features at a Glance

Feature Description Who Itโ€™s For
๐Ÿ  Floor Plan Generator Generates 2D architectural layouts from plain-English requirements (bedrooms, bathrooms, garage, etc.) as interactive SVG Homeowners & Architects
๐Ÿ’ฐ Cost Estimator Dual-mode: formula-based pricing + a Python neural network (12โ†’16โ†’8โ†’1) trained on Pakistani market data Builders & Project Managers
๐Ÿ“Š Report Analyzer Upload any floor plan image โ†’ AI identifies rooms, scores layout quality, and exports a professional PDF report Architects & Engineers
๐Ÿค– RAG Chatbot GPT-4o-mini powered by a local TF-IDF knowledge retrieval engine โ€” answers architecture questions with curated Pakistani construction data injected into every prompt Everyone
๐Ÿ” Auth Secure registration & login with session-based authentication and PostgreSQL-backed session storage All Users

๐Ÿ›๏ธ System Architecture

ArchitectXpert uses a microservices architecture โ€” each feature runs as an independent Node.js/Python service connected through an Express API Gateway.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      BROWSER  (React 18 + Vite)                      โ”‚
โ”‚                       http://localhost:5000                           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚  HTTP / SSE
                                 โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              FRONTEND SERVER  (Express.js 5 โ€” API Gateway)           โ”‚
โ”‚          Auth (Passport.js) ยท Session Store ยท Proxy Middleware        โ”‚
โ”‚                           Port 5000                                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
        โ”‚              โ”‚              โ”‚              โ”‚
        โ–ผ              โ–ผ              โ–ผ              โ–ผ
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ Floorplanโ”‚  โ”‚  Cost    โ”‚  โ”‚ Report   โ”‚  โ”‚   Floorplan Advisor  โ”‚
  โ”‚Generator โ”‚  โ”‚ Analyzer โ”‚  โ”‚ Analysis โ”‚  โ”‚   (RAG Chatbot)      โ”‚
  โ”‚          โ”‚  โ”‚          โ”‚  โ”‚          โ”‚  โ”‚                      โ”‚
  โ”‚ Port 8000โ”‚  โ”‚ Port 8001โ”‚  โ”‚ Port 8002โ”‚  โ”‚   Port 8003          โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ”‚             โ”‚                    โ”‚
              Python Neural   OpenAI Vision        RAG Engine
              Network (ML)    + K-Means           (TF-IDF) โ†’
              Zameen RF Model Clustering          GPT-4o-mini

๐Ÿง  RAG Pipeline (Floorplan Advisor)

User message
     โ”‚
     โ–ผ
rag_engine.py  โ”€โ”€  TF-IDF retrieval over 200+ architecture knowledge chunks
     โ”‚              (materials, costs, codes, layout, MEP, sustainabilityโ€ฆ)
     โ–ผ
Top-5 relevant chunks injected into GPT-4o-mini system prompt
     โ”‚
     โ–ผ
OpenAI streams response  โ”€โ”€  token-by-token SSE  โ”€โ”€โ–ถ  Chatbot UI
     โ”‚
     โ–ผ
Full response saved to PostgreSQL conversation history

๐Ÿ› ๏ธ Tech Stack

Frontend

Technology Purpose
React 18 UI framework
Vite Dev server & build tool
TypeScript 5.6 Type-safe code
Tailwind CSS Utility-first styling, premium dark theme
Framer Motion Page transitions & micro-animations
Radix UI Accessible headless component primitives
Recharts Data visualization

Backend & Gateway

Technology Purpose
Express.js 5 API server & gateway for all microservices
Passport.js Session-based authentication (local strategy)
Drizzle ORM Type-safe PostgreSQL queries
PostgreSQL Primary database (users, sessions, chat history)
http-proxy-middleware API Gateway routing

AI & Machine Learning

Technology Purpose
RAG Engine (Python, zero deps) TF-IDF keyword retrieval over a curated architecture knowledge base โ€” retrieves top-5 relevant chunks per query
OpenAI GPT-4o-mini Response generation, RAG context-augmented system prompts, streaming via SSE
OpenAI Vision Floor plan image analysis & room detection
Custom Neural Network (Python) Construction cost prediction โ€” architecture 12โ†’16โ†’8โ†’1 with ReLU, trained on 2,000 Pakistani data points
Random Forest (scikit-learn) Zameen.com market valuation model
K-Means Clustering (TypeScript) Floor plan layout classification into 5 categories

๐Ÿ“ Project Structure

architectxpert/
โ”œโ”€โ”€ frontend/                       # Main frontend + API Gateway
โ”‚   โ”œโ”€โ”€ client/src/
โ”‚   โ”‚   โ”œโ”€โ”€ pages/                  # Route-level page components
โ”‚   โ”‚   โ”œโ”€โ”€ components/             # Reusable UI (Chatbot, Workstation, etc.)
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ui/Chatbot.tsx      # RAG chatbot UI โ€” SSE streaming
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/                  # Custom React hooks
โ”‚   โ”‚   โ””โ”€โ”€ lib/                    # Query client, context providers
โ”‚   โ”œโ”€โ”€ server/
โ”‚   โ”‚   โ”œโ”€โ”€ index.ts                # Express server entry point
โ”‚   โ”‚   โ”œโ”€โ”€ routes.ts               # API Gateway proxy routes
โ”‚   โ”‚   โ”œโ”€โ”€ auth.ts                 # Passport.js auth configuration
โ”‚   โ”‚   โ”œโ”€โ”€ db.ts                   # Drizzle DB connection
โ”‚   โ”‚   โ””โ”€โ”€ storage.ts              # User data access layer
โ”‚   โ”œโ”€โ”€ shared/schema.ts            # Drizzle ORM table definitions (shared)
โ”‚   โ”œโ”€โ”€ .env                        # Environment variables
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ floorplan-generation/           # Microservice: SVG floor plan generator
โ”‚   โ”œโ”€โ”€ index.ts                    # Express server (port 8000)
โ”‚   โ”œโ”€โ”€ floorplanSvg.ts             # Room layout engine & SVG renderer
โ”‚   โ””โ”€โ”€ .env
โ”‚
โ”œโ”€โ”€ cost-analyzer/                  # Microservice: Construction cost estimator
โ”‚   โ”œโ”€โ”€ index.ts                    # Express server (port 8001)
โ”‚   โ”œโ”€โ”€ model.ts                    # TypeScript โ†’ Python bridge
โ”‚   โ”œโ”€โ”€ model.py                    # Neural network inference
โ”‚   โ”œโ”€โ”€ market_model.py             # Random Forest market valuation
โ”‚   โ”œโ”€โ”€ weights.json                # Pre-trained neural network weights
โ”‚   โ”œโ”€โ”€ zameen_rf_model.pkl         # Pre-trained RF model
โ”‚   โ””โ”€โ”€ .env
โ”‚
โ”œโ”€โ”€ report-analysis/                # Microservice: AI blueprint analyzer
โ”‚   โ”œโ”€โ”€ index.ts                    # Express server (port 8002)
โ”‚   โ”œโ”€โ”€ clustering.ts               # K-Means clustering
โ”‚   โ”œโ”€โ”€ generatePdf.ts              # PDF report generator (PDFKit)
โ”‚   โ”œโ”€โ”€ analyze_floorplan.py        # Pillow-based image analysis pipeline
โ”‚   โ””โ”€โ”€ .env
โ”‚
โ”œโ”€โ”€ floorplan-advisor/              # Microservice: RAG-powered AI chatbot
โ”‚   โ”œโ”€โ”€ index.ts                    # Express server (port 8003) + RAG orchestration
โ”‚   โ”œโ”€โ”€ rag_engine.py               # TF-IDF retriever + system prompt builder
โ”‚   โ”œโ”€โ”€ rag_knowledge_base.py       # 200+ curated architecture knowledge chunks
โ”‚   โ”œโ”€โ”€ architecture_advisor.py     # Rule-based project analysis engine
โ”‚   โ”œโ”€โ”€ db.ts                       # Drizzle DB (conversation history)
โ”‚   โ””โ”€โ”€ .env
โ”‚
โ”œโ”€โ”€ package.json                    # npm workspaces root
โ”œโ”€โ”€ requirements.txt                # Python dependencies
โ””โ”€โ”€ .gitignore

๐Ÿš€ Getting Started

Prerequisites

Tool Minimum Version Download
Node.js v20 nodejs.org
Python 3.10 python.org
Git Any git-scm.com

Youโ€™ll also need:


Step 1 โ€” Clone

git clone https://github.com/muhaddasgujjar/architectxpert.git
cd architectxpert

Step 2 โ€” Install All Dependencies

# Install all Node.js workspace dependencies at once
npm install

# Install Python dependencies
pip install -r requirements.txt

Step 3 โ€” Configure Environment Variables

Create a .env file inside each service directory:

frontend/.env

DATABASE_URL=postgresql://user:password@host:5432/architectxpert
SESSION_SECRET=any-random-secret-string
AI_INTEGRATIONS_OPENAI_API_KEY=sk-proj-your-openai-key
FLOORPLAN_SERVICE_URL=http://localhost:8000
COST_SERVICE_URL=http://localhost:8001
REPORT_SERVICE_URL=http://localhost:8002
ADVISOR_SERVICE_URL=http://localhost:8003

floorplan-generation/.env

PORT=8000

cost-analyzer/.env

PORT=8001

report-analysis/.env

PORT=8002
AI_INTEGRATIONS_OPENAI_API_KEY=sk-proj-your-openai-key

floorplan-advisor/.env

PORT=8003
DATABASE_URL=postgresql://user:password@host:5432/architectxpert
AI_INTEGRATIONS_OPENAI_API_KEY=sk-proj-your-openai-key

Step 4 โ€” Push Database Schema

cd frontend
npx drizzle-kit push
cd ..

Step 5 โ€” Start All Services

Open 5 terminals and run one command in each:

# Terminal 1 โ€” Floor Plan Generator  (port 8000)
cd floorplan-generation
npx tsx --env-file=.env index.ts

# Terminal 2 โ€” Cost Analyzer  (port 8001)
cd cost-analyzer
npx tsx --env-file=.env index.ts

# Terminal 3 โ€” Report Analysis  (port 8002)
cd report-analysis
npx tsx --env-file=.env index.ts

# Terminal 4 โ€” Floorplan Advisor / RAG Chatbot  (port 8003)
cd floorplan-advisor
node --import tsx/esm --env-file=.env index.ts

# Terminal 5 โ€” Frontend + API Gateway  (port 5000)
cd frontend
# Windows:
set NODE_ENV=development && npx tsx --env-file=.env server/index.ts
# Linux / macOS:
NODE_ENV=development npx tsx --env-file=.env server/index.ts

Step 6 โ€” Open the App

Visit http://localhost:5000

  1. Click Sign In โ†’ switch to the Sign Up tab
  2. Create your account
  3. Explore the Workspace, Tools, and AI Chatbot

๐Ÿ“– Feature Walkthroughs

๐Ÿ  Floor Plan Generator

  1. Open Workspace from the navigation bar
  2. Set plot Width ร— Height (in feet)
  3. Type requirements: "3 bedrooms, 2 bathrooms, open kitchen, garage"
  4. Click Generate Floor Plan โ€” get an interactive SVG layout
  5. Download as SVG or PNG

๐Ÿ’ฐ Cost Estimator

  1. Go to Tools โ†’ Estimate Cost
  2. Enter: area, floors, bedrooms, bathrooms, quality level, location
  3. Click Calculate & Predict
  4. Compare formula estimate vs neural network prediction side-by-side
  5. View full breakdown: structure, finishes, MEP, external works

๐Ÿ“Š Report Analyzer

  1. Go to Tools โ†’ Report Analysis
  2. Upload a floor plan image (PNG, JPEG, PDF, SVG, WebP)
  3. AI analyzes rooms, scores layout quality, and flags issues
  4. Download a professional PDF report

๐Ÿค– RAG Architecture Advisor

  1. Click the chat bubble (bottom-right corner)
  2. Ask anything about architecture, e.g.:
    • โ€œWhat wall materials should I use in Lahore?โ€
    • โ€œHow do I estimate construction costs in Pakistan?โ€
    • โ€œWhat are the building code setback requirements?โ€
  3. The RAG engine retrieves the most relevant knowledge chunks and feeds them to GPT-4o-mini
  4. Get a detailed, Pakistan-specific, streamed response

๐Ÿ”Œ API Reference

All requests go through the gateway at http://localhost:5000:

Auth

Method Endpoint Description
POST /api/auth/register Register new user
POST /api/auth/login Login
POST /api/auth/logout Logout
GET /api/auth/user Get current session user

Floor Plan Generation

Method Endpoint Description
POST /api/tools/generate-floorplan Generate SVG floor plan

Cost Analysis

Method Endpoint Description
POST /api/tools/predict-cost Neural network cost prediction

Report Analysis

Method Endpoint Description
POST /api/tools/analyze-floorplan Upload & analyze floor plan image
POST /api/tools/generate-report-pdf Export PDF report

RAG Chatbot & Advisor

Method Endpoint Description
GET /api/chat/conversations List userโ€™s conversations
POST /api/chat/conversations Create a new conversation
DELETE /api/chat/conversations/:id Delete a conversation
GET /api/chat/conversations/:id/messages Fetch message history
POST /api/chat/conversations/:id/messages Send message โ†’ RAG retrieval โ†’ GPT-4o-mini stream (SSE)
POST /api/tools/architecture-advisor Rule-based project analysis (JSON)

๐Ÿ—„๏ธ Database Schema

Table Columns Purpose
users id, username, password (hashed) User accounts
conversations id, userId, title, createdAt Chat sessions
messages id, conversationId, role, content, createdAt Chat messages
user_sessions Auto-managed Express session storage

๐Ÿงช Test Individual Services

# Floor Plan Generator
curl -X POST http://localhost:8000/api/tools/generate-floorplan \
  -H "Content-Type: application/json" \
  -d '{"bedrooms":3,"bathrooms":2,"totalArea":1200,"floors":1,"style":"Modern"}'

# Cost Analyzer
curl -X POST http://localhost:8001/api/tools/predict-cost \
  -H "Content-Type: application/json" \
  -d '{"area":1200,"floors":1,"quality":"standard","bedrooms":3,"bathrooms":2,"hasGarage":true,"locationTier":2}'

# RAG Knowledge Retrieval (direct Python test)
python floorplan-advisor/rag_engine.py '{"query":"What foundation should I use in Karachi?","history":[]}'

๐Ÿค Contributing

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

๐Ÿ“„ License

This project is licensed under the MIT License. See LICENSE for details.


๐Ÿ‘จโ€๐Ÿ’ป Author

Muhaddas Gujjar โ€” GitHub


Built with โค๏ธ for Pakistanโ€™s architectural community

View this README on GitHub

Recommended Tools

Try a different keyword or remove a filter.

Install

npx skillfish add muhaddasgujjar/architectxpert