Skip to content
Coulby Studio

Personal product

Nafa.

A business management application for merchants and small companies: sell properly, keep track of customers and payments, and read your figures without accounting jargon.

State
Deployed, not yet opened
Updated
Site
c-nafa.com (opens in a new tab)

Product vision

Nafa starts from a simple observation: a merchant does not need accounting software. They need to sell properly and to know where they stand. So I built the product around what they do every day: selling, with quotes, invoices, credit notes and payments, managing customers, items and stock, and then deciding by seeing what has been collected, what is owed and what has been earned.

I designed it for small shops and small companies, where the manager and the person at the till do not play the same role. Every screen is designed for a phone first, because that is the device actually sitting on the counter.

The problem

Commercial documents are often produced by hand, in a spreadsheet or in a notebook. Time goes into copying figures, totals end up contradicting each other, and on a Monday morning nobody can say how much was collected the week before.

The second problem is one of vocabulary. Dashboards speak accounting, while the real questions are “what did I collect?” and “what am I owed?”. That is why, before writing the code that computes a figure, I first wrote down its definition.

The product is deployed, but it has not yet been opened to real users, and onboarding the first merchants is still to come. I say so rather than imply an installed base.

My contribution

On this project, I owned the decisions. The product vision and the scope, the multi-tenant architecture, the data model, the definition of every figure on screen: each structural choice is mine, and each is captured in an architecture decision record. I then reviewed and validated every increment.

The code itself was written with AI coding agents, under my direction. I decide, I review, I validate, and nothing ships until the tests and the repository rules are green.

Architecture & engineering

I organised the code as a monorepo, with pnpm and Turborepo, to separate the web application, the API and the shared packages. The browser never talks to the database. Next.js server actions call a NestJS REST API, and only that API reaches PostgreSQL and the file store.

Every company is isolated from the others. Every route carries its identifier, membership is checked server-side and every query is filtered. The isolation is at the application level, deliberately, rather than one database schema per customer. One account can create several companies or establishments, run them and switch between them; each stays independent, with its own subscription, no consolidated view, and a tax identification number (NCC) can belong to one company only. Within a company, the team shares three roles (owner, administrator, counter), and platform administration is kept apart, under its own role.

Documents are rendered server-side: an invoice is a React component rendered to PDF, offered in several layouts, as A4 or as a till receipt. Files go to S3-compatible object storage, private and served through signed URLs; the code only ever knows a storage key, never a vendor. Every figure also goes through a single metrics service with a fixed time zone, so that two screens cannot show different figures.

Finally, continuous integration checks types, lint, the build, migrations and tests against a real PostgreSQL database, then runs the end-to-end suite. The product ships as containerised images behind a reverse proxy.

Technical challenges

Four problems took up most of the engineering effort.

Data isolation came first. An end-to-end test stands up two companies and checks that neither can see the other’s documents, which lets me keep changing the routes without risking a leak between customers.

Credit notes raised a concurrency problem: two refunds requested at the same moment could exceed the refundable amount. The recalculation now happens under a row lock, inside a transaction.

Balances have to be explainable. Stock movements and usage counters became append-only journals, never edited in place, and the balance derived from them is written in the same transaction as the movement.

Then came hardening: a dedicated security review tightened outbound calls, authentication on entry points, default values and rate limiting, and it cut the dependency debt sharply.

Design decisions

Eighteen architecture decision records keep track of my structural choices and, above all, of what they cost.

I kept the NestJS API separate from the front end rather than building everything in Next.js, because the same contract will serve other clients. Everywhere a balance has to be explainable, I chose immutable journals over editable counters. Company secrets are encrypted at rest.

For PDFs, I chose React over an HTML-to-PDF engine: a layout can then be tested like a component. I made modules switchable per company, so that a small shop that does not need everything keeps a readable product. Finally, I kept the look of a document apart from the rules that govern it: changing the layout never touches the figures.

Technology stack

I keep every version in one monorepo catalogue, so that an upgrade is a single decision.

  • Web: Next.js App Router, React, Tailwind CSS, shadcn/ui components, Zod for form validation.
  • API: NestJS, Prisma, PostgreSQL, Better Auth for authentication, Redis and BullMQ for deferred work.
  • Documents and files: react-pdf, S3-compatible object storage.
  • Quality and delivery: Vitest, Playwright, GitHub Actions, Docker and Docker Compose.

Lessons learned

The first lesson: define the figures before coding them. Writing down what “collected” means prevented dashboards that contradict each other; it is the document I reopen most often.

I also learnt that a journal beats a counter. The day a balance is disputed, you can replay it line by line instead of having to trust it.

Finally, decision records drift. Several ADRs stayed “proposed” long after the code had shipped. What I take from it: documentation gets reread at merge time, not later.

What’s next

Today my priority is no longer adding features, but making the product bearable for its first users.

The interface is being overhauled, screen by screen: content first, styling last. The next step will be opening up to the first merchants, with hands-on onboarding.

Two questions remain open. Sending documents through messaging apps and online collection are under consideration, because the choice depends on external operators. Error monitoring in production is deferred for now.