Overview
SaaS Plans define the subscription tiers and resource limits for tenant organizations. Each plan specifies constraints like maximum users, pricing, and feature availability. Tenants are assigned a plan which governs their resource allocation, though individual limits can be overridden on a per-tenant basis.Plan Model
Plans are stored in thepublic.saas_plans table and contain the following attributes:
Plan Schema
Unique plan identifier
Plan name (e.g., “Starter”, “Professional”, “Enterprise”)
- Maximum length: 100 characters
Detailed description of plan features and capabilities
Monthly subscription price in local currency
- Precision: 10 digits total, 2 decimal places
- Default: 0.00
Whether the plan is currently available for new subscriptions
- Default: true
Maximum number of active users allowed for tenants on this plan
- Default: 3
- Can be overridden per tenant using
Tenant.max_users_override
ISO 8601 timestamp when the plan was created
ISO 8601 timestamp of the last plan update
Plan Limits
Plans enforce resource constraints on tenant organizations. The primary limit currently implemented is user capacity, with the architecture designed to support additional limits in the future.User Limits
How User Limits Work
- Plan Default: Each plan has a
max_usersvalue that applies to all tenants on that plan - Tenant Override: Individual tenants can have a custom limit via
max_users_overridefield - Active Users Only: Only users with
is_active = truecount toward the limit - Validation: User assignment endpoints check limits before allowing new users
Limit Priority
Example Plans
Future Limit Types
The plan architecture is designed to support additional resource limits:max_documents: Maximum number of invoices/documents per monthmax_storage_gb: Storage capacity in gigabytesmax_api_calls: API rate limiting per monthmax_locations: Number of physical store locationsmax_pos_terminals: Number of point-of-sale terminals
saas_plans table and enforced by the respective API endpoints.
Plan Tiers and Features
Typical Plan Structure
While specific plan configurations are managed in the database, typical SaaS tiers follow this pattern:Starter
Starter
Target: Small businesses and startupsFeatures:
- Up to 3 active users
- Basic DTE (electronic invoice) support
- Standard support
- Single location
Professional
Professional
Target: Growing businessesFeatures:
- Up to 10 active users
- Full DTE capabilities
- Priority support
- Multiple locations
- Advanced reporting
Enterprise
Enterprise
Target: Large organizationsFeatures:
- 50+ active users (or custom limit)
- Complete DTE suite
- Dedicated support
- Unlimited locations
- Custom integrations
- API access
- SLA guarantees
Custom
Custom
Target: Enterprise with special requirementsFeatures:
- Custom user limits via override
- Tailored feature set
- White-label options
- Custom integrations
- Dedicated infrastructure
Plan Assignment
Plans are assigned to tenants via theplan_id foreign key in the tenants table.
Setting a Plan
When creating or updating a tenant:Overriding Plan Limits
For custom arrangements, override the user limit:max_users value.
Database Schema
Thesaas_plans table structure:
Relationships
- One-to-Many with Tenants: A plan can be assigned to multiple tenants
- Referenced by:
tenants.plan_idforeign key - Cascade Behavior: Tenants can exist without a plan (plan_id is nullable)
Plan Management
Currently, plan management (create, update, delete) is performed directly via database administration. Future API endpoints may be added for dynamic plan management.