npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cristiancosano/pallet-builder

v0.1.4

Published

React Three Fiber component library for 3D pallet visualization and logistics simulation

Readme

📦 @cristiancosano/pallet-builder

Modular system for 3D logistics visualization based on React and React Three Fiber.

🎯 Description

React component library that allows building interactive 3D scenes to visualize logistics operations such as warehouses, pallets, boxes, and shipping containers.

✨ Features

  • 🧱 Modular System: Clean architecture with separation between core logic and visualization
  • 🎨 Declarative Components: Simple API based on React components
  • 📐 Industry Standards: Support for EURO, ISO, and custom pallets
  • 🔄 Real-time: Interactive 3D visualization with camera controls
  • 📊 Validations: Business logic to validate dimensions, weights, and occupancy
  • 🎯 Agnostic: Core in pure TypeScript without dependencies on visualization frameworks

🚀 Quick Start

Installation

pnpm install

Development

pnpm dev

Open http://localhost:5173 to view the demo.

📖 Basic Usage

import { Warehouse, Pallet, Box } from '@cristiancosano/pallet-builder';

function MyLogisticsApp() {
  return (
    <Warehouse width={5000} depth={5000} showGrid>
      
      <Pallet id="pallet-A" position={[0, 0, 0]} type="EURO">
        <Box 
          dimensions={[400, 300, 200]} 
          position={[0, 0, 0]} 
          color="orange" 
          label="Box 1"
        />
      </Pallet>

      <Pallet id="pallet-B" position={[1500, 0, 0]} type="ISO">
        <Box 
          dimensions={[500, 400, 300]} 
          position={[0, 0, 0]} 
          color="blue" 
        />
      </Pallet>

    </Warehouse>
  );
}

🏗️ Architecture

Core (Pure TypeScript)

Framework-agnostic business logic:

import { BoxEntity, PalletEntity, ContainerEntity } from '@cristiancosano/pallet-builder';

// Create a pallet with validations
const pallet = new PalletEntity({
  id: 'pallet-1',
  type: 'EURO',
  position: [0, 0, 0],
  boxes: [
    {
      id: 'box-1',
      dimensions: [400, 300, 200], // mm
      position: [0, 0, 0],
      weight: 25, // kg
    }
  ]
});

// Validate configuration
const validation = pallet.validate();
console.log('Total weight:', pallet.getTotalWeight(), 'kg');
console.log('Occupancy:', pallet.getOccupancyRate(), '%');

Components (React + R3F)

3D visual components built with React Three Fiber:

  • <Warehouse>: Main container of the 3D scene
  • <Pallet>: Represents a pallet with support for EURO, ISO, or custom
  • <Box>: Box/package positionable inside a pallet
  • <CameraControls>: Camera controls (orbit, first person, etc.)

📐 Pallet Standards

EUR-Pallet (EURO)

  • Dimensions: 800 x 1200 x 144 mm
  • Maximum weight: 1500 kg
  • Maximum height: 2200 mm

ISO Pallet (ISO)

  • Dimensions: 1000 x 1200 x 144 mm
  • Maximum weight: 2000 kg
  • Maximum height: 2200 mm

Custom

  • Customizable dimensions
  • Flexible configuration

🎨 Available Components

Warehouse

Main container that creates the 3D scene with lighting and controls.

<Warehouse 
  width={5000}      // mm
  depth={5000}      // mm
  height={3000}     // mm (optional)
  showGrid={true}   // Show ground grid
  backgroundColor="#f0f0f0"
>
  {/* Content */}
</Warehouse>

Pallet

Represents a standard or custom pallet.

<Pallet 
  id="pallet-1"
  type="EURO"             // 'EURO' | 'ISO' | 'CUSTOM'
  position={[0, 0, 0]}    // [x, y, z] in mm
  rotation={[0, 0, 0]}    // [x, y, z] in radians
  color="#8B4513"
  showDimensions={false}
  customDimensions={[1000, 144, 1200]}  // For CUSTOM
>
  {/* Boxes */}
</Pallet>

Box

Box or package inside a pallet.

<Box 
  dimensions={[400, 300, 200]}  // [width, height, depth] in mm
  position={[0, 0, 0]}           // [x, y, z] inside the pallet
  color="#ff6b35"
  label="Box 1"
  onClick={() => console.log('Click!')}
  onHover={(hovered) => console.log(hovered)}
/>

🎨 Customization with AspectConfig

The AspectConfig system allows customizing the visual appearance of each component individually.

Global Configuration

Define default values for all components:

import { ConfigurationProvider, PalletBuilder, Box } from '@cristiancosano/pallet-builder';

function App() {
  return (
    <ConfigurationProvider 
      config={{ 
        usePalletModel: true,
        palletModelUrl: '/objects/pallet.glb',
        palletTextureUrl: '/textures/pallet_planks.png',
        useBoxModel: true,
        boxModelUrl: '/objects/box.glb',
        boxTextureUrl: '/textures/crate_roughness.png'
      }}
    >
      <PalletBuilder palletType="EURO">
        <Box dimensions={[400, 300, 200]} position={[0, 0, 0]} color="#ff6b35" />
      </PalletBuilder>
    </ConfigurationProvider>
  );
}

Component-level Customization

Each pallet or box can have its own texture, model, or color:

<PalletBuilder 
  palletType="EURO"
  palletAspect={{ textureUrl: '/textures/dark_wood.png' }}
>
  {/* Box with custom color */}
  <Box 
    dimensions={[400, 300, 200]} 
    position={[0, 0, 0]}
    aspect={{ color: '#00d9ff' }}
    label="Blue Box"
  />
  
  {/* Box with custom texture */}
  <Box 
    dimensions={[400, 300, 200]} 
    position={[400, 0, 0]}
    aspect={{ textureUrl: '/textures/cardboard.png' }}
    label="Cardboard Box"
  />
  
  {/* Box with custom 3D model */}
  <Box 
    dimensions={[400, 300, 200]} 
    position={[0, 0, 400]}
    aspect={{ 
      modelUrl: '/objects/custom_box.glb',
      textureUrl: '/textures/metal.png'
    }}
    label="Metal Box"
  />
</PalletBuilder>

Default 3D Models and Textures

The library comes configured with default models and textures:

Pallets:

  • Model: /objects/pallet.glb
  • Texture: /textures/pallet_planks.png

Boxes:

  • Model: /objects/box.glb
  • Texture: /textures/crate_roughness.png

You can use your own GLB models and textures by customizing the global configuration or using the aspect prop on each individual component.

Priority: aspect prop > ConfigurationProvider > defaults

See docs/guides/aspect-customization.md for full examples.

🔮 Roadmap

  • [ ] <Truck>: Component for truck visualization
  • [ ] <Container>: Shipping container
  • [ ] Optimization Algorithms: Automatic placement suggestions
  • [ ] Export: Generate reports and visualizations
  • [ ] Physics: Weight and stability simulation
  • [ ] Multiplayer: Real-time collaboration

📚 Documentation

Check the /docs folder for more information:

🤝 Contributing

See CONTRIBUTING.md

📄 Attributions

This project uses third-party assets:

See ATTRIBUTIONS.md for full details.

📄 License

MIT © Cristian Cosano


Made with ❤️ using React Three Fiber