Aug 2026 — ongoing · Freelance client project
CostoPreciso In development
Multi-tenant costing and quoting SaaS for Mexican manufacturing SMEs, starting with metalworking. Every feature went through spec → plan → tasks with Spec-kit before it existed. A deterministic pure-TypeScript costing engine computes cost per process, logistics allocation and suggested price, and both the backend and the frontend share it.
- Role
- Sole developer
- Period
- Aug 2026 — ongoing
- Stack
- TypeScript · NestJS · Drizzle · PostgreSQL 16 · React 18 · Vite · Tailwind · shadcn/ui · Docker · Nginx · GitHub Actions
The link opens the product's public site. The application requires an account and the repository is private to the client.
The problem
A small business that does not know its production cost is selling blind. In a metalworking shop the real cost depends on each product's process route: material, labour, machine, setup, overhead, packaging, and inbound and outbound logistics. Spreadsheets do not survive that: nobody can trace where a number came from, and data from several companies ends up mixed together. I built a system where every formula is auditable and tenant isolation exists from the first commit.
Architecture decisions
-
A constitution before the first line of code
The project starts with written NON-NEGOTIABLE principles: a pure engine that imports no infrastructure, deterministic formulas traceable to their numbered section, industry-agnostic vocabulary in the engine, and multi-tenant from day zero. Each feature went through spec, plan and tasks with Spec-kit and Claude Code before implementation, and each one is closed against automated unit and end-to-end tests.
-
The costing engine does not know a database exists
Formulas live in pure
(inputs) => resultfunctions, one file per specification section, with no network or disk access. The same engine runs on the server and in the browser, and both sides run the same test vectors, so the number a user sees while typing is the number the server stores. A formula change is argued against its specification section, not against a stack trace. -
Tenant isolation and secure sessions
Every query is scoped by tenant with PostgreSQL row-level security, not at the presentation layer. Sessions use a short-lived in-memory JWT plus an HttpOnly refresh cookie that rotates on every use and detects reuse, along with account lockout after failed attempts, a password-strength policy and Google sign-in.
-
Iterating with the client's expert, not guessing
The per-process costing screens, automatic logistics allocation and the product-guided quote flow came out of walkthroughs with the client's costing expert and their sketches. Every change requested in a meeting became a new spec before any code changed, including switching the whole interface to metalworking vocabulary without touching the engine.
-
Six bugs a fully green suite did not catch
The first real deployment surfaced six failures no test could see, because no test exercised production for real: Nest's dependency-injection bootstrap, the bundle loaded through a script tag, session state that was not React state. I documented them one by one, including reverting a
manualChunkschange that left a blank screen in production.
What I did
Everything: specification, architecture, a NestJS backend with Drizzle and PostgreSQL 16, a React 18 frontend with Vite, Tailwind and shadcn/ui, and operations on an Ubuntu VPS with Nginx, the backend under systemd, PostgreSQL in Docker and continuous deployment from GitHub Actions. Built with Claude Code daily as a working method, not as autocomplete.
Outcome
Deployed on its own domain, costopreciso.com, since September 2026, with the client reviewing each iteration. The specification remains the source of truth for every formula.
Scope and limits
It is in active development and not a finished product yet. The link goes to the public site; the application asks for an account I cannot share. The repository is private and the product belongs to the client.