One repo, shared walls: how this website is built

A look inside the Hexcomb Labs website. One Turborepo monorepo, one app, and a handful of shared packages that any future product site can reuse.

Looking up at a white concrete building whose facade is a grid of hexagonal cells.

Photo by CHUTTERSNAP on Unsplash

On this page3 sections
  1. The layout
  2. One copy of each thing
  3. Why bother, for one website?

One of our values is shared walls: reuse foundations when it reduces cost or improves quality, and avoid forcing things together. This website is a small, concrete example of what that means in code.

Diagram of the website repository. The web app and the CMS sit above five shared packages, brand, ui, content, config, and cms-client.
Diagram of the website repository. The web app and the CMS sit above five shared packages, brand, ui, content, config, and cms-client.

The layout#

The site lives in a single Turborepo monorepo on Bun workspaces:

  • apps/web is the website you are reading, built with React, TypeScript, and TanStack Start. The blog is part of it, at /blog.
  • apps/cms holds the Docker setup and schema for the Directus CMS that stores these posts.
  • packages/brand has the design tokens, the Tailwind theme, the base CSS, and the only copy of the brand kit.
  • packages/ui has shared React components, from form primitives to the footer and the post grid on this page.
  • packages/content keeps copy and small pieces of logic, such as the five stages and the problem brief.
  • packages/config holds the shared TypeScript, ESLint, and Prettier settings.
  • packages/cms-client is a small, typed, read-only client for the CMS.

One copy of each thing#

The rule we try to follow is simple: if two places need the same thing, it belongs in a package.

Brand assets are a good example. Logos, fonts, and the brand guidelines live once, in packages/brand/assets. Before each build, a small script copies them into the app's public folder. That folder is generated and ignored by git, so nobody can edit a logo in one place and forget the other.

The packages ship TypeScript source rather than compiled code. The app's build tool compiles them directly, so there is no extra build step to keep in sync.

Why bother, for one website?#

Because it won't stay one website. Each product we announce will get its own site. When that happens, it can start from the same tokens, components, and settings, and look and behave like part of the same family on day one, without a copy-and-paste fork that slowly drifts.

That is the same reasoning we apply to products: a shared foundation is worth it when it makes each cell better on its own.

Filed under

Hexcomb LabsResearch, product, design, and engineering

Notes from the team building Hexcomb Labs in Kathmandu.