I started CustomForge because I wanted a fairly simple interaction: put some text or an image on a flat canvas, then see what it looks like on a real product. Move the image on the left, and the cup on the right updates with it.
The public cup-demo project was a reference for that interaction. I liked being able to work on a flat surface while checking the result on something I could rotate. I wanted to build a reusable version of that idea, with a cup as the first example.
I also wanted to keep it separate from a store. Prices, orders, accounts, and checkout already belong to the application using the editor. My part would be editing the design and showing it on the model.
That was the starting point. Since then, quite a lot of the work has been about things that looked small until I actually tried using them.
Getting something onto the cup
I used Fabric.js for the flat editor and Three.js for the preview. Fabric already handles text, images, selection, dragging, and transform controls. Three.js can load a product model and use a canvas as a texture.
The connection is fairly direct. Fabric renders the design into a canvas, and a Three.js CanvasTexture supplies that image to the product’s material. When the design changes, the texture needs updating too.
The model’s UV coordinates tell it where each part of the flat image belongs on the surface. CustomForge uses those coordinates; it does not work out how to unwrap the model for you.
The early demo used a cup generated in code. That was enough to get text and images moving between the editor and the preview. Replacing it with a GLB made the next set of problems much easier to see.
Even loading the file had a small detour. Vite tried to parse the GLB as JavaScript. The model needed to be imported as an asset URL. That error was easy enough to fix, but successfully loading the model still left the more interesting question: which parts of this cup should receive the design?
The handle should keep its original appearance
When I looked at the cup’s UV layout, there were two circular areas I did not need for printing. There was also a narrow strip associated with the handle.
My first question was whether I could just remove those parts from the UV layout in Blender. But deleting something from the UV view does not solve the underlying problem. The cup still needs its bottom, inside, and handle. I want to keep those surfaces visible while keeping user artwork off them.
Looking at how cup-demo handled this led me toward a separate printable layer.
The model now has a complete cup body and another mesh covering only the part that can receive artwork. In the bundled example, they are called MugBody and PrintArea. The body keeps its own material, and the live design texture goes onto the printable layer.
This also made the editor easier to explain. The UV guide can come from the printable layer itself, rather than showing every surface on the complete cup and asking the user to remember which islands to avoid.
There were still material problems. At one point, the printable area had a visible gray background. An empty design should let the cup show through, so that patch was already wrong before adding any artwork. Keeping the design background transparent and making the overlay material handle that transparency was part of the fix.
I prefer this arrangement for the cup. It makes the printable area an explicit part of the asset. It also means somebody has to prepare that asset properly. Loading a random GLB cannot tell the editor whether a handle, metal rim, or inner wall is printable.
The selection box appeared on the product
One bug made the preview look particularly ridiculous. Select an object in the editor, and its selection border could appear on the cup too.
The border is useful while editing, but it is obviously not part of the design. Feeding the wrong rendered canvas into the texture had allowed editor controls to become artwork.
I separated the clean design output from the interactive display. The texture canvas contains the design objects. Selection borders, resize handles, and UV guides stay in the editor’s display layers.
The same separation applies to PNG output. Selecting a piece of text should not change what gets exported. Neither should changing the color of a guide or the grid behind the canvas.
It is an easy problem to miss when testing with nothing selected. Once you click a word and see a box wrapped around the cup, there is not much room to argue about whether the behavior is acceptable.
The editor kept getting in the way
Getting the texture onto the model was only part of making this useful. The first text-editing experience was awkward enough that I would not want to keep using it myself.
I wanted the familiar controls near the top, closer to an Office toolbar. Choosing a font or changing a color should not require hunting through a separate panel every time.
But adding that toolbar caused another problem. When text was selected, the formatting area appeared and pushed the canvas down. Clicking outside the text could make the canvas suddenly look smaller. The design had not changed, yet the workspace moved around it.
I changed the layout so the formatting area had a stable place. I also moved the layers panel inside the design area and made it collapsible. Previously, it sat between the flat design and the product, which made the two things I actually needed to compare feel further apart.
While doing this, I had to keep the canvas’s logical size separate from its size on the page. Opening a panel or resizing a window can change how large the canvas is displayed. It should not change the coordinates of a logo, resize the saved design, or create a different export resolution.
Some of the smaller fixes were irritating in their own way. The layer action icons covered the object name. Shrinking those icons with a selector that was too broad changed other icons as well. Those are ordinary CSS problems, but they are still part of whether someone can comfortably use the editor.
I also changed the background-image action. Filling the entire rectangular canvas did not necessarily fill the actual printable region correctly, because the model’s UVs could leave margins. It now fits the image to the printable UV layout’s bounding rectangle and puts it at the bottom of the design.
That rectangle is still a rectangle. It is not an exact mask for every irregular UV island or hole, and I do not want to describe it as one.
Someone else’s editor would look different
As the default interface grew, I kept coming back to the same question: what if another developer wants the functionality but has no use for my layout?
They might want their own logo, a vertical toolbar, a different place for layers, or a button that sends the design into their own workflow. Asking them to copy the demo and modify internal code would make every later update harder.
The core was already separate from the demo, so I kept two ways to use it. There is a complete Workbench for embedding an editor quickly. There is also a lower-level API for applications that want to build their own interface around the same editor and preview.
I added configuration for the default interface’s branding, theme, and text. Text meant more than the labels visible on the main screen. A translated editor also needs the product-loading dialog, validation messages, tooltips, and error messages to fit the language of the surrounding application.
For business actions, I added extension buttons in defined places. An application can put its own action in a toolbar or beside a layer, decide when it should be available, and call the public API when it is clicked. An asynchronous action can show a loading state instead of accepting the same click repeatedly.
I made a separate consumer example with different branding and a different layout to exercise these options. It moves the editing tools to the left and the layers to the right of the canvas. That is a more useful check than changing one accent color and deciding the interface is customizable.
There is a boundary here too. Button extensions do not amount to arbitrary component slots. If an application needs complete control over its component tree, I would use the lower-level API and build that interface directly.
The design also has to survive closing the page
A texture image is useful for output, but I still want to reopen a design and edit the text or move a logo. That meant saving the editable objects as well.
I gave CustomForge its own versioned Design JSON format. It stores the canvas size and the objects with their text, image sources, transforms, and layer state. The format does not require the application to understand Fabric’s internal objects.
Image sources needed some care. A temporary Blob URL from a local upload will not be useful after the page closes. Those images are converted to persistent data when they are added. Remote image URLs remain URLs, so they still need to be available when the design is reopened.
Loading a design also should not destroy the current work halfway through. The incoming document is checked and its images are loaded before it replaces the existing design. If one of those steps fails, the current design stays there.
There are limits to what the document contains. The product model and its configuration are managed separately, and a saved design needs a canvas with matching logical dimensions. It is not a file that can be dropped onto any product and expected to fit.
Running the demo was not enough for publishing
I wanted people to be able to install CustomForge from npm. That brought in a different kind of problem: code can work inside its own repository while the package somebody installs is incomplete.
The bundled model and font were examples of this. Their URLs needed to resolve from the built package, rather than depending on paths available to the development app.
I added independent consumer projects that install the packed tarball and use its public imports. They have to work with what the package actually contains. They cannot quietly reach into the library’s source tree for something the build forgot to include.
The release checks also include browser smoke tests that exercise the packaged editor. Type checking and building are useful, but they cannot tell me on their own whether the cup rendered or whether a design can be edited and restored in a browser.
Remote resources bring their own constraints. An image opening in a browser tab does not prove that a canvas can safely use and export it. Models and remote images need the appropriate CORS permission. That is something an integrating application still has to handle with its asset hosting.
Then the cup disappeared when I zoomed out
After the first non-prerelease version, I found another bug by using the mouse wheel. Zoom out far enough and the whole product disappeared. Zoom back in and it returned.
The camera controls allowed a greater viewing distance than the camera’s far clipping plane covered. The model was still in the scene, but it was outside the range the camera would render.
I changed the clipping calculation to cover the maximum permitted camera distance, with room for the model’s depth. The calculation uses the model’s bounds, so it does not depend on one particular cup size.
I also added a regression check that zooms out to the limit and checks that the preview still renders content. That fix went into 0.1.1.
It was annoying to find this after publishing. Most of my attention had been on the initial view and whether editing updated the texture. Scrolling all the way to the other end of the allowed range exposed a case those checks had missed.
A denser model made the workbench stall
The 0.1.2 work came from trying a product whose printable surface had many more triangles. The GLB could finish downloading while the Workbench still took a long time to become ready.
One expensive part was drawing the UV guide. I was adding the triangles to a canvas path and calling closePath() for every triangle. With tens of thousands of triangles, that meant a lot of synchronous work on the main thread before the editor could respond.
Canvas fills implicitly close open subpaths. I could keep each triangle as an open subpath and fill the combined path once. The guide still needed the same geometry; the repeated closing operations did not need to be there.
There were also pixel checks left in the rendering code to detect whether the canvas and preview had drawn anything. In the 3D loop, these could repeatedly read pixels back from WebGL while the model was not yet visible. That introduces CPU/GPU synchronization, which was a bad thing to keep doing while waiting for initialization to finish.
I removed those checks from normal rendering and moved the nonblank-image checks into the browser test. The regression case now generates a GLB with 47,432 printable triangles and checks initialization time and long tasks, alongside whether the editor and preview actually render.
These changes went into 0.1.2. They leave the design format, printable area, and public API unchanged. The generated test model gives me a repeatable case, but it does not establish a loading-time guarantee for every customer’s model, browser, and machine.
Where it stands
CustomForge is now published on npm, with 0.1.2 as the current version. There is also a documentation site with a live Workbench using the published package.
I’ve put that same editor below. Try moving one of the portraits or changing its caption, then rotate the cup to see where the design ends up.
For a first try, the bundled cup means there is no model preparation step. The default interface can be mounted like this:
<div id="customizer" style="height: 640px"></div>
import { createWorkbench } from 'customforge/workbench'
import 'customforge/style.css'
const workbench = await createWorkbench({
container: '#customizer',
})
The package name is customforge. When the host page or component no longer needs the instance, it should call workbench.destroy() to release the listeners and rendering resources.
For a real product, the preparation work remains. The current version needs a named target mesh with usable UVs, and it maps one design canvas onto that mesh’s first material slot. Multiple independently editable surfaces and automatic UV preparation are not available. There are no official React or Vue adapters yet, although the core can be mounted from either after its DOM containers exist.
I also have not established that an exported texture is ready for a particular printing process just because it looks right in the preview. Physical dimensions, distortion, safe margins, and color still need checking against the actual product and equipment.