Business Requirements
Problem Statement
In a multi-tenant SaaS platform, platform administrators need a secure way to manage tenants, monitor system health, and perform cross-tenant operations without exposing these capabilities to regular users. The SuperAdmin module provides an isolated interface for these critical platform operations.
Use Cases
1. Tenant Management
Actor: Platform Administrator (Super Admin)
Flow:
- View list of all tenants with key metrics
- Create new tenant with custom configuration
- View detailed tenant information
- Update tenant settings (name, plan, max users)
- Soft-delete tenant (data preserved, access revoked)
- Export tenant data
Acceptance Criteria:
- All tenants visible across organization boundaries
- Tenant creation with proper isolation setup
- Audit trail for all tenant operations
- Soft deletes preserve data for recovery
2. User Management Across Tenants
Actor: Platform Administrator
Flow:
- View users across all tenants with filtering
- Search users by email or name
- View user details and tenant affiliation
- Reset user password
- Manage super admin accounts
Acceptance Criteria:
- Cross-tenant user visibility
- Search/filter functionality
- Password reset capability
- User type modification
3. Platform Analytics
Actor: Platform Administrator, Finance Team
Flow:
- View total tenant count (active, trial, deleted)
- View total user statistics (total, active today/week/month)
- View system resource usage (storage, API calls)
- View activity trends (signups, usage over time)
- Filter metrics by date range
Acceptance Criteria:
- Real-time metric availability
- Time-series data for trends
- Exportable analytics
- Performance monitoring data
4. System Monitoring
Actor: Operations Team, Support Team
Flow:
- Access dashboard with health status
- View server metrics and resource usage
- Monitor error rates and latency
- Check database connectivity
- Review audit logs for suspicious activity
Acceptance Criteria:
- Real-time health checks
- Performance metrics visibility
- Error tracking and alerts
- Comprehensive logging
5. Session Management
Actor: Support Team
Flow:
- Invalidate user sessions (force logout)
- View active sessions across system
- Terminate suspicious sessions
Acceptance Criteria:
- Session revocation capability
- Active session visibility
- Immediate effect on terminated sessions
Business Rules
User Type Rules
- Regular Users
- Scoped to single tenant
- Cannot access super admin features
- Limited to their organization
- Super Admin Users
- No tenant affiliation
- Access to all platform data
- Can create/modify/delete tenants
- Can manage other super admin accounts
Tenant Rules
- Isolation
- Users belong to single tenant
- Data never visible across tenants
- Each tenant has independent configuration
- Lifecycle
- Tenants can be in states: active, trial, suspended, deleted
- Soft deletes preserve historical data
- Billing based on active tenants
Security Rules
- Access Control
- Only super admin users can access SuperAdmin module
- Super admin accounts created via database only
- Session-based authentication with expiration
- Audit Requirements
- All tenant operations logged with user, timestamp, action
- All user management operations audited
- Suspicious activity flagged for review
- Data Protection
- All queries use parameterized statements
- No raw SQL concatenation
- Database credentials stored in secrets management
- TLS for all database connections
Integration with Main Application
The SuperAdmin module shares:
- Database: Same PostgreSQL instance with main application
- User Table: Super admin users stored in core.users with type = ‘superadmin’
- Sessions: Same session management as main application
- Configuration: Same environment variables
Key Metrics Tracked
Tenant Metrics
- Total active tenants
- Total trial tenants
- Total deleted tenants
- Tenant signup trends
User Metrics
- Total users across platform
- Active users (DAU - Daily Active Users)
- Weekly active users (WAU)
- Monthly active users (MAU)
- New signups trend
System Metrics
- Total database size
- Storage usage across tenants
- API calls per day
- Error rates
- Response times (p50, p95, p99)
Success Criteria
- Usability
- Dashboard loads in < 1 second
- Filtering/searching works in < 500ms
- All operations respond within 2 seconds
- Reliability
- 99.9% uptime (separate from main app)
- Audit logs never lost
- Data consistency maintained
- Security
- Zero unauthorized super admin accounts
- All operations logged and audited
- No data leakage between tenants
- Regular security audits passing
- Scalability
- Supports millions of users across thousands of tenants
- Dashboard metrics available in real-time
- Efficient cross-tenant queries
Constraints
- Deployment
- Must run as separate service
- Cannot mix with main application code
- Requires dedicated configuration
- Data Access
- Cannot modify regular user data directly
- Cannot delete data (only soft delete for tenants)
- Cannot access individual tenant business logic
- Performance
- Analytics queries must not impact main application
- Dashboard should use caching for metrics
- Separate database connection pool recommended