๐๏ธ 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:
- A PostgreSQL database โ Supabase free tier works perfectly
- An OpenAI API key โ platform.openai.com
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
- Click Sign In โ switch to the Sign Up tab
- Create your account
- Explore the Workspace, Tools, and AI Chatbot
๐ Feature Walkthroughs
๐ Floor Plan Generator
- Open Workspace from the navigation bar
- Set plot Width ร Height (in feet)
- Type requirements:
"3 bedrooms, 2 bathrooms, open kitchen, garage" - Click Generate Floor Plan โ get an interactive SVG layout
- Download as SVG or PNG
๐ฐ Cost Estimator
- Go to Tools โ Estimate Cost
- Enter: area, floors, bedrooms, bathrooms, quality level, location
- Click Calculate & Predict
- Compare formula estimate vs neural network prediction side-by-side
- View full breakdown: structure, finishes, MEP, external works
๐ Report Analyzer
- Go to Tools โ Report Analysis
- Upload a floor plan image (PNG, JPEG, PDF, SVG, WebP)
- AI analyzes rooms, scores layout quality, and flags issues
- Download a professional PDF report
๐ค RAG Architecture Advisor
- Click the chat bubble (bottom-right corner)
- 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?โ
- The RAG engine retrieves the most relevant knowledge chunks and feeds them to GPT-4o-mini
- 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
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -m 'feat: add my feature' - Push to the branch:
git push origin feature/my-feature - 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
Recommended Tools
Try a different keyword or remove a filter.
Install
npx skillfish add muhaddasgujjar/architectxpert