Evidence-based recommendation on multi-repo vs monorepo and microservices vs monolith for the Xedla backend.
Date: 3 September 2026 Scope: xedla-auth-microservice, xedla-transaction-microservice, xedla-escrow-microservice, xedla-cards-microserviceOut of scope: Xedlapay-V2-Backend (Python, Render, different stack)
Question | Answer |
|---|---|
Multi-repo vs single repo | Single repo. Consolidate the four Node services into one monorepo. |
Microservices vs monolith | Keep the services. Do not rewrite into a monolith. Stop creating new ones. |
The service architecture is sound. The repository split is what is costing us.
Last two production deploys per service:
Service | Deploy dates |
|---|---|
auth | 2026-05-09, 2026-05-09 |
transaction | 2026-05-09, 2026-05-09 |
escrow | 2026-05-09, 2026-05-09 |
cards | 2026-05-09, 2026-05-09 |
The release before that landed on 2025-11-07 across all four. Independent deployability is the main benefit separate repos provide, and we are not using it.
Three active contributors across all four repos in the last 12 months. Total Node codebase is roughly 63,000 lines: auth 36k, transaction 13.6k, escrow 7.6k, cards 6k. That is comfortably one-repo scale.
Of 256 distinct branch names across the repos, 15 exist in three or four of them, including epic/api-v2, hotfix/transfer-error, feat/api-versioning-implementation, feat/testing-setup, eslint-code-cleanup, and chore/agent-guidelines. Each one meant four branches, four PRs, four reviews, four merges.
The split is already producing errors:
feat/multi-account-support in transaction versus feat/muilt-account-support in escrow and cards. Same feature, typo'd name, cannot be cross-referenced.
fix/graceful-shutdown-deploy is open in all four repos and merged in none.
hotfix/transfer-error is unmerged in all four, sitting 6, 8, 3, and 20 commits out of sync respectively.
Verified byte-identical by checksum:
src/app.ts in all four services
src/functions/calculateFee.ts in all four services (fee calculation, in a payments system, duplicated four times)
featureFlag.ts in auth, cards, transaction
logger.ts, sanitizeError.ts, errorHandler.ts, requestPaginate.ts, encryption.ts in pairs
A further 15 or so same-named files (token.ts, tokenVerify.ts, authorization.ts, validator.ts, environment.ts, routes.config.ts) have already drifted apart between services.
Package | auth | transaction | escrow | cards |
|---|---|---|---|---|
jsonwebtoken | ^9.0.0 | ^9.0.2 | ^9.0.2 | ^8.5.1 |
mongoose | ^6.7.2 | ^6.7.2 | ^6.13.0 | ^6.7.2 |
redis client | both |
|
| none |
Cards is a major version behind on JWT handling. This drift exists only because nothing forces a single version.
staging.yml and production.yml are 81 lines each in every repo. Diffing auth against cards, the only substantive differences are the port number and the container name. Four copies of the same deploy logic to keep in sync, and any pipeline fix has to be applied four times.
The boundaries are genuinely good and worth preserving.
Real data isolation. Each service owns its own database: XedlaTransfer, XedlaVirtualCard, and so on, with separate staging, production, and test database names. This is not a distributed monolith sharing one schema.
Thin runtime coupling. The transaction service calls auth on exactly two endpoints: /notifications and /push-notifications/send.
Boundaries match how work splits. 226 of 256 branches (88%) touch one service only.
Collapsing this into a monolith would be a large, risky rewrite of live payments code to solve a problem we do not have.
Auth is 36k lines, 57% of the entire backend. The other three are modules wearing a service costume. At 63k lines and three engineers, we are below the scale where microservices pay for themselves. We carry the operational cost (four pipelines, four deploys, HTTP between components, no transactions across boundaries) for benefits we cannot yet use.
Policy going forward: do not split anything new into its own service. If a new capability appears, it goes inside an existing service unless it has both its own data and its own release rhythm.
One repository, npm workspaces, four independently deployable services:
xedla-backend/
services/
auth/
transaction/
escrow/
cards/
packages/
shared/ calculateFee, logger, encryption, errorHandler,
featureFlag, requestPaginate, sanitizeError,
token, tokenVerify, environment, app bootstrap
tsconfig.base.json
eslint.config.js
vitest.workspace.ts
.github/workflows/deploy.yml matrix + paths-filter
Deployment stays exactly as it is. Same GHCR images, same SSH-to-server step, same container names, same ~/.envs/*.env files living outside the repo. A path filter in a single workflow means only the services that changed get rebuilt and redeployed.
One version of the fee calculation and one JWT library version, enforced by the package manager
One PR per feature instead of four
One CI pipeline to maintain instead of four
Atomic cross-service changes that cannot half-land
The ability to deploy services on wildly different schedules. The git history shows we never do this anyway.
Effort: roughly a few focused days for one engineer, plus a risk window while protected branches, husky hooks, and CI secrets are reconfigured.
Timing: best done right after a production release, while staging is close to production. Currently auth is 92 commits ahead of production and the gap keeps growing.
History: preserve per-service history with git subtree add --prefix=services/auth <remote> staging for each repo.
Order: start with the two smallest services (cards, escrow) to validate the workspace setup before moving auth.
These are separate problems and this change does not address them:
Internal service calls hairpinning over public DNS
Staging and production sharing one Redis instance
The four-month gap between production releases (2025-11-07 to 2026-05-09)
Published with Braandly