Skip to content

About

Industrial 3D Warehouse Digital Twin & Spatial WMS layout builder built with Next.js 16, React 19, Three.js, R3F, Zustand, and Neon PostgreSQL.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

4 Commits

Folders and files

Repository files navigation

3D Warehouse Digital Twin & Spatial WMS

Next.js 16 React 19 Three.js React Three Fiber TypeScript Zustand Drizzle ORM Neon Postgres Tailwind CSS License: MIT Live Demo

A high-performance 3D Warehouse Layout Builder & Spatial Warehouse Management System (WMS) built for industrial logistics and supply chain digital twins. Design warehouse floors, manipulate procedural racking structures, simulate automated multi-vehicle fleet picking routes, and analyze inventory velocity heatmaps in real-time WebGL.

πŸ”— Live Production Demo: https://3d-warehouse-nu.vercel.app

Tip

Demo Login Credentials:

  • Administrator: admin@warehouse.local / admin12345
  • Warehouse Planner: editor@warehouse.local / editor12345
  • Auditor (Read-Only): viewer@warehouse.local / viewer12345

3D Warehouse Interactive Editor


✨ Key Features

  • Interactive 3D WebGL Canvas: 60 FPS hardware-accelerated rendering powered by Three.js and React Three Fiber with perspective, top-down 2D orthographic, and architectural projection views.
  • Procedural Racking & Structural Elements: Dynamically generate and customize selective pallet racks, cantilever racks, drive-in systems, perimeter walls, dock doors, structural columns, and staging zones.
  • Multi-Floor & Mezzanine Operations: Multi-tier mezzanine floor support, vertical conveyors, freight lifts, spiral chutes, and active level floor-slicing isolation modes (ISOLATE, GHOST_UPPER).
  • TSP Route Optimization & Multi-Agent Fleet Simulation: Dynamic Travelling Salesperson Problem (2-opt TSP) route calculation, multi-vehicle dispatching (Forklifts, AGVs, AMR Carts), and corridor traffic collision avoidance.
  • Enterprise WMS & Spatial Analytics: Real-time bin occupancy tracking (Aisle-Bay-Level-Slot), max load capacity checking ($1{,}000\text{ kg} / \text{slot}$), ABC velocity heatmaps, and REST API routes for external ERP/WMS synchronization.
  • CAD-Grade Editor & Command Pattern: Marquee box selection, AABB collision detection, face-to-face snapping, grid alignment ($0.5\text{ m} / 1.0\text{ m}$), and infinite transactional Undo / Redo history.
  • Role-Based Access Control (RBAC): Secure HTTP-Only session authentication with tiered roles (ADMIN, EDITOR, VIEWER) and audit trail tracking.

πŸ–ΌοΈ Application Showcase

Facility Dashboard Spatial WMS 3D Editor
Dashboard Preview 3D Editor Preview

πŸ› οΈ Tech Stack

Layer Technologies
Core Framework Next.js 16.3 (App Router, Turbopack), React 19.2, TypeScript
3D Graphics & Math Three.js, React Three Fiber (@react-three/fiber, @react-three/drei)
State Management Zustand 5 (Modular state slices + Transactional Command Pattern)
Styling & UI Tailwind CSS 3.4, Lucide React Icons
Database & ORM Neon Serverless PostgreSQL, Drizzle ORM 0.45
Validation & Security Zod (Runtime schema validation), Bcrypt.js, HTTP-Only Cookie Sessions

πŸš€ Getting Started

1. Prerequisites

  • Node.js: v20.0.0 or higher
  • npm (or pnpm / yarn)
  • PostgreSQL Database: Neon Serverless Postgres or a local PostgreSQL instance

2. Installation

# Clone the repository
git clone https://github.com/twiners212/3d-warehouse.git
cd 3d-warehouse

# Install dependencies
npm install

3. Environment Configuration

Copy the template environment file and provide your database credentials:

cp .env.example .env

Inside .env:

DATABASE_URL="postgresql://user:password@ep-sample.us-east-2.aws.neon.tech/neondb?sslmode=require"
WMS_API_KEY="your-wms-secret-key"

4. Database Migration & Seeding

# Apply Drizzle database migrations
npm run db:migrate

# Seed default test users (Admin, Editor, Viewer)
npm run db:seed

