Getting NexaLink ISP SaaS architecture right starts with one decision: how tenants are isolated.
NexaLink is an ISP management platform: subscribers, plans, invoices, vouchers, and RouterOS automation for small operators who cannot justify a carrier-grade OSS. Multi-tenancy was the first architectural decision and the one everything else inherited.
NexaLink ISP SaaS Architecture: The Two Options
Schema-per-tenant. One database, one PostgreSQL schema per ISP. Strong isolation, easy per-tenant restore, and a satisfying mental model.
Row-level. One shared set of tables, a tenant_id on every row, enforced globally.
NexaLink ships row-level. The deciding factor was not performance — it was operations. With 200 tenants, schema-per-tenant means 200 schema migrations per release, 200 sets of connection pools, and a migration failure on tenant 147 leaving the fleet in mixed states. Row-level makes a release one migration and one rollback path.
Where schema-per-tenant wins: a handful of large tenants demanding physical separation, or per-tenant custom fields. That was not the target customer.

Making row-level safe
The risk with row-level isolation is a forgotten where tenant_id = ?. Three layers stop it:
- Tenant context from middleware. Resolved from the authenticated user, never from user-supplied input.
- A global query scope on every tenant-owned model, applied by a base class so a new model cannot opt out by omission.
- Row-level security in PostgreSQL as the backstop, so even a raw query in a background job cannot cross tenants.
Then the test suite: every tenant-owned resource has a test that authenticates as tenant A and asserts a request for tenant B's record returns 404, not 403. A 403 confirms the record exists — that itself is a small leak.
Per-tenant restore in a row-level model
Row-level tenancy’s real trade-off against schema-per-tenant shows up at restore time, not at migration time. A full database backup restores the whole platform cleanly; pulling one tenant’s data back out of that backup after an operator’s own mistake – a bad bulk-delete of subscribers, say – means a selective restore keyed on tenant_id across every affected table, not a single schema swap.
NexaLink’s answer is a scheduled logical export per tenant (plain pg_dump filtered by tenant, scripted rather than clicked) sitting alongside the full physical backup – slower to produce than a schema-per-tenant restore would be, but it means one operator’s incident never requires restoring and then re-exporting data for every other tenant on the platform just to isolate one tenant’s rows back out again.
FreeRADIUS in a shared platform
The RADIUS schema was the interesting part. Subscribers from different ISPs share radcheck e radacct, and usernames collide — ali exists at three ISPs.
The fix is a realm-qualified username: ali@tenant-slug. 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.
radacct is the heaviest table by far. It is partitioned by month, with old partitions detached to cold storage after the billing dispute window closes.
Noisy-neighbor tenants in a shared database
Row-level tenancy means every tenant shares the same database connection pool and the same query planner’s attention – a reporting query one operator runs against their own 50,000 subscribers can slow down every other tenant’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:
- A separate read-replica connection for reporting/export queries, never the same connection pool that serves the operator dashboard and the RADIUS-facing API – 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.
- Per-tenant query timeouts enforced at the application layer, not left to the database default – a runaway query from one tenant’s bulk CSV export should fail that one request, not queue up behind every other tenant’s traffic.
Automating RouterOS safely
Pushing configuration to customer routers from a SaaS is the feature operators want and the one most likely to cause a bad day.
Rules NexaLink follows:
- Never push a full configuration. Only additive, scoped commands, each idempotent.
- Queue every change, with a per-router serial worker. Two concurrent changes to one router is how you get a half-applied firewall.
- Read back and verify after each change; a job is not complete until the router confirms the resulting state.
- A dry-run mode that renders the exact commands for the operator to review. Trust is earned by showing your work.
- A hard stop on rules affecting management access. No automation should be able to lock the operator out of their own router.
The migration I would undo
Early on, invoices stored the plan's price as a foreign key to the plan record instead of copying the amount onto the invoice line. It worked until the first ISP raised prices — and every historical invoice silently re-priced itself. Reconciling six months of already-paid invoices against changed totals was a weekend I will not get back.
Financial records must be immutable snapshots. Copy the price, the tax rate, the plan name, and the currency onto the document at issue time. Reference the plan for reporting if you like, but never for the number the customer paid.
What I would keep
- Row-level tenancy with enforcement at three layers.
- Realm-qualified RADIUS usernames from the first commit.
- Queued, verified, idempotent router automation.
- Immutable financial documents.
- Boring, well-understood infrastructure — PostgreSQL, Laravel, Redis — so the interesting problems stay in the ISP domain, not the plumbing.
Onboarding a new ISP tenant without a support ticket
The gap between “sign up” and “actually provisioning subscribers” is where a lot of self-serve SaaS platforms quietly lose tenants to a support queue. NexaLink’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:
- RADIUS realm slug chosen at signup, not editable later – since it is baked into every subscriber’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.
- At least one bandwidth plan created before the first voucher can be issued – 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.
- A test RouterOS connection verified during setup, using the same dry-run mode described above, so a credential or firewall mistake surfaces as a setup-screen error instead of a “why isn’t anything working” ticket after the first real voucher is sold.
Niente di tutto ciò è complicato singolarmente. La disciplina consiste semplicemente nel rifiutare di permettere a un inquilino di raggiungere “sell your first voucher” con una di queste tre ancora indecisa.
Se gestisci un piccolo ISP e questo stack ti sembra ciò che hai assemblato a mano, è esattamente il divario. NexaLink esiste per colmare.
