{"id":6146,"date":"2026-03-30T13:00:00","date_gmt":"2026-03-30T08:00:00","guid":{"rendered":"https:\/\/zilleali.com\/nexalink-multi-tenant-architecture\/"},"modified":"2026-11-25T16:07:46","modified_gmt":"2026-11-25T11:07:46","slug":"nexalink-multi-tenant-architecture","status":"publish","type":"post","link":"https:\/\/zilleali.com\/fr\/nexalink-multi-tenant-architecture\/","title":{"rendered":"Concevoir un SaaS ISP multi\u2011locataire : le\u00e7ons de NexaLink"},"content":{"rendered":"<p>Bien concevoir l'architecture SaaS de NexaLink ISP commence par une d\u00e9cision : comment les locataires sont isol\u00e9s.<\/p>\n<p>NexaLink est une plateforme de gestion d'ISP\u202f: abonn\u00e9s, forfaits, factures, bons, et automatisation RouterOS pour les petits op\u00e9rateurs qui ne peuvent pas justifier un OSS de niveau op\u00e9rateur. La multi\u2011location a \u00e9t\u00e9 la premi\u00e8re d\u00e9cision architecturale et celle dont tout le reste a h\u00e9rit\u00e9.<\/p>\n<h2 id=\"nexalink-isp-saas-architecture-the-two-options\">Architecture SaaS de NexaLink ISP\u202f: les deux options<\/h2>\n<p><strong>Sch\u00e9ma par locataire.<\/strong> Une base de donn\u00e9es, un sch\u00e9ma PostgreSQL par ISP. Isolation forte, restauration par locataire facile, et un mod\u00e8le mental satisfaisant.<\/p>\n<p><strong>Niveau ligne.<\/strong> Un ensemble de tables partag\u00e9, un <code>tenant_id<\/code> sur chaque ligne, appliqu\u00e9 globalement.<\/p>\n<p>NexaLink propose la s\u00e9curit\u00e9 au niveau ligne. Le facteur d\u00e9cisif n'\u00e9tait pas la performance \u2014 c'\u00e9tait l'exploitation. Avec 200 locataires, le sch\u00e9ma\u2011par\u2011locataire implique 200 migrations de sch\u00e9ma par version, 200 ensembles de pools de connexion, et un \u00e9chec de migration sur le locataire 147 laissant l'ensemble dans des \u00e9tats mixtes. Le niveau ligne ne n\u00e9cessite qu'une migration et un chemin de retour par version.<\/p>\n<p>O\u00f9 le sch\u00e9ma\u2011par\u2011locataire l'emporte\u202f: quelques gros locataires exigeant une s\u00e9paration physique, ou des champs personnalis\u00e9s par locataire. Ce n'\u00e9tait pas le client vis\u00e9.<\/p>\n<p><picture><source srcset=\"https:\/\/zilleali.com\/wp-content\/uploads\/2026\/11\/nexalink-multi-tenant-architecture-supporting-1.webp\" type=\"image\/webp\"><img decoding=\"async\" src=\"https:\/\/zilleali.com\/wp-content\/uploads\/2026\/11\/nexalink-multi-tenant-architecture-supporting-1.webp\" alt=\"NexaLink ISP SaaS architecture: row-level multi-tenant isolation with ISP operators, Laravel tenant middleware and PostgreSQL rows scoped by tenant_id\"><\/picture><\/p>\n<h2 id=\"making-row-level-safe\">Rendre le niveau ligne s\u00fbr<\/h2>\n<p>Le risque avec <a href=\"https:\/\/www.postgresql.org\/docs\/current\/ddl-rowsecurity.html\">l'isolation au niveau ligne<\/a> est un oubli <code>where tenant_id = ?<\/code>. Trois couches l'emp\u00eachent\u202f:<\/p>\n<ol>\n<li><strong>Contexte locataire depuis le middleware.<\/strong> R\u00e9solu \u00e0 partir de l'utilisateur authentifi\u00e9, jamais \u00e0 partir d'une entr\u00e9e fournie par l'utilisateur.<\/li>\n<li><strong>Une port\u00e9e de requ\u00eate globale sur chaque mod\u00e8le appartenant \u00e0 un locataire<\/strong>, appliqu\u00e9e par une classe de base afin qu'un nouveau mod\u00e8le ne puisse pas se d\u00e9sengager par omission.<\/li>\n<li><strong>S\u00e9curit\u00e9 au niveau ligne dans PostgreSQL<\/strong> comme filet de s\u00e9curit\u00e9, de sorte qu'une requ\u00eate brute dans un job en arri\u00e8re\u2011plan ne puisse pas traverser les locataires.<\/li>\n<\/ol>\n<p>Puis la suite de tests\u202f: chaque ressource appartenant \u00e0 un locataire poss\u00e8de un test qui s'authentifie en tant que locataire A et v\u00e9rifie qu'une requ\u00eate pour l'enregistrement du locataire B renvoie 404, pas 403. Un 403 confirme que l'enregistrement existe \u2014 ce qui constitue d\u00e9j\u00e0 une petite fuite.<\/p>\n<h2 id=\"per-tenant-restore-in-a-row-level-model\">Restauration par locataire dans un mod\u00e8le au niveau ligne<\/h2>\n<p>Le v\u00e9ritable compromis de la location au niveau ligne par rapport au sch\u00e9ma\u2011par\u2011locataire appara\u00eet lors de la restauration, pas lors de la migration. Une sauvegarde compl\u00e8te de la base de donn\u00e9es restaure toute la plateforme proprement\u202f; extraire les donn\u00e9es d'un locataire de cette sauvegarde apr\u00e8s une erreur de l'op\u00e9rateur \u2013 par exemple une suppression massive d'abonn\u00e9s \u2013 implique une restauration s\u00e9lective bas\u00e9e sur <code>tenant_id<\/code> dans chaque table affect\u00e9e, et non un simple \u00e9change de sch\u00e9ma.<\/p>\n<p>La solution de NexaLink est une exportation logique planifi\u00e9e par locataire (plain <code>pg_dump<\/code> filtr\u00e9 par locataire, script\u00e9 plut\u00f4t que cliqu\u00e9) plac\u00e9 \u00e0 c\u00f4t\u00e9 de la sauvegarde physique compl\u00e8te \u2013 plus lent \u00e0 produire qu\u2019une restauration sch\u00e9ma\u2011par\u2011locataire, mais cela signifie qu'un incident d'op\u00e9rateur ne n\u00e9cessite jamais de restaurer puis de r\u00e9\u2011exporter les donn\u00e9es de chaque autre locataire sur la plateforme simplement pour isoler \u00e0 nouveau les lignes d'un seul locataire.<\/p>\n<h2 id=\"freeradius-in-a-shared-platform\">FreeRADIUS sur une plateforme partag\u00e9e<\/h2>\n<p>Le sch\u00e9ma RADIUS \u00e9tait la partie int\u00e9ressante. Les abonn\u00e9s de diff\u00e9rents ISP partagent <code>radcheck<\/code> et <code>radacct<\/code>, et les noms d'utilisateur entrent en collision \u2014 <code>ali<\/code> existe chez trois ISP.<\/p>\n<p>La solution est un nom d'utilisateur qualifi\u00e9 par domaine\u202f: <code>ali@tenant-slug<\/code>. RouterOS sends it verbatim, FreeRADIUS resolves the tenant from the realm, and accounting rows carry the tenant along for free. Retrofitting this later would have meant reissuing every subscriber credential on the platform, so it is worth deciding on day one.<\/p>\n<p><code>radacct<\/code> is the heaviest table by far. It is partitioned by month, with old partitions detached to cold storage after the billing dispute window closes.<\/p>\n<h2 id=\"noisy-neighbor-tenants-in-a-shared-database\">Noisy-neighbor tenants in a shared database<\/h2>\n<p>Row-level tenancy means every tenant shares the same database connection pool and the same query planner&#8217;s attention &#8211; a reporting query one operator runs against their own 50,000 subscribers can slow down every other tenant&#8217;s dashboard at the same moment, something schema-per-tenant isolation would never expose the platform to. Two things keep this from becoming a recurring incident:<\/p>\n<ul>\n<li><strong>A separate read-replica connection for reporting\/export queries<\/strong>, never the same connection pool that serves the operator dashboard and the RADIUS-facing API &#8211; an expensive analytics query degrading reporting for one tenant is an inconvenience; the same query degrading live PPPoE authentication for every tenant is an outage.<\/li>\n<li><strong>Per-tenant query timeouts enforced at the application layer<\/strong>, not left to the database default &#8211; a runaway query from one tenant&#8217;s bulk CSV export should fail that one request, not queue up behind every other tenant&#8217;s traffic.<\/li>\n<\/ul>\n<h2 id=\"automating-routeros-safely\">Automating RouterOS safely<\/h2>\n<p>Pushing configuration to customer routers from a SaaS is the feature operators want and the one most likely to cause a bad day.<\/p>\n<p>Rules NexaLink follows:<\/p>\n<ul>\n<li><strong>Never push a full configuration.<\/strong> Uniquement des commandes additives, d\u00e9limit\u00e9es, chacune \u00e9tant idempotente.<\/li>\n<li><strong>Mettre chaque changement en file d'attente<\/strong>, avec un travailleur s\u00e9riel par routeur. Deux changements concurrents sur un m\u00eame routeur sont la fa\u00e7on dont on obtient un pare-feu partiellement appliqu\u00e9.<\/li>\n<li><strong>Lire \u00e0 nouveau et v\u00e9rifier<\/strong> apr\u00e8s chaque changement ; un travail n'est pas termin\u00e9 tant que le routeur ne confirme pas l'\u00e9tat r\u00e9sultant.<\/li>\n<li><strong>Un mode test sans ex\u00e9cution<\/strong> qui g\u00e9n\u00e8re les commandes exactes pour que l'op\u00e9rateur puisse les examiner. La confiance se gagne en montrant votre travail.<\/li>\n<li><strong>Un arr\u00eat brutal sur les r\u00e8gles affectant l'acc\u00e8s de gestion.<\/strong> Aucune automatisation ne doit pouvoir verrouiller l'op\u00e9rateur hors de son propre routeur.<\/li>\n<\/ul>\n<h2 id=\"the-migration-i-would-undo\">La migration que je r\u00e9voquerais<\/h2>\n<p>Au d\u00e9but, les factures stockaient le prix du plan comme cl\u00e9 \u00e9trang\u00e8re vers l'enregistrement du plan au lieu de copier le montant sur la ligne de facture. Cela fonctionnait jusqu'au premier FAI qui augmentait les prix \u2014 et chaque facture historique se revalorisait silencieusement. R\u00e9concilier six mois de factures d\u00e9j\u00e0 pay\u00e9es avec les totaux modifi\u00e9s a \u00e9t\u00e9 un week-end que je ne r\u00e9cup\u00e9rerai pas.<\/p>\n<p><strong>Les dossiers financiers doivent \u00eatre des instantan\u00e9s immuables.<\/strong> Copiez le prix, le taux d'imposition, le nom du plan et la devise sur le document au moment de son \u00e9mission. R\u00e9f\u00e9rez-vous au plan pour les rapports si vous le souhaitez, mais jamais pour le montant que le client a pay\u00e9.<\/p>\n<h2 id=\"what-i-would-keep\">Ce que je garderais<\/h2>\n<ul>\n<li>La location au niveau de la ligne avec application \u00e0 trois niveaux.<\/li>\n<li>Noms d'utilisateur RADIUS qualifi\u00e9s par domaine depuis le premier commit.<\/li>\n<li>Automatisation de routeur mise en file d'attente, v\u00e9rifi\u00e9e, idempotente.<\/li>\n<li>Documents financiers immuables.<\/li>\n<li>Infrastructure ennuyeuse et bien comprise \u2014 PostgreSQL, Laravel, Redis \u2014 afin que les probl\u00e8mes int\u00e9ressants restent dans le domaine du FAI, pas dans la plomberie.<\/li>\n<\/ul>\n<h2 id=\"onboarding-a-new-isp-tenant-without-a-support-ticket\">Onboarding a new ISP tenant without a support ticket<\/h2>\n<p>The gap between &#8220;sign up&#8221; and &#8220;actually provisioning subscribers&#8221; is where a lot of self-serve SaaS platforms quietly lose tenants to a support queue. NexaLink&#8217;s onboarding flow deliberately front-loads three decisions a new ISP has to make before their first voucher is issued, rather than letting them discover each one mid-setup:<\/p>\n<ul>\n<li><strong>RADIUS realm slug chosen at signup, not editable later<\/strong> &#8211; since it is baked into every subscriber&#8217;s username from the first activation, changing it after real customers exist means reissuing credentials, exactly the mistake the realm-qualified username design above was built to avoid repeating.<\/li>\n<li><strong>At least one bandwidth plan created before the first voucher can be issued<\/strong> &#8211; a platform that lets an operator generate vouchers with no plan attached just moves the error from signup time to the first angry subscriber call.<\/li>\n<li><strong>A test RouterOS connection verified during setup<\/strong>, using the same dry-run mode described above, so a credential or firewall mistake surfaces as a setup-screen error instead of a &#8220;why isn&#8217;t anything working&#8221; ticket after the first real voucher is sold.<\/li>\n<\/ul>\n<p>None of this is complicated individually. The discipline is simply refusing to let a tenant reach &#8220;sell your first voucher&#8221; with any of these three still undecided.<\/p>\n<p>Si vous exploitez un petit FAI et que cette pile ressemble \u00e0 ce que vous avez assembl\u00e9 \u00e0 la main, c'est exactement le foss\u00e9 <a href=\"\/fr\/nexalink\/\">NexaLink<\/a> qui doit \u00eatre combl\u00e9.<\/p>","protected":false},"excerpt":{"rendered":"<p>Niveau de ligne vs sch\u00e9ma par locataire, FreeRADIUS sur une plateforme partag\u00e9e, automatisation s\u00e9curis\u00e9e de RouterOS, et l'erreur de migration que je corrigerais si je le pouvais.<\/p>","protected":false},"author":1,"featured_media":6415,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"googlesitekit_rrm_CAow6N_ODA:productID":"","_chatbot_visible":"","_zea_seo_title":"NexaLink ISP SaaS Architecture: Multi-Tenant Lessons","_zea_seo_description":"NexaLink ISP SaaS architecture: row-level vs schema-per-tenant, FreeRADIUS in a shared platform, and the migration mistake worth avoiding.","_zea_seo_focus_keyphrase":"NexaLink ISP SaaS architecture","_zea_seo_canonical":"","_zea_seo_robots_noindex":false,"_zea_seo_robots_nofollow":false,"_zea_seo_sitemap_exclude":false,"_zea_seo_cornerstone":false,"_zea_seo_sitemap_priority":"","_zea_seo_og_title":"Designing a Multi-Tenant ISP SaaS: NexaLink Architecture","_zea_seo_og_description":"Behind the scenes of NexaLink: multi-tenant database partitioning, automated MikroTik API provisioning, and billing webhooks.","_zea_seo_og_image":"https:\/\/zilleali.com\/wp-content\/uploads\/2026\/11\/card_post_isp_ops.jpg","_zea_seo_twitter_title":"Designing a Multi-Tenant ISP SaaS: NexaLink Architecture","_zea_seo_twitter_description":"Behind the scenes of NexaLink: multi-tenant database partitioning, automated MikroTik API provisioning, and billing webhooks.","_zea_seo_analysis_score":0,"_zea_ai_pending":false,"_zea_ai_notes":"","_zea_ai_keyword":"","footnotes":""},"categories":[214],"tags":[218,201,198,217,215,216],"class_list":["post-6146","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nexalink","tag-architecture","tag-freeradius","tag-isp","tag-laravel","tag-nexalink","tag-saas"],"_links":{"self":[{"href":"https:\/\/zilleali.com\/fr\/wp-json\/wp\/v2\/posts\/6146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zilleali.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zilleali.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zilleali.com\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zilleali.com\/fr\/wp-json\/wp\/v2\/comments?post=6146"}],"version-history":[{"count":8,"href":"https:\/\/zilleali.com\/fr\/wp-json\/wp\/v2\/posts\/6146\/revisions"}],"predecessor-version":[{"id":6388,"href":"https:\/\/zilleali.com\/fr\/wp-json\/wp\/v2\/posts\/6146\/revisions\/6388"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zilleali.com\/fr\/wp-json\/wp\/v2\/media\/6415"}],"wp:attachment":[{"href":"https:\/\/zilleali.com\/fr\/wp-json\/wp\/v2\/media?parent=6146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zilleali.com\/fr\/wp-json\/wp\/v2\/categories?post=6146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zilleali.com\/fr\/wp-json\/wp\/v2\/tags?post=6146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}