An AI-powered system that analyzes 2D architectural floor plans using computer vision, generates 3D building models, recommends construction materials using a cost-vs-strength formula, and secures reports on the Stellar blockchain.
- Floor Plan Analysis — Upload a 2D floor plan image (PNG/JPG). OpenCV detects walls and rooms automatically.
- 3D Visualization — Walls are extruded to 3 meters high and rendered interactively using Three.js with full orbit controls.
- Material Recommendations — An LLM (or rule-based formula) ranks construction materials (Red Brick, RCC, AAC Block, Structural Steel) using:
Score = 0.35 × Strength + 0.30 × (1 - NormCost) + 0.20 × Durability + 0.15 × ClimateFit - Stellar Blockchain Integration — Every report is SHA-256 hashed and stored on the Stellar testnet for immutable proof of authenticity.
- Report History — All analyses are persisted in SQLite and viewable with blockchain verification links.
structural-ai-system/
├── artifacts/
│ ├── structural-ai/ # React + Vite frontend
│ │ ├── src/
│ │ │ ├── components/
│ │ │ │ ├── 3d/ # Three.js 3D floor plan viewer
│ │ │ │ ├── layout/ # App layout, sidebar
│ │ │ │ └── ui/ # Upload, material cards, blockchain badge
│ │ │ ├── pages/ # Dashboard, Reports, ReportDetail
│ │ │ ├── App.tsx
│ │ │ └── index.css
│ │ └── package.json
│ │
│ ├── structural-ai-backend/ # Python FastAPI backend
│ │ ├── main.py # FastAPI entry point
│ │ ├── requirements.txt
│ │ └── app/
│ │ ├── routes/
│ │ │ ├── analysis.py # POST /api/analyze
│ │ │ └── reports.py # GET /api/reports, GET /api/reports/{id}
│ │ ├── services/
│ │ │ ├── floor_plan_analyzer.py # OpenCV wall/room detection
│ │ │ ├── material_recommender.py # LLM + rule-based scoring
│ │ │ └── stellar_blockchain.py # Stellar SDK integration
│ │ └── database.py # SQLite persistence
│ │
│ └── api-server/ # Express proxy server (TypeScript)
│ └── src/app.ts # Routes /api/analyze → Python backend
│
└── lib/
├── api-spec/openapi.yaml # OpenAPI contract (source of truth)
├── api-client-react/ # Generated React Query hooks
└── api-zod/ # Generated Zod schemas
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/healthz |
Health check |
POST |
/api/analyze |
Upload floor plan image for analysis |
GET |
/api/reports |
List all analysis reports |
GET |
/api/reports/{id} |
Get a specific report |
Request (multipart/form-data):
file— Floor plan image (PNG/JPG, max 20MB)budget—low,medium, orhigh(default:medium)location— Geographic/climate description (e.g.,coastal,seismic zone,cold climate)
Response:
{
"id": 1,
"imageWidth": 800,
"imageHeight": 600,
"walls": [{"x1": 0.5, "y1": 0.5, "x2": 10.5, "y2": 0.5, "thickness": 0.2, "length": 10.0}],
"rooms": [{"id": 1, "area": 25.0, "label": "Living Room", ...}],
"totalWallLength": 48.5,
"totalArea": 85.0,
"recommendations": [
{
"material": "Red Brick",
"costScore": 85.0,
"strengthScore": 42.0,
"overallScore": 72.5,
"estimatedCostPerSqM": 1200,
"pros": ["..."],
"cons": ["..."],
"reason": "..."
}
],
"model3d": {"walls": [...], "wallHeight": 3.0, "floorWidth": 10.0, "floorHeight": 7.5, "scale": 0.0125},
"blockchainHash": "a3f8d2...",
"blockchainTxId": "b7c9e1...",
"stellarNetwork": "testnet-simulated",
"createdAt": "2026-03-29T10:00:00",
"summary": "Analyzed 800x600px floor plan. Detected 12 walls, 4 rooms..."
}Score = w_strength × S_norm + w_cost × (1 - C_norm) + w_durability × D_norm + w_climate × Climate
Where:
w_strength = 0.35 (combined compressive + tensile strength, normalized 0–1)
w_cost = 0.30 (adjusted by budget level: low=1.5×, medium=1.0×, high=0.6×)
w_durability = 0.20 (service life / 100 years)
w_climate = 0.15 (bonus for seismic/coastal/cold climate match)
| Material | Compressive Strength | Tensile Strength | Cost (INR/m²) | Durability |
|---|---|---|---|---|
| Red Brick | 7.5 MPa | 0.5 MPa | ₹1,200 | 80 years |
| RCC | 25.0 MPa | 3.5 MPa | ₹2,200 | 100 years |
| AAC Block | 4.0 MPa | 0.8 MPa | ₹1,600 | 70 years |
| Structural Steel | 250 MPa | 400 MPa | ₹3,500 | 60 years |
Each analysis report is:
- Serialized to a canonical JSON object (wall count, area, top material, timestamp)
- SHA-256 hashed to produce a 64-character hex digest
- Stored as a memo on the Stellar testnet (via Stellar SDK or simulation)
- Viewable on Stellar Expert
| Layer | Technology |
|---|---|
| Frontend | React 18, Vite, TypeScript, Tailwind CSS |
| 3D Rendering | Three.js, @react-three/fiber, @react-three/drei |
| Charts | Recharts |
| Backend | Python 3.11, FastAPI, Uvicorn |
| Computer Vision | OpenCV (opencv-python-headless) |
| AI/LLM | Rule-based scoring (OpenAI optional via OPENAI_API_KEY) |
| Blockchain | Stellar SDK (testnet) |
| Database | SQLite (via Python sqlite3) |
| API Proxy | Express 5 + http-proxy-middleware |
| API Contract | OpenAPI 3.1 + Orval codegen |
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 8000 |
STELLAR_NETWORK |
testnet or mainnet |
testnet |
OPENAI_API_KEY |
Optional — enables LLM recommendations | None (rule-based fallback) |
# Start everything
pnpm --filter @workspace/structural-ai run dev # Frontend (React)
cd artifacts/structural-ai-backend && python main.py # Python API
# Run codegen after OpenAPI spec changes
pnpm --filter @workspace/api-spec run codegen