Customer portal - Tenant sign-up¶
- Status: Implemented
- Prefix:
SGN - Module:
libs/web/customer(@bizos/web-customer) - Feature:
tenant-sign-up - Related: Customer portal, Register, Product home, Provisioning monitor, Tenancy lifecycle
Purpose¶
After a person registers an account, they choose a plan and enter the company details for a tenant. The account is stored as not having chosen a plan. Completing the wizard stores a tenant in the control plane, marks the plan as chosen, binds the account to that tenant, and opens the workspace. No tenant database is created.
Users and permissions¶
A signed-in account that has not chosen a plan opens /sign-up/plan. An account that has already chosen a plan opens the workspace. An admin still goes to the admin portal. Opening /sign-up/plan while signed out returns to sign-in. Opening the wizard without a registration email and without a signed-in account returns to /register. /sign-up redirects to /sign-up/plan.
Requirements¶
| ID | Priority | Requirement |
|---|---|---|
| SGN-01 | Must | A successful registration opens the plan step at /sign-up/plan. The registration email and full name are carried forward. The password is not. Opening the wizard without that email and without a signed-in account returns to /register. |
| SGN-02 | Must | The wizard has four steps in a stepper: Chọn gói, Thông tin doanh nghiệp, Thanh toán, Hoàn tất. The plan step shows BizOS Starter (4.900.000 đ / năm), BizOS Business (9.900.000 đ / năm), and BizOS Enterprise Cloud Pro (18.900.000 đ / năm) side by side, stacked on a narrow screen. Each card shows its seats, storage, API calls, AI Copilot tokens, and benefits. Enterprise Cloud Pro is selected first and marked Được chọn nhiều. Only the selected card has the accent border and reads Đã chọn gói này. The summary under the cards shows the selected plan and its total with 10% VAT. |
| SGN-03 | Must | The company step collects a required display name, an optional legal name, and a subdomain shown as subdomain.<root-domain>. admin, api, app, www, status, and mail are rejected, including different letter case. |
| SGN-04 | Must | The payment step shows the email, plan, company name, subdomain, plan price, VAT, renewal date, total, a sample QR code, and placeholder bank details. Back returns to the company step with the values still filled. Tôi đã thanh toán opens the done step, which shows a transaction code, the amount, and the end date. |
| SGN-05 | Must | Vào trang quản trị on the done step calls POST /api/auth/plan-chosen once with the plan, display name, legal name, subdomain, storage maximum, and user maximum, then opens the workspace. No request is sent before that button. |
| SGN-06 | Must | A new account is stored with the plan not chosen. Signing in or finishing registration opens /sign-up/plan. Submitting the wizard marks the plan as chosen and opens the workspace. An account that already chose a plan is not sent to the wizard. / stays the marketing landing. |
| SGN-07 | Must | That submit stores one control-plane tenant in state provisioning, with the display name, optional legal name, subdomain, plan Starter, Standard, or Advanced, and the signed-in account as owner. A subdomain already used by another email is rejected and the plan stays unchosen. The same owner can submit again and the plan on that row is updated. No database is created. The account is marked as having chosen a plan only after the row exists. |
| SGN-08 | Must | The wizard sends Starter as plan starter with 20 GB and 20 users, Business as standard with 50 GB and 30 users, and Enterprise Cloud Pro as advanced with 50 GB and 40 users, where 1 GB is 1,073,741,824 bytes. These differ from the cards, which show 5, 10, and 20 seats and 100 GB for Enterprise Cloud Pro, because the API accepts only storage of 5, 10, 20, 35, or 50 GB at or above the plan default (5, 10, and 35 GB) and a user maximum of 20, 30, 40, 50, or 100 at or above the plan default (20, 30, and 40). The sent amounts are the tenant storage maximum and user maximum. Used storage starts at 0 and the user count starts at 1. The signed-in account is stored with that tenant id, and /api/auth/me and sign-in return it. A later user created by that account belongs to the same tenant, is the only kind of user that account lists, and increases the tenant user count by 1. Submitting again changes the caps to the new choices and keeps a used amount or user count that is already stored. Accounts with no tenant id, including development and admin accounts, stay unbound and keep the unscoped user list. |
| SGN-09 | Must | A successful submit changes an account whose role is user to tenant_owner before the plan is marked chosen. Sign-in and /api/auth/me then return that role. A subdomain already used does not change the role. Accounts that are already admin, super_admin, or tenant_owner keep their role. Registration still stores the account as user. |
Screens¶
/register creates the account and a session. Đăng ký Demo on the homepage opens a popup and, after registration, opens /sign-up/plan. /sign-up redirects there. The wizard uses the same look as the plan upgrade page at /billing/upgrade. The plan step has Về trang chủ, which opens / without signing out, and Đăng xuất, which ends the session and opens sign-in. Tiếp tục chọn gói on the landing returns to /sign-up/plan.
- Chọn gói: three cards, BizOS Starter, BizOS Business, and BizOS Enterprise Cloud Pro, with yearly prices, resources, and benefits. A summary shows the total with VAT.
- Thông tin doanh nghiệp: display name, optional legal name, and subdomain, shown as
subdomain.<root-domain>. - Thanh toán: order summary with email, company name, and subdomain, a sample QR code, placeholder bank details, and Tôi đã thanh toán.
- Hoàn tất: transaction code, amount, and end date. Vào trang quản trị stores the tenant, binds the account, makes a
useraccount the tenant owner, marks the plan as chosen, and opens the workspace. A subdomain already used shows Subdomain này đã được dùng. and a button back to the company step.
Business rules¶
- The tenant row stores the company details. The database name is
bizos_t_plus the subdomain, with hyphens replaced by underscores, and the database itself is not created. - Reserved subdomains match the tenancy list:
admin,api,app,www,status, andmail. - BizOS Starter is stored as Starter, BizOS Business as Standard, and BizOS Enterprise Cloud Pro as Advanced.
- The stored storage maximum is 20, 50, and 50 GB. Used storage starts at 0 and the user count starts at 1. A later submit by the same owner changes only the cap when usage or the user count is already stored.
- The signed-in account stores that tenant id. Listing or creating users from that account stays inside the tenant, and each created user increases the tenant user count by 1.
- Existing accounts, including admins and development accounts, keep the plan as already chosen and stay unbound from a tenant.
- Registration stores role
user. A successful plan submit changes that role totenant_owner. An admin, super admin, or existing tenant owner keeps their role. A rejected subdomain does not change the role.
Acceptance criteria¶
- SGN-01: Given a successful registration, when it finishes, then
/sign-up/planis open and the password was not carried forward. Given the wizard with no registration email and no session, then/registeris shown. - SGN-02: Given the plan step, when it is shown, then the three plans are shown, Enterprise Cloud Pro reads Đã chọn gói này, and the total is 20.790.000 đ. Choosing BizOS Business changes the total to 10.890.000 đ.
- SGN-03: Given subdomain
Admin, when they continue, then the company step stays open. - SGN-04: Given the payment step, when it is shown, then email, plan, company name, and subdomain are visible. Back keeps the subdomain. Tôi đã thanh toán opens the done step.
- SGN-05: Given the done step, when they press Vào trang quản trị, then
POST /api/auth/plan-chosenis called once with the mapped plan and caps, and the workspace opens. No request is sent before that. - SGN-06: Given an account that has not chosen a plan, when they sign in or finish registration, then
/sign-up/planopens and/stays the landing. Given they submit the wizard, then the plan is marked chosen and the workspace opens. Given an account that already chose a plan, when they open the app, then the workspace opens. - SGN-07: Given the done step, when they press Vào trang quản trị, then one provisioning tenant is stored with the display name, legal name, subdomain, plan, and signed-in owner, and no database is created. Given a subdomain owned by another email, then the done step shows Subdomain này đã được dùng. with a button back to the company step, and the plan stays unchosen. Given the same owner submits again, then the plan on that row is updated.
- SGN-08: Given BizOS Starter, Business, or Enterprise Cloud Pro, when they submit, then the request carries
starter,standard, oradvancedwith 20, 50, or 50 GB and 20, 30, or 40 users. The API rejects storage or a user maximum outside its allowed steps. Used storage is 0 and the user count is 1. Given the signed-in account, then it stores that tenant id and sign-in and/api/auth/mereturn it. Given that account lists or creates a user, then the user belongs to the same tenant and the user count increases by 1. Given the same owner submits again after usage or members exist, then the caps follow the new choices and those numbers stay. - SGN-09: Given an account with role
user, when the wizard submit succeeds, then the role becomestenant_ownerbefore the plan is marked chosen, and sign-in and/api/auth/mereturn that role. Given a subdomain owned by another email, then the role staysuser. Given an admin, super admin, or tenant owner, then their role stays the same.
Not yet implemented¶
None.
Out of scope¶
- Creating a database, provisioning steps, and the welcome email.
- The account form at
/register, which still posts to the API.