5. Running the Application

# Start local development server (with Turbopack)
npm run dev

Open http://localhost:3000 in your browser.

Default seed credentials:

  • Admin: admin@warehouse.local / admin12345
  • Editor: editor@warehouse.local / editor12345
  • Viewer: viewer@warehouse.local / viewer12345

6. Production Build & Deployment

# Run typechecking
npm run typecheck

# Build optimized production bundle
npm run build

# Start production server
npm run start

Deploying to Vercel

  1. Import repository on Vercel.
  2. Configure Environment Variables in project settings:
    • DATABASE_URL: Your production Neon PostgreSQL connection string.
    • WMS_API_KEY: Secret Bearer token for external WMS integrations.
  3. Deploy! Next.js 16 App Router and Server Actions will be configured automatically.

πŸ“ Project Structure

3d-warehouse/
β”œβ”€β”€ drizzle/              # Drizzle ORM migration files & schema snapshots
β”œβ”€β”€ docs/                 # Detailed technical specifications & manuals
β”‚   β”œβ”€β”€ assets/           # High-resolution application screenshots
β”‚   β”œβ”€β”€ architecture.md   # Architectural design, data flow & rendering pipeline
β”‚   β”œβ”€β”€ data-model.md     # Relational schema & Drizzle ORM tables
β”‚   β”œβ”€β”€ spatial-model.md  # 3D coordinate mathematics & raycasting
β”‚   └── developer.md      # Engineering guidelines & test suite matrix
β”œβ”€β”€ public/               # Static assets & icons
β”œβ”€β”€ scripts/              # Automated verification & smoke test runners
└── src/
    β”œβ”€β”€ app/              # Next.js App Router (pages, layouts, Server Actions, API routes)
    β”‚   β”œβ”€β”€ actions/      # Next.js Server Actions (blueprint persistence & RBAC)
    β”‚   β”œβ”€β”€ api/wms/      # REST API endpoints for external WMS integration
    β”‚   β”œβ”€β”€ editor/[id]/  # Interactive 3D layout canvas route
    β”‚   └── login/        # Session authentication page
    β”œβ”€β”€ components/
    β”‚   β”œβ”€β”€ canvas/       # 3D R3F components (WarehouseCanvas, ProceduralRack, ZoneFootprint)
    β”‚   β”œβ”€β”€ editor/       # 2D editor HUD, properties inspector, toolbar, outliner
    β”‚   β”œβ”€β”€ admin/        # User management & role administration
    β”‚   └── common/       # Shared UI primitives & settings
    β”œβ”€β”€ engine/           # Decoupled algorithmic engine
    β”‚   β”œβ”€β”€ commands/     # Command pattern implementations (Undo/Redo)
    β”‚   β”œβ”€β”€ procedural/   # Procedural rack, bin, and zone geometry generators
    β”‚   β”œβ”€β”€ routing/      # Spatial A* pathfinding & TSP 2-opt picking optimizer
    β”‚   β”œβ”€β”€ slotting/     # ABC velocity slotting optimizer
    β”‚   └── spatial/      # AABB collision detection & grid snapping
    β”œβ”€β”€ hooks/            # Custom React hooks (drag controls, shortcuts, camera)
    β”œβ”€β”€ lib/              # Auth session logic, Zod validation schemas, i18n
    β”œβ”€β”€ stores/           # Modular Zustand state slices (blueprint, picking, view)
    β”œβ”€β”€ styles/           # Global styles and Tailwind design tokens
    └── types/            # TypeScript type and interface definitions

πŸ§ͺ Testing & Verification

The project includes 26 automated verification test suites covering spatial mathematics, state slice mutations, routing algorithms, and database persistence:

# Run full verification test suite
npx tsx scripts/verification-test-suite.ts

# Run picking route & TSP optimization tests
npm run test:picking

# Run multi-floor & vertical connector tests
npm run test:multi-floor-ops

# Run fleet multi-agent simulation tests
npm run test:fleet

# Run authentication & RBAC persistence tests
npm run test:rbac

πŸ“„ License

Distributed under the MIT License. See LICENSE for more information.

About

Industrial 3D Warehouse Digital Twin & Spatial WMS layout builder built with Next.js 16, React 19, Three.js, R3F, Zustand, and Neon PostgreSQL.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages