Implementation of a product-agnostic, front-end-only, customizable online 3D web configurator for modular products. The application is conceived for use by small businesses. The configurator provides a straightforward definition of configurable products and operates solely using a web server. The implementation leverages modern technologies, combining Three.js with React.
This is a monorepo, split into two applications:
apps/main
- the main application, the configurator itselfapps/admin
- the administrator application, for managing the configuration of products
along with a shared library:
packages/shared
- shared code between the two applications
- Node.js
- npm
- Clone the repository
- Install dependencies
npm install
- Build the applications
npm run build --workspace=main
- Use a web server to serve the
apps/main/dist
directory
- Clone the repository
- Install dependencies
npm install
- Build the application
npm run build --workspace=admin
- Run the development server (the administrator application is needed only for the product setup, and can be run locally)
npm run preview --workspace=admin
npm run build
- builds both applicationsnpm run lint
- lints the codebasenpm run fix
- fixes linting issues in the codebasenpm run test
- executes unit testsnpm run dev
- runs the development server for the configurator applicationnpm run dev-admin
- runs the development server for the administrator application
The configurator application can be setup using the appconfig.json
file located in the apps/main/public
directory. The file contains the following properties:
{
"camera": {
"isOrthogonal": false, // whether the camera is orthogonal
},
"shadows": {
"floorShadow": false, // whether the floor casts a shadow (performance expensive)
},
"spatialUi": {
"selectionColors": {
"outline": { // outline color for the 3D selection
"light": "#000000",
"dark": "#FFFFFF",
},
},
"controls": {
"swapMouseButtons": false, // whether to swap the left and right mouse buttons
},
},
"ui": {
"languages": {
"default": "en", // fallback language
"all": ["en"], // all available languages
},
"colors": {
"primary": { // primary color of interface
"light": "#3377ff",
"dark": "#0011ff",
"overlayTextWhiteLight": true, // whether the overlay text should be white in lightmode (when overlaying the primary color)
"overlayTextWhiteDark": true, // whether the overlay text should be white in darkmode (when overlaying the primary color)
},
"error": { // error color
"dark": "#f43f5e",
"light": "#f43f5e",
},
},
},
"sources": {
"catalogUrl": "/products/catalogue.json", // URL to the product catalog
"homepageUrl": "/", // URL to the homepage
},
"capabilities": {
"savePdfButton": true, // whether the save PDF button is displayed
},
"images": {
"logo": { // logo image
"light": "/logo.svg",
"dark": "/logo.svg",
},
"favicon": "/logo.svg", // favicon
},
"title": "3dwebprodconf", // title of the application
"debug": {
"collisionDetectionDisplay": false, // whether the collision detection debug is enabled (visually displays the collision boxes)
},
}
Interface texts of the configurator application can be adjusted (along with adding other language variants) by editing the apps/main/public/locales/{language}/translation.json
files, where {language}
is a two-letter code of the language. The language variants need to be registered in the appconfig.json
file.
The product setup is performed in the administration application. The application contains two screens:
Catalog Composer
- for defining the catalog of all products, which points to the individual product specificationsProduct Composer
- for defining the specification of single product
Therefore, a catalog.json
file, along with the product specifications JSON files needs to be created.
The location of catalog file is defined in the appconfig.json
file, and the locations of product specifications are located in the catalog.json
file.
The administrator application allows the import and export of the catalog and product specifications JSON files, allowing the updates of its values.
It is important to note, that the models, images and files need to be accessible from the configurator application. The paths to these files are defined in the catalong and product specifications JSON files.
The product within the catalog can have the following confirmation actions:
- Preview - no confirmation action
- Redirect - redirects to a specified URL
- Callback - sends a POST request to a specified URL, containg the schema of configured product in a JSON body (see
packages/shared/src/schemas/UserCreation.ts
for the schema) - Inquiry form - displays a form for the user to fill in, and continues the same as the callback action, with the form data in
contact
field of the JSON body (seepackages/shared/src/schemas/network/ContactInfo.ts
for the schema of contact information)
This repository provides an example configurable modular kitchen product. An example catalog.json
file and a product specification file for kitchen configuration is provided. The files are located in the apps/main/public/products
directory.
The 3D assets for the example product are not included in the Work and are absent from the repository.
The application is free to use under a permissive licence. See the LICENSE file for more information.