Tenant Architecture
Site Configuration
Each site is configured with:Domain-based Resolution
The API automatically identifies tenants based on the requesting domain:- Domain Mapping:
- Request Handling:
Data Isolation
- Each tenant’s data is isolated through automatic query scoping
- Every model includes
site_idfor tenant isolation - Middleware automatically applies site filtering
Example Query Scoping
User Management
Users are associated with specific sites:Cross-tenant Features
Some features are shared across tenants:- Document Templates
- Payment Processor Configurations
- Global Settings
Available Sites
| Identifier | Name | Primary Domain |
|---|---|---|
| PSN | PaystubsNow | paystubsnow.com |
| CSM | CheckstubMaker | checkstubmaker.com |
| TBP | TheBestPaystubs | thebestpaystubs.com |
Security Considerations
- Data Isolation
- Automatic site_id filtering on all queries
- Validation of site access in middleware
- No cross-site data access allowed
- Authentication
- Site-specific user authentication
- Separate API tokens per site
- Domain-based access control
- Rate Limiting
- Per-site rate limiting
- Site-specific quota management
Best Practices
- Always Use Site Context
- Handle Multi-site Resources
- Site-specific Configurations
API Responses
All API responses include site context:Common Issues
- Cross-site Data Access
- Ensure proper site_id filtering
- Validate user site access
- Check domain access rights
- Site Configuration
- Validate site settings
- Check payment processor availability
- Verify document type access
- Domain Resolution
- Handle unknown domains
- Manage domain changes
- Support multiple domains per site

