Skip to content

Youssefx64/CadArena

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

188 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CadArena

CadArena Logo

AI-Assisted Platform for Civil and Architectural Workflows

License: MIT Python 3.12+ React 18+ FastAPI Docker

Quick Start β€’ Features β€’ Architecture β€’ Documentation


🎯 What is CadArena?

CadArena is an AI-powered architectural design platform that transforms natural language prompts into professional CAD floor plans. Whether you're an architect, engineer, or designer, CadArena streamlines your workflow with intelligent design generation, real-time preview, and compliance checking.

The Problem We Solve

  • ⏱️ Time-consuming manual drafting β†’ AI generates layouts in seconds
  • πŸ”„ Iterative design cycles β†’ Chat-driven modifications
  • πŸ“‹ Building code compliance β†’ Automatic EBC 2023 validation
  • 🌍 Language barriers β†’ Arabic & English support
  • πŸ’Ύ Format compatibility β†’ DXF export for AutoCAD/Revit

✨ Key Features

πŸ—οΈ Core Capabilities

graph LR
    A["Natural Language<br/>Prompt"] -->|AI Parser| B["Design Intent<br/>Classification"]
    B -->|Layout Engine| C["Floor Plan<br/>Generation"]
    C -->|Validator| D["EBC 2023<br/>Compliance Check"]
    D -->|Renderer| E["DXF Export<br/>+ Preview"]
    
    style A fill:#38CBEA,stroke:#71F3FF,color:#000
    style B fill:#38CBEA,stroke:#71F3FF,color:#000
    style C fill:#38CBEA,stroke:#71F3FF,color:#000
    style D fill:#38CBEA,stroke:#71F3FF,color:#000
    style E fill:#38CBEA,stroke:#71F3FF,color:#000
Loading

🎨 Platform Features

Feature Description
AI-Powered Generation Convert prompts to professional floor plans instantly
Real-time Preview See changes as you describe them
DXF Export Compatible with AutoCAD, Revit, and other CAD tools
EBC 2023 Compliance Automatic validation against Egyptian Building Code
Community Q&A Share knowledge and get answers from architects
Multi-language Arabic and English support
Responsive Design Works on desktop, tablet, and mobile
WCAG 2.1 AA Fully accessible to all users

πŸ›οΈ Architecture Overview

System Architecture

graph TB
    subgraph Frontend["🎨 Frontend (React)"]
        UI["React UI<br/>Components"]
        Chat["Chat Interface"]
        Preview["DXF Preview"]
        Community["Community Hub"]
    end
    
    subgraph Backend["βš™οΈ Backend (FastAPI)"]
        Router["Intent Router"]
        Parser["Design Parser"]
        Validator["Layout Validator"]
        Renderer["DXF Renderer"]
    end
    
    subgraph Storage["πŸ’Ύ Storage"]
        DB["SQLite Database"]
        Files["DXF Files"]
    end
    
    UI -->|HTTP/WebSocket| Router
    Chat -->|Prompts| Router
    Router -->|Classify Intent| Parser
    Parser -->|Generate Layout| Validator
    Validator -->|Validate EBC| Renderer
    Renderer -->|Output| Preview
    Renderer -->|Save| Files
    Router -->|User Data| DB
    Community -->|Q&A| DB
    
    style Frontend fill:#61dafb,stroke:#0891b2,color:#000
    style Backend fill:#009688,stroke:#00695c,color:#fff
    style Storage fill:#ff9800,stroke:#e65100,color:#fff
Loading

Data Flow

sequenceDiagram
    participant User
    participant Frontend
    participant Backend
    participant Parser
    participant Validator
    participant Renderer
    
    User->>Frontend: "3 bedroom apartment 100 sqm"
    Frontend->>Backend: POST /design/generate
    Backend->>Parser: Parse intent & extract specs
    Parser->>Parser: Generate layout
    Parser->>Validator: Validate against EBC 2023
    
    alt Compliant
        Validator->>Renderer: Render to DXF
        Renderer->>Frontend: Return preview + file
        Frontend->>User: Display floor plan
    else Non-compliant
        Validator->>Backend: Return violations
        Backend->>Frontend: Suggest modifications
        Frontend->>User: "Adjust room sizes..."
    end
Loading

πŸš€ Quick Start

Prerequisites

  • Python 3.12+
  • Node.js 18+
  • npm or yarn
  • Docker (optional)

Option 1: Local Development

Backend Setup

cd backend

# Setup environment
cp .env.example .env

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run development server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

Frontend Setup

cd frontend

# Install dependencies
npm install

# Start development server
npm start

Access the Application

Option 2: Docker Deployment

# From project root
docker compose -f docker/docker-compose.yml up --build

# Access at http://localhost:8000

πŸ“ Project Structure

CadArena/
β”œβ”€β”€ πŸ“‚ backend/                          # FastAPI application
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ main.py                      # Application entry point
β”‚   β”‚   β”œβ”€β”€ routes/                      # API endpoints
β”‚   β”‚   β”œβ”€β”€ models/                      # Database models
β”‚   β”‚   β”œβ”€β”€ schemas/                     # Pydantic schemas
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   β”œβ”€β”€ design_parser/           # Layout generation engine
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ layout_planner.py    # Spatial planning
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ layout_validator.py  # EBC compliance
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ opening_planner.py   # Door/window placement
β”‚   β”‚   β”‚   β”‚   └── egyptian_building_code.py  # EBC constants
β”‚   β”‚   β”‚   β”œβ”€β”€ intent_router.py         # Intent classification
β”‚   β”‚   β”‚   └── dxf_room_renderer.py     # DXF generation
β”‚   β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”‚   └── design_prompt.py         # System prompts
β”‚   β”‚   └── tests/                       # Test suite
β”‚   β”œβ”€β”€ requirements.txt
β”‚   β”œβ”€β”€ .env.example
β”‚   └── README.md
β”‚
β”œβ”€β”€ πŸ“‚ frontend/                         # React application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/                  # Reusable components
β”‚   β”‚   β”œβ”€β”€ pages/                       # Page components
β”‚   β”‚   β”œβ”€β”€ hooks/                       # Custom hooks
β”‚   β”‚   β”œβ”€β”€ utils/                       # Utilities
β”‚   β”‚   β”œβ”€β”€ styles/                      # Global styles
β”‚   β”‚   β”œβ”€β”€ App.js
β”‚   β”‚   └── index.js
β”‚   β”œβ”€β”€ public/
β”‚   β”‚   β”œβ”€β”€ assets/                      # Logo & images
β”‚   β”‚   └── studio-app/                  # Legacy studio
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ tailwind.config.js
β”‚   β”œβ”€β”€ jest.config.js
β”‚   └── README.md
β”‚
β”œβ”€β”€ πŸ“‚ docker/                           # Container setup
β”‚   β”œβ”€β”€ Dockerfile                       # Multi-stage build
β”‚   β”œβ”€β”€ docker-compose.yml               # Compose config
β”‚   └── README.md
β”‚
β”œβ”€β”€ πŸ“‚ docs/                             # Documentation
β”‚   β”œβ”€β”€ ARCHITECTURE.md
β”‚   β”œβ”€β”€ API.md
β”‚   └── DESIGN.md
β”‚
β”œβ”€β”€ .dockerignore
β”œβ”€β”€ .gitignore
β”œβ”€β”€ LICENSE
└── README.md

πŸ› οΈ Tech Stack

Backend

Technology Version Purpose
Python 3.12+ Core language
FastAPI 0.100+ Web framework
SQLAlchemy 2.0+ ORM
Pydantic 2.0+ Data validation
Uvicorn 0.23+ ASGI server
pytest 7.0+ Testing

Frontend

Technology Version Purpose
React 18+ UI framework
Tailwind CSS 3.0+ Styling
Framer Motion 10+ Animations
Lucide React Latest Icons
Jest 29+ Testing
React Testing Library 14+ Component testing

DevOps

Technology Purpose
Docker Containerization
Docker Compose Orchestration
Git Version control

πŸ§ͺ Testing

Run Tests

# Backend tests
cd backend
pytest app/tests -v

# Frontend tests
cd frontend
npm test

# With coverage
pytest app/tests --cov=app
npm test -- --coverage

Test Coverage

  • Backend: Unit tests, integration tests, API tests
  • Frontend: Component tests, hook tests, utility tests
  • EBC Compliance: 15+ test cases for building code validation

🐳 Docker Deployment

Quick Start

docker compose -f docker/docker-compose.yml up --build

Features

  • βœ… Multi-stage build for optimized images
  • βœ… Non-root user for security
  • βœ… Health checks for monitoring
  • βœ… Volume persistence for data
  • βœ… Network isolation
  • βœ… Environment configuration

See docker/README.md for detailed instructions.


πŸ“š Documentation


πŸ›οΈ Building Code Compliance

CadArena enforces Egyptian Building Code (EBC 2023) standards:

Minimum Room Dimensions

graph LR
    A["Bedroom<br/>9.0 mΒ²<br/>2.75 m min"] -->|EBC Ch.7| B["Bathroom<br/>2.5 mΒ²<br/>1.20 m min"]
    B --> C["Kitchen<br/>4.0 mΒ²<br/>1.80 m min"]
    C --> D["Living<br/>12.0 mΒ²<br/>3.00 m min"]
    D --> E["Corridor<br/>1.20 m width<br/>HARD LIMIT"]
    
    style A fill:#4CAF50,stroke:#2E7D32,color:#fff
    style B fill:#4CAF50,stroke:#2E7D32,color:#fff
    style C fill:#4CAF50,stroke:#2E7D32,color:#fff
    style D fill:#4CAF50,stroke:#2E7D32,color:#fff
    style E fill:#f44336,stroke:#c62828,color:#fff
Loading

Apartment Type Standards

Type Min Area Typical Rooms
Studio 25–45 mΒ² 1 room + kitchen + bathroom
1-Bedroom 45–75 mΒ² 1 bed + living + kitchen + bathroom
2-Bedroom 75–120 mΒ² 2 beds + living + kitchen + bathroom
3-Bedroom 100–160 mΒ² 3 beds + living + kitchen + 2 bathrooms
4-Bedroom 140–220 mΒ² 4 beds + living + kitchen + 2 bathrooms
Villa 200–500 mΒ² Multiple zones + outdoor spaces

Forbidden Adjacencies

graph LR
    A["❌ Bathroom"] -->|Forbidden| B["Kitchen"]
    C["❌ Bedroom"] -->|Forbidden| D["Kitchen"]
    E["❌ Bathroom"] -->|Forbidden| F["Dining"]
    
    style A fill:#f44336,stroke:#c62828,color:#fff
    style B fill:#f44336,stroke:#c62828,color:#fff
    style C fill:#f44336,stroke:#c62828,color:#fff
    style D fill:#f44336,stroke:#c62828,color:#fff
    style E fill:#f44336,stroke:#c62828,color:#fff
    style F fill:#f44336,stroke:#c62828,color:#fff
Loading

🀝 Contributing

We welcome contributions! Here's how:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes and commit (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow existing code style
  • Write tests for new features
  • Update documentation
  • Ensure all tests pass
  • Keep commits atomic and well-documented

πŸ”’ Security

  • Non-root Docker user
  • Environment variable management
  • Input validation and sanitization
  • CORS configuration
  • Rate limiting
  • Security headers

For security concerns: security@cadarena.dev


πŸ“ License

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


πŸ™‹ Support & Community

Getting Help

Connect With Us


πŸŽ‰ Acknowledgments

Built with ❀️ using:


πŸ“Š Project Statistics

  • Backend: Python + FastAPI
  • Frontend: React + Tailwind CSS
  • Tests: 100+ test cases
  • Components: 20+ reusable components
  • API Endpoints: 30+ endpoints
  • Documentation: Comprehensive
  • Accessibility: WCAG 2.1 AA compliant
  • Building Code: EBC 2023 compliant

Made with ❀️ by the CadArena Team

⬆ Back to top

About

CadArena is an innovative web platform that uses Large Language Models (LLMs) to translate natural language text commands directly into CAD drawings (in DXF format). It allows engineers to describe their desired designs (e.g., "Draw a 5-meter-long wall at a 45-degree angle"), and the system instantly generates accurate engineering drawings.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors