Tenancy & Tiers — Personal / Small Business / Tenant
Three plan levels, one codebase. The level is a property of the account, enforced at three layers: session policy, API middleware, and data isolation.
1. The three levels
| Personal | Small Business | Tenant (white-label / corporate) | |
|---|---|---|---|
| Who | individual seller, freelancer | shop with staff, small finance team | company, cooperative, BPR, fintech, accounting firm |
| Users | exactly 1 | owner + up to 5 staff | unlimited staff, SSO/SAML |
| Roles | none (owner only) | owner / operator / viewer (fixed 3) | granular per-resource scopes, custom roles |
| Accounts (bank/e-wallet) | up to 3 | up to 25 | unlimited / contract |
| API keys | none — 403 + upgrade CTA | none — 403 + upgrade CTA | yes, scoped keys + per-key metering |
| Webhooks | none (notifications only) | none | yes, per-endpoint secret + replay |
| Domain | our domain only | our domain only | tenant.ourdomain.id or own domain via CNAME |
| Session | one active session, new login kicks the old | one active session per user | multi-device allowed; admin can force-logout |
| Audit log | last 30 days, own actions | 90 days, staff actions | immutable, 5 years, exportable |
| Sharing accounts between users | prohibited | prohibited | allowed only as staff assignment inside the tenant |
| Support | email, 48 h | email/WA, 24 h | named contact, SLA 99,9% |
| Price | Rp1.500/account/day | Rp2.500/account/day + Rp99k/mo | Rp6jt/mo floor + Rp25jt setup |
Deliberate inversion vs incumbents: mutasibank ships "Share Account" (share e-banking data access with other registered users, field-level hiding). We refuse it. Sharing credentials between unrelated users is the single worst PDP and bank-secrecy exposure in this category, and it is also the feature enterprise buyers ask about in vendor review. Refusing it is a sales asset, not a gap.
Moota has RBAC; mutasiku has roles + Karyawan staff logins; neither publishes an immutable audit trail, and neither gates API access by plan level — mutasibank gates API by paid tier only ("minimal paket Standard"), which we replicate as "tenant only".
2. Enforcement design
Session policy (single active login)
sessions(user_id, tenant_id, id, device_fingerprint, ip, ua, created_at, last_seen, revoked_at, revoked_reason)
- On login: insert new session, then revoke all other sessions for that user when
plan_level in ('personal','small_business'); emitsession_kickedevent + email "Anda keluar karena login di perangkat lain". - Access token carries
sid; middleware checkssessions.revoked_at IS NULLon every request (cheap Redis set:sess:active:{user_id} = {sid}). - Grace: 60-second overlap window so the new device finishes loading before the old one dies (avoids the "logged out mid-upload" support ticket).
- Tenant plan:
max_sessionsconfigurable per tenant (default 5 per user); admin console lists live sessions with force-logout.
API gating (tenant only)
plans.api_enabledboolean +api_keys(tenant_id, key_hash, scopes[], last_used, revoked_at).- Middleware order: authenticate key → load tenant →
if not plan.api_enabled: 403 {code:"plan_upgrade_required"}. - Never issue a key to a personal/SB account, not even a read-only one: a leaked personal key is a full account takeover of someone's banking data, and support cannot explain it.
- Tenant keys are scoped (
read:mutations,write:accounts,admin:webhooks) and rate-limited per key.
Data isolation
users.tenant_id NOT NULL— personal accounts are a tenant of size 1 (tenant_type='personal'). One code path, one RLS policy, no dual model.tenant_type in ('personal','small_business','corporate')drives limits via aplan_limitstable, notifstatements scattered in code.- Row-level security on every table:
SET LOCAL app.tenant_id. CI test: tenant A requests tenant B's account id → 404.
White-label
tenants.slug→{slug}.ourdomain.id; custom domain via CNAME + ACME cert; verify DNS TXT before issue.- Branding: logo, colours, email sender (SPF/DKIM per tenant domain), WhatsApp sender identity where allowed.
- Tenant-scoped webhook signing secret; tenant-scoped status page.
3. Schema sketch
plans(id, code, name, price_model, api_enabled, max_users, max_accounts, max_sessions, audit_days)
tenants(id, name, type, plan_id, slug, custom_domain, branding jsonb, created_at)
users(id, tenant_id, email, password_hash, role, totp_secret, status)
sessions(id, user_id, tenant_id, fingerprint, ip, ua, created_at, last_seen, revoked_at, revoked_reason)
roles(id, tenant_id, name, scopes jsonb) -- corporate custom roles
api_keys(id, tenant_id, key_hash, scopes, last_used, revoked_at)
audit_log(id, tenant_id, actor_id, action, resource, meta jsonb, prev_hash, hash, created_at)
plan_limits(plan_id, key, value)
Audit log is append-only with prev_hash chaining — tamper-evident without a blockchain pitch. Corporate export = CSV + signed manifest.
4. Upgrade paths & downgrade rules
- Personal → Small Business: add staff, raise account cap. Keep same tenant row (no data migration).
- Small Business → Tenant: new tenant type, enable API, trigger white-label setup, re-issue keys.
- Tenant → down: API keys revoked automatically, custom domain released after 30 days, data export offered first. Never silently delete: PDP erasure is a customer-initiated action with a certificate.
- Downgrade from Tenant with active API consumers is blocked by default — require explicit acknowledgment that integrations will break, because a silent 403 on their production webhook is a lawsuit-shaped event.
5. Pricing logic behind the tiers
Personal at Rp1.500/day (~Rp45k/mo) is the acquisition wedge and undercuts every competitor's entry price (mesinotomatis Rp900/day is a 45-minute poll; mutasiku BCA Ekonomi Rp700/day is one bank). Cap at 3 accounts so it cannot be abused as a business plan.
Small Business at Rp2.500/day + Rp99k/mo base prices the staff seats, not the accounts: 5 seats included, +Rp25k/seat/mo after. This is where most Indonesian online sellers actually sit.
Tenant at Rp6–12jt/mo is priced off procurement value, not cost: white-label + API + SLA + audit trail = the only plan that can be sold to a bank's vendor review. Setup fee covers the 40–60 engineering hours of onboarding.
6. What this changes in the build
- Session revocation + kicked-notification: new P0 ticket (it is the security promise; ship it in the Prototype).
- Plan middleware and limits table: MLP.
- Roles/audit/white-label: MMP, unchanged.
- Remove "team RBAC + audit" as the headline differentiator (mutasiku ships roles, moota ships RBAC); the differentiators are now single-session security, no account sharing, API gated to tenant, white-label, published compliance.