Building SaaS Is Different from Building Software
Running a SaaS product means your software must work for hundreds or thousands of organizations simultaneously, with data isolation, subscription management, and five-nines availability. At Nexis Limited, we operate four SaaS products in production, and the lessons from building them inform every enterprise project we take on.
Multi-Tenancy Architecture
Nexis uses a database-per-schema multi-tenancy model for most SaaS products. Each tenant gets an isolated PostgreSQL schema within a shared database cluster. This balances data isolation with operational simplicity:
Why Schema-Level Isolation
- Data safety — a bug in one tenant's query cannot accidentally access another tenant's data
- Performance isolation — heavy queries from one tenant don't impact connection pools for others
- Simpler compliance — data residency and deletion requests are straightforward per-schema operations
- Cost efficiency — shared infrastructure avoids the operational overhead of database-per-tenant
Row-Level Security as Defense-in-Depth
On top of schema isolation, we implement PostgreSQL Row-Level Security (RLS) policies as a defense-in-depth measure. Even if application code contains a bug that bypasses the schema routing layer, RLS ensures queries are filtered by tenant_id at the database level.
Authentication & Authorization
Every Nexis SaaS product implements a role-based access control (RBAC) system with granular permissions:
- Organization-level roles — Owner, Admin, Manager, Member, Viewer
- Feature-level permissions — create, read, update, delete per resource type
- Branch/department scoping — users can be restricted to specific branches or departments
- API key management — machine-to-machine access with scoped permissions
Subscription & Billing
Nexis SaaS products use a modular billing architecture:
- Plan tiers with feature gates (Starter, Professional, Enterprise)
- Usage-based billing for metered resources (API calls, storage, users)
- Stripe integration for international payments, with local payment gateway support for Bangladesh
- Webhook-driven billing events for real-time usage tracking
Scaling Patterns
Our SaaS products scale using several proven patterns:
Horizontal Application Scaling
Stateless application servers behind a load balancer. Kubernetes handles auto-scaling based on CPU, memory, and custom metrics (request queue depth, connection count).
Database Scaling
Read replicas for reporting and analytics queries. Connection pooling with PgBouncer. Table partitioning for time-series data (audit logs, analytics events).
Caching Strategy
Redis caching with intelligent TTLs: short TTLs for frequently-changing data (dashboards), longer TTLs for reference data (product catalogs, configuration). Cache invalidation uses a pub/sub pattern for multi-instance consistency.
Deployment & Zero-Downtime Updates
SaaS products cannot afford downtime for deployments. Nexis uses:
- Blue-green deployments — deploy to a new environment, run health checks, then switch traffic
- Database migration safety — all schema changes are backward-compatible, deployed separately from application code
- Feature flags — new features are deployed dark and gradually rolled out to tenants
Monitoring SaaS Health
Key metrics Nexis tracks for SaaS operations:
- Tenant-level latency — P50, P95, P99 response times per tenant
- Error rates — aggregate and per-tenant error tracking
- Resource utilization — database connections, cache hit rates, queue depths
- Business metrics — active tenants, API usage, feature adoption
Lessons from Building 4 SaaS Products
The biggest lessons Nexis has learned from operating SaaS in production:
- Invest in onboarding early — a smooth first experience determines trial-to-paid conversion
- Monitoring > Testing — you can't test for every production scenario, but you can detect problems fast
- Multi-tenancy edge cases are the hard part — data isolation, per-tenant configuration, and fair resource allocation require constant attention
- Communication matters — status pages, changelog updates, and proactive communication build trust
Building a SaaS product? Nexis has the architecture experience to help you launch right.