Skip to content

Dealer-09/Chain-Torque

Repository files navigation

ChainTorque

Web3 Engineering Platform with Browser-Based CAD Editor

ChainTorque revolutionizes 3D model platforms by combining blockchain technology, professional CAD tools, and real-time 3D interaction to create a secure, transparent, and intelligent platform for engineering assets.

๐Ÿš€ What is ChainTorque?

ChainTorque is a comprehensive Web3 platform that solves critical problems in the 3D engineering space:

  • ๐Ÿ›ก๏ธ NFT-Based Licensing: Blockchain-verified ownership and licensing
  • ๐ŸŽฎ Interactive 3D Previews: Inspect models before purchasing
  • ๐ŸŽจ Browser-Based CAD Editor: Professional 2D sketching + 3D modeling with OpenCascade.js
  • ๐ŸŒ Decentralized Storage: IPFS integration via Lighthouse for censorship resistance
  • ๐Ÿ’ฐ Direct Creator Payments: 97.5% to seller, 2.5% platform fee via smart contracts

๐Ÿ—๏ธ Project Structure

ChainTorque/
โ”œโ”€โ”€ Landing Page (Frontend)/     # Vite + React marketing site (Port 5000)
โ”œโ”€โ”€ Marketplace (Frontend)/      # Vite + React + TypeScript NFT marketplace (Port 8080)
โ”œโ”€โ”€ CAD (Frontend)/              # Vite + React CAD editor with OpenCascade.js (Port 3001)
โ”œโ”€โ”€ ChainTorque_Native/          # Android app - Kotlin + Jetpack Compose
โ””โ”€โ”€ backend/                     # Express API + Hardhat Smart Contracts (Port 5001)

๐Ÿ› ๏ธ Technologies Used

Layer Technologies
Runtime Bun (3x faster than Node.js)
Frontend React 18, Vite, Three.js, @react-three/fiber, Tailwind CSS
CAD Engine OpenCascade.js (WASM), Three.js, Custom 2D Canvas
Android Kotlin, Jetpack Compose, Hilt DI, Reown AppKit (WalletConnect)
Backend Express, MongoDB, IPFS (Lighthouse SDK)
Blockchain Solidity (ERC-721), Hardhat, Ethereum Sepolia, ethers.js
Auth Clerk (Web3 wallet + social login)
Deployment Render.com (4 services)

๐ŸŽจ CAD Editor Features

The browser-based CAD editor (CAD (Frontend)/) provides:

2D Sketching Tools

  • Line Tool (L): Draw connected line segments
  • Polygon Tool (P): Create closed polygon shapes
  • Circle Tool (C): Draw circles with center + radius
  • Grid Snap: Automatic alignment to grid
  • Undo/Redo: Backspace to undo, full history support

3D Modeling

  • Sketch Extrusion: Convert 2D sketches to 3D solids via OpenCascade.js
  • Real-time Preview: Three.js powered 3D viewport with orbit controls
  • View Controls: Front, Top, Right, Isometric camera presets
  • 2D/3D Toggle: Seamless switching between sketch and model modes

CAD Kernel

  • OpenCascade.js: Industry-standard BREP geometry kernel (WASM)
  • Primitives: Box, Cylinder, Sphere creation
  • Boolean Operations: Union, Cut, Intersection
  • Memory Managed: Proper cleanup of WASM objects

Keyboard Shortcuts

Key Action
L Line tool
P Polygon tool
C Circle tool
I Toggle 3D view
Enter Save sketch
ESC Cancel/Back to 2D
Backspace Undo last point
Arrow Keys Pan canvas
Scroll Zoom

๐Ÿš€ Quick Start

Prerequisites

Install Bun - a fast all-in-one JavaScript runtime:

# Windows (PowerShell)
powershell -c "irm bun.sh/install.ps1|iex"

# macOS/Linux
curl -fsSL https://bun.sh/install | bash

Installation & Running

# Clone and install
git clone https://github.com/Dealer-09/Chain-Torque.git
cd Chain-Torque
bun install

# Start all services (Landing, Marketplace, Backend, CAD)
bun run dev

# Or run individual services
bun run dev:landing      # Landing page (Port 5000)
bun run dev:marketplace  # Marketplace (Port 8080)
bun run dev:backend      # Backend API (Port 5001)
bun run dev:cad          # CAD editor (Port 3001)

๐Ÿ—บ๏ธ Development Status

โœ… Completed

  • Bun monorepo with npm workspaces
  • 3D marketplace with NFT minting & purchasing
  • Decentralized purchase flow (MetaMask โ†’ Smart Contract โ†’ IPFS)
  • ETH payments: 97.5% to seller, 2.5% platform fee
  • Smart contract deployed on Sepolia testnet
  • IPFS storage via Lighthouse SDK
  • Search & category filtering
  • Purchased items with download links
  • Dashboard with user stats
  • Clerk authentication integration
  • CAD Editor with OpenCascade.js
    • 2D Canvas with Line, Polygon, Circle tools
    • Grid snap and pan/zoom controls
    • Sketch extrusion to 3D solids
    • Three.js 3D viewport with camera controls
    • Feature Tree with visibility/delete
    • Production build optimized
  • Render.com deployment (all 4 services)
  • Native Android App (ChainTorque_Native)
    • Jetpack Compose UI with Material 3
    • WalletConnect via Reown AppKit
    • NFT marketplace browsing & purchasing
    • User profiles and transaction history

๐Ÿ”„ In Progress

  • AI Assistant "Torquy" for CAD commands
  • Relist/resale functionality
  • Save/Load CAD projects

๐Ÿ“‹ Planned

  • STL/GLB export from CAD editor
  • User profile pages
  • Multi-chain support (Polygon)
  • AR/VR model preview

๐Ÿ—๏ธ Architecture

graph TD
    subgraph Frontend
        LP[Landing Page<br/>Vite + React]
        MP[Marketplace<br/>Vite + React + TS]
        CAD[CAD Editor<br/>Vite + React + Three.js]
    end
    
    subgraph Backend
        API[Express API<br/>Port 5001]
        SC[Smart Contract<br/>Sepolia]
        IPFS[Lighthouse<br/>IPFS Storage]
        DB[(MongoDB)]
    end
    
    LP --> API
    MP --> API
    MP --> SC
    MP --> IPFS
    CAD --> API
    API --> DB
    API --> IPFS
Loading

๐Ÿ”’ Environment Variables

Create .env in the project root:

# MongoDB
MONGODB_URI=mongodb+srv://...

# Ethereum
RPC_URL=https://sepolia.infura.io/v3/...
PRIVATE_KEY=your_wallet_private_key
CONTRACT_ADDRESS=0x...

# Clerk Auth
VITE_CLERK_PUBLISHABLE_KEY=pk_...
CLERK_SECRET_KEY=sk_...

# IPFS (Lighthouse)
LIGHTHOUSE_API_KEY=...

๐Ÿค Contributing

We welcome contributions! Areas of focus:

  • ๐ŸŽจ CAD Features: Enhance 2D/3D tools, add new primitives
  • ๐Ÿค– AI Integration: Implement Torquy AI assistant
  • ๐Ÿ”ง Blockchain: Smart contract optimization, multi-chain
  • ๐Ÿ“ Documentation: API docs, tutorials

๐Ÿ“„ License

MIT License - see LICENSE for details.


๐Ÿ”—โš™๏ธ Building the Future of Engineering, One Block at a Time

Get Started CAD Editor Contribute

About

Revolutionary D2C Cad Service: Featuring Web3 Marketplace, In-browser CAD editor & CAD Completion AI Copilot

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5