The problem
TopSec exists to aggregate, synchronise and visualise data in real time without leaning on huge infrastructure or stacks that are overweight for what the product actually needs. The brief was simple to say and hard to deliver: keep the data live, fast and consistent while several services talk to each other at the same time.
The hardest call
Drawing a clean line between what lives in the .NET 8 backend and what is solved from Next.js. A subtle case made the line obvious: /api routes plus the next-intl middleware were producing 307 redirects to /es/api/*. Technically valid, practically broken. Real-time and stats endpoints were silently breaking on certain locales.
The patch nobody asks you to write is the one that earns the engineer rate: instead of fixing redirect rules one by one, I rebuilt the middleware matcher to exclude /api entirely. Small visual change, large architectural one.
Optimising too early is bad. Ignoring performance from day one is worse.
Working principle
The other call was sticking with PostgreSQL as the single source of truth. For this product, consistency and the ability to write complex queries was worth more than the speed wins you could squeeze from a NoSQL store. Boring is fine when boring is correct.
What I broke
Production broke once because I assumed a Docker image had genuinely been rebuilt. The "new" code kept behaving like the old code. The actual culprit was npm ci failing silently because package-lock was missing, leaving the build in an inconsistent state. I spent hours debugging application logic for what was a pipeline problem.
Lesson
Distrust every deploy until you have verified, with your own eyes, which artifact is actually running. SHA the image, check the container hash, log the build commit on boot. The cheapest minute you will ever spend.
Outcome
- Stable multi-service VPS architecture: backend, frontend, Redis, PostgreSQL, nginx, all coordinated.
- Large drop in routing and real-time errors after the middleware rewrite.
- Response times improved through targeted cache placement and clean separation of responsibilities.
- Architecture ready to grow new modules without rewriting the core.
- Public surface: mkir.es. Deeper technical walkthroughs available on request.