# Finamaze: from B2C to multi-tenant B2B

Source: https://www.alouaniyoussef.com/projects/finamaze-migration

- Kind: employer
- Status: shipped
- Company: Finamaze
- Updated: 2026-11-19

Migrating Finamaze from a B2C robo-advisor app to a multi-tenant B2B platform for financial institutions, with the infrastructure adapted to match.

## Problem

Finamaze started as a B2C robo-advisor: one app, one set of investors, one configuration. The business moved to B2B, selling the platform to financial institutions such as Saudi National Bank, and every institution needed its own investors, data, branding and rules on the same product. That is a multi-tenant B2B platform, and the B2C backend and infrastructure were not built for it.

## Constraints

- **Live investors**: the B2C product kept running while the platform changed underneath it.
- **Isolation between institutions**: one institution's investors and data must never be visible to another.
- **Regulated clients**: each institution brings its own security and deployment requirements, so infrastructure had to adapt per tenant.

## Architecture

<LayerDiagram
  title="Finamaze B2C to B2B migration"
  desc="Before: a single B2C app and backend serving one investor base. After: a multi-tenant B2B platform where each financial institution is a tenant with its own users, data and configuration, on infrastructure adapted for tenant isolation."
  layers={[
    { caption: 'Before · B2C', nodes: [{ label: 'One consumer app', sub: 'one investor base' }] },
    { caption: 'Migration', nodes: [{ label: 'Tenant model', sub: 'institution = tenant', accent: true }, { label: 'Users per tenant', sub: 'separate roles' }, { label: 'Infrastructure', sub: 'adapted for isolation' }] },
    { caption: 'After · multi-tenant B2B', nodes: [{ label: 'Institution A' }, { label: 'Institution B' }, { label: 'Shared platform' }] },
  ]}
/>

## Key decisions

1. **The institution is the tenant.** Every investor, portfolio and configuration belongs to one institution, so isolation is a property of the data model, not a filter added in each query.
2. **Users per institution.** Each institution has its own users and roles, and no account can see across institutions.
3. **Infrastructure follows the tenant model.** Deployments, configuration and secrets were adapted so a new institution is onboarded by configuration rather than code.

Investor onboarding and KYC moved with the platform: see [investor onboarding, KYC and reconciliation](/projects/finamaze-kyc).

## Results

Numbers to come.

## Stack and links

Node.js, TypeScript, PostgreSQL, Microservices, Clean architecture
