Skip to Content
Meubles Morinière

The project10 min read

Overview

The store and its trade, the problem to solve, who I built the software for, and what the ERP and the storefront do day to day.

Meubles Morinière is a family business in Cholet, in Maine-et-Loire, in western France. Since 1971, it has built furniture in its own cabinetmaking workshop and sold it in its store. I develop its software. It covers the whole trade, from a piece’s record to its delivery. The team works in the ERP. Customers choose and track their furniture on the storefront, and they’ll be able to pay there once the terms of sale are final. The ERP and the storefront run on the same Postgres database. So a sale made online, in the store or from a quote is the same order, and we follow it all the way to the invoice.

Storefront · /
The storefront’s home page: a workshop piece on the front page, with its dimensions, price and availability.
ERP · /tableau-de-bord
The ERP dashboard: orders to prepare, storefront and store status, incidents, workshop progress, quotes and stock.
The storefront’s home page on a phone.
The live storefront and the ERP dashboard, on desktop and on a phone. Screenshots from the team’s manual, on the demo database. The people, emails and amounts are fictitious, and the numbered markers guide the reader.

This doc is long. Depending on what you’re looking for, a reading path gets you to the essentials in a few pages.

Context

In the workshop, the cabinetmakers build solid wood and steel furniture, made to measure or from their own designs. The store shows it alongside furniture, lighting and decor bought from Italian, Spanish and French makers.

The team is small. The same people sell in the store, write quotes, order from suppliers, build, deliver and keep the books. Online sales come on top of the store. So the same piece can sell in the store or on the storefront, and each one has to know what the other has sold.

The business problem

When you make what you sell, every sale becomes a small project that runs over several weeks.

First problem, lead times. A made-to-order piece takes several weeks to arrive. The date promised to the customer depends on the workshop’s lead time, the suppliers, working days and store closures. And if we can’t keep that date anymore, we have to tell the customer before they notice on their own.

Then, the money comes in several payments: a deposit, then the balance, online or in the store (cash, cheque, card, bank transfer). Sometimes there’s also a refund or a credit note.

Stock is shared between the store and the storefront. A piece sold in the store must not be payable on the storefront anymore. And if the store sells a piece a customer is paying for online, that payment has to stop.

A customer order often triggers another one with a supplier. You have to chase it, check that its acknowledgement matches what the customer chose (finish, colour, dimensions), then serve the customer as soon as the goods arrive.

And there’s the law: invoices you can’t change anymore, payments where the smallest edit has to show, VAT, the withdrawal right for distance selling, personal data you only keep for a while, and timber traceability (EUDR).

Each of these could be handled with an off-the-shelf tool: a till, an online shop, a spreadsheet. The real problem is what happens between those tools. The date promised on the storefront depends on the workshop’s deadline. The purchase that arrives has to go to the customer who’s waiting for it. And the payment has to find its invoice.

Goals

  1. You enter a piece of data only once. After that it’s used everywhere: in the ERP, on the storefront, in emails, in PDFs and in the Google Merchant Center feed.
  2. We only promise the customer what we can actually do. The price, availability and date they see come from the rule the workshop applies, written once in packages/domain (Business logic). And they pay what they saw (Cart and checkout).
  3. Obligations must not depend on the team staying alert. Everything that touches money, the law and stock is protected by the database (Data). The storefront is open to the whole Internet, so it can only create an order awaiting payment. The ERP is what marks it paid (Security).
  4. The ERP has to make life easier for a small team. It’s fast, it works on a phone, it flags every morning what needs a look, and it takes care of the tedious data entry (ERP interface).

Users

WhoWhereWhat they do there
The store and workshop teamThe ERP, on a computer and a phonesell in the store, write quotes, pick and deliver, order from suppliers, count stock, publish the catalogue, follow the figures
CustomersThe storefrontchoose, pay, accept and pay a quote, track an order, withdraw, find their invoices
The accountantThe ERP’s exportsreceive the fiscal-year export. The ERP also prepares the VAT returns

In the ERP, everyone has the same rights. In a team this size, everyone has to be able to do everything. So the screens are organised by trade. Sensitive actions still need a recent sign-in: refunding, issuing a credit note, erasing data, exporting personal or tax data.

On the storefront, the customer account is optional. You can pay for and track an order without one. To sign in, you get a one-time code by email. There’s no password.

The ERP, the team’s tool

The left-hand menu is organised by trade: Sell, Purchasing and stock, Catalogue, Management (apps/erp/shared/constants/admin-sections.ts#ADMIN_SIDEBAR_GROUPS). The day starts on the dashboard and the “To do” list, sorted by what you lose by waiting (The team’s day). The palette (⌘K) opens any screen, any record and any chapter of the manual.

  • Sell: an in-store sale can be paid in one or several payments. On an order, you see payment status and fulfilment status side by side. A quote goes to the customer, who can accept it and pay it online. It then becomes an order. Sending waits for online payment to open (Quotes, Orders, Deposits and payments).
  • Workshop and delivery, in the Sell group: each order has two dates. There’s the workshop deadline, counted in working days from payment, and the date promised to the customer. If the workshop deadline goes past the promised date, the ERP flags it and the team tells the customer (Lead times and promised dates). Picking and delivery planning are there too.
  • Purchasing and stock: a supplier order is linked to the lines of customer orders. When it arrives, what the customer is waiting for goes straight to them, and the rest goes into stock at weighted average cost. Restocking suggests whatever drops below its threshold. And the stock ledger can’t be rewritten (Suppliers and purchasing, Stock).
  • Catalogue: the furniture and its variants, photos, categories, collections, colours and materials. As soon as you publish or edit something, the cache of the affected pages is invalidated on the storefront (Exchanges between the applications).
  • Management: figures and VAT, invoices and credit notes, the returns for each period and the fiscal-year export (Invoicing). Refunds, withdrawals, product returns and disputes are tracked on the order (After-sales). A customer’s record groups their orders and quotes, whether they bought on the storefront or in the store (Customers).
  • Settings and backstage: opening hours, closures, delivery, promo codes and staff accounts, plus system health and Fisher’s metrics.

Even if nobody opens the ERP, the daily check looks every morning at what’s wrong and sends it to the team by email and on their phones. A new order or a dispute also comes in as a notification (ERP).

ERP

ERP

Start the day

You see what needs attention first, then open any screen from the keyboard.

ERP · /tableau-de-bord
ERP, Dashboard
ERP, Incidents
ERP, Palette ⌘K
ERP, Shortcuts

Dashboard. It shows orders to prepare, website and store status, incidents, the workshop, quotes and stock.

1 / 4

Screenshots from the team’s manual, on the demo database. The people, emails and amounts are fictitious, and the numbered markers guide the reader.

The storefront, the customers’ shop

  • Choose: the catalogue and its filters, search, collections and favourites. On a piece’s page, the customer sees the variants, the price, the availability and the possible delivery date, computed with the same rules as in the ERP.
  • Pay: the cart, then payment through Stripe Checkout. If a price, a stock level or a discount changed between the moment the customer saw it and the moment they pay, the storefront tells them. They only pay what they saw (Cart and checkout). In production, online payment stays closed until the terms of sale are final (isCheckoutOpen).
  • Accept a quote: the customer opens their quote from a link. They can download the PDF and pay online.
  • Track: you don’t need an account to track an order. With an account, you find your orders, quotes and invoices in one place. You can also request a withdrawal online.
  • Ask: a made-to-measure project is described in one sentence, and a problem after the purchase is reported with photos. Both go to the store by email, with no ticket system (Requests to the store).
  • Be found: the sitemap, structured data, share images, and a Google Merchant Center feed that carries the price, delivery and date shown on the page (Search engines).

Storefront

Choose and order

From the front page to order tracking, as customers see it.

Storefront · /
Storefront, Home
Storefront · /catalogue
Storefront, Catalogue
Storefront · /collections
Storefront, Collections
Storefront · /produit/…
Storefront, Product page
Storefront, On a phone
Storefront · /commande
Storefront, Cart
Storefront, Tracking

Home. The front page shows a workshop piece with its dimensions, price and availability, and whether the store is open.

1 / 7

The live storefront, captured read-only.

Fisher, the assistant

Fisher is the ERP’s assistant. It’s at the top right of every page (⌘J). You can give it a delivery note, a supplier’s acknowledgement or a quote request, on paper, as a photo or by voice, and it pulls out what’s needed to fill in the form. It can also write a text from the ERP’s data, and answer the team’s questions about how to do something, the stock, an order or a purchase.

Every figure it gives comes from a read of the ERP. If it writes one that has no source, the person is warned. And it doesn’t change anything until they’ve confirmed (Fisher).

The path of an order

How it’s built

Postgres tables
54
schema migrations
169
business modules
40
test files
1,789
Counted in the repository at each build of this documentation.

The ERP (apps/erp) and the storefront (apps/site) read and write the same Postgres database, but not with the same rights. The storefront only has the ones it needs, table by table and column by column. Everything the two applications have to do the same way is in the packages (packages/*): the database schema, the business rules (VAT, prices, lead times…), authentication, the contract for their exchanges and the UI kit (Architecture).

On the technical side, it’s Next.js (App Router, Cache Components, React Compiler) and React 19 in strict TypeScript, Prisma on Postgres (Neon), Better Auth, Stripe for online payments, Tailwind CSS 4, and Anthropic’s models through Vercel’s AI Gateway. The applications are hosted on Vercel, in the Paris region. The database is on Neon, in the United States, in Virginia (us-east-1) (Integrations).

What’s particular about this code

Everything I claim here, and every skill I claim with this project, has its evidence in Skills and evidence: the code involved and the test that checks it, extracted from the repository at every build.

  • The important guarantees don’t depend on anyone’s discipline. The database or the code enforces them. Payments are chained and can’t be edited anymore. Stock doesn’t go below zero and its ledger can’t be rewritten. The storefront can only create orders awaiting payment. The details are in Data and Business logic.
  • There are two applications, but each business rule is written only once. The storefront started as a fork of the ERP, and today a check stops the code from duplicating again. I tell that story in the case study Two applications born from a fork.
  • Fisher only talks about what the ERP knows. Every figure it gives comes from a read of the ERP, and if it writes one without a source, the person is warned (Fisher).

How to read this doc

Here I explain how the code is built and why. For the details, the reference is the code: each page names the files and symbols involved (file.ts#SYMBOL). Some passages are taken as is from other texts in the repository (the README, the storefront map), and that’s where they get updated. I write the doc in French first. Until a page is translated, its English address shows the French version, marked FR in the menu.

The reading paths suggest an order depending on what you’re looking for. The map below follows the groups of the menu, with the question each one answers.

The project

What is it, and who built it?

The product

What does the software do?

The code

How is it built?

Engineering choices

Why is it built this way?

On this page