View on GitHub

Twindeo: Industrial Digital Twin Platform

Federated 3D WebGL digital twin platform with real-time telemetry, clash detection, and spatial analytics

Twindeo™ — Industrial Digital Twin Platform

Full implementation of the Core 3D Engine & Architecture Blueprint handoff doc: a React Three Fiber viewer backed by an Express + PostgreSQL API, using the Federated CAD Model strategy (a static .glb shell + independently loaded dynamic asset .glb files).

Project layout

twindeo/
├── docker-compose.yml      # Postgres
├── db/init.sql             # schema + seed data
├── backend/                # Express API
│   └── src/
│       ├── index.js
│       ├── db/pool.js
│       └── routes/assets.js
└── frontend/                # Vite + React + R3F
    └── src/
        ├── components/
        │   ├── TwindeoEditor.jsx      # the "Brain" — hash map state
        │   ├── ui/                    # HTML sidebars
        │   └── canvas/                # WebGL: SceneManager, FacilityShell,
        │                              #         DraggableMachine, MeasurementLaser
        ├── hooks/clashDetection.js    # AABB collision math
        └── api/assetsApi.js          # fetch wrappers for the Express API

Running it

1. Database

docker compose up -d

This starts Postgres on localhost:5432 and runs db/init.sql automatically on first boot (creates the assets table + seeds 4 example assets). If you’ve run it before and changed init.sql, wipe the volume first: docker compose down -v.

2. Backend

cd backend
cp .env.example .env     # adjust DATABASE_URL if needed
npm install
npm run dev               # http://localhost:4000

Check it’s alive: curl http://localhost:4000/api/health

3. Frontend

cd frontend
cp .env.example .env
npm install
npm run dev               # http://localhost:5173

4. Add your .glb files

See frontend/public/models/README.md — drop in shell.glb, pump.glb, lathe.glb, tank.glb (or update the paths in db/init.sql / SceneManager.jsx to match your real filenames).

What’s implemented from the handoff doc

Known gaps / next steps