When we show Tartib 2.0 to other developers, the first question is usually “why not microservices?”. The short answer: nothing in this project justified their cost. The long answer is more interesting.
What the domain does
Tartib follows public investment projects from the moment a ministry enters them until they are ranked. The heart of the domain is grids:
- an admissibility grid, which says whether a project can be evaluated;
- three-level evaluation grids: components, criteria and indicators;
- weights per component and per criterion;
- a sectoral evaluation, then a central evaluation that can adjust the scores.
Around them sit funding sources and their tranches, the geographic divisions (governorate, delegation), the National Development Plan axes and the PDF reports.
All of this is tightly linked. Evaluating a project touches the project, the grid, the weights and the answers at once, and the score has to stay consistent. That’s exactly what a relational database and a transaction handle well.
Why not microservices
We asked the question honestly, with what each option would cost:
- One team, with one release rhythm. Splitting into services wouldn’t have let us work more in parallel.
- Nested data. Separating grids from evaluations would have turned joins into network calls, and one transaction into a saga to compensate.
- Hosting on government servers, at the Centre National de l’Informatique. Every extra container is one more thing to install, monitor and explain to the operations teams.
- Tight deadlines. Time spent on distributed plumbing would have come out of features.
No part needed to scale on its own or ship on its own. The monolith was the sensible choice.
A monolith doesn’t mean a mess
The risk with a monolith is the big ball of code where everything depends on everything. We set a few simple rules from the start:
- Clear layers: controllers, service interfaces, implementations, repositories. A controller only talks to a service interface, never to a repository.
- No entity ever leaves in a response. Each use case has its DTOs. The project list gets a light summary; the project file gets the detail with blocks, funding and scores.
- Nested data is loaded on purpose, with targeted joins, to avoid N+1 queries on files that contain dozens of child objects.
- One schema, versioned with Liquibase. Every model change is a reviewed change that replays on every environment.
- Score calculation lives in a single transactional service. Weights, original scores and adjusted scores are written together or not at all.
The rules are data
The decision that helped us most: grids, criteria and weights are tables, not code. When the ministry changed a criterion’s weight or added an indicator, nobody had to redeploy. An administrator edited the grid, and the next evaluations used it.
It took more work up front, especially to keep track of old grid versions, but it’s what let the project follow the ministry’s decisions without blocking the team.
When should it be split?
I’m not saying Tartib will stay a monolith forever. If PDF report generation became heavy enough to slow the screens down, it would be the first candidate to move into its own service, with a message queue in front of it. Same for notifications if they had to go out on other channels.
The difference is that we’d split for a measured problem, not on principle. And thanks to the rules above, the boundary is already visible in the code.