A product ships in a hurry, and there are usually good reasons for it. The trouble shows up a few months later, when adding one field to a form means touching seven files and nobody remembers why the orders screen calculates its own discount.
Speed without structure gets billed later
Moving fast at the start is legitimate. What gets expensive are the shortcuts with no way back: a business rule written inside a controller, the same query copied into four screens. Each one saves an afternoon and costs weeks once the product grows, and clean architecture exists so those weeks never arrive. Here we use the term in a broad sense: dependencies that point toward the domain, not one specific framework.
In practice it comes down to four separations. Domain logic ignores the framework. Data access sits behind interfaces. The presentation layer only presents. Integrations with payment gateways or third-party services live at the edge of the system, where they can be swapped without touching the core.
An example with the discount rule. If it lives in the controller, changing it means touching the web layer and testing it with a running server. If it lives in a domain class, the controller just calls it:
// Domain: it imports no Express, no Nest and no database
export class DiscountPolicy {
constructor(
private readonly threshold: number,
private readonly rate: number,
) {}
// In production: integer cents or Decimal, not floating point
apply(subtotal: number): number {
return subtotal >= this.threshold ? subtotal * (1 - this.rate) : subtotal
}
}
// The test needs no server and no database
const policy = new DiscountPolicy(500, 0.1)
expect(policy.apply(1000)).toBe(900)
The controller is left with one line, const total = policy.apply(subtotal), and the discount changes in a single place.
A modular monolith before microservices
Most products do not need microservices in their first years. A modular monolith, with modules that have clear boundaries and dependencies pointing one way, gives you a good part of the organization without the cost of running several services separately. When one module needs to scale on its own, the boundary is already there and splitting it out is a contained job.
Domain-driven design without the ceremony
DDD scares people with its vocabulary, but one of its central ideas fits on one line: name the code after the business. If the company talks about quotes and service orders, the code has classes with those names. Anyone who understands the business can open the folder structure and find where each rule lives.
What it looks like day to day
New people find where to work without asking for a map. Changing the pricing rules touches the pricing module only. Automated tests run fast because the domain is tested without a database or a server. Refactoring stops being scary because the boundaries say what can break. And the edge of the system, where your API meets others, gets described with a contract, as covered in documenting an API with OpenAPI.
When to invest
The cheapest moment is the start of a project, though doing it later still pays off. In an existing codebase, a focused architecture review is usually enough to identify the few highest-impact changes before anyone has to propose a rewrite.
Which module hurts most? Tell us and we will review it. That review is part of our technical consulting.