Teams
Teams
Team management, invitations, and owner / admin / member access control.
Overview
NextBento supports multi-user teams with three roles:
| Role | Capabilities |
|---|---|
| Owner | Subscription holder: billing, full team control, invite/remove anyone |
| Admin | Invite/remove members, manage non-owner roles (not billing) |
| Member | App access only |
The owner is the subscription user (subscriptions.user_id). Admins and members live in team_members.role.
Constants
From lib/config/constants.ts:
| Constant | Value | Description |
|---|---|---|
MAX_TEAM_MEMBERS | 25 | Hard cap on members per team |
INVITATION_EXPIRY_DAYS | 7 | Invite link validity |
PLAN_TEAM_MEMBER_LIMITS | 5/10/25 | Per-plan member limits |
Plan limits are member caps — not seat billing or org RBAC.
Invite Flow
- Owner or admin goes to Admin → Team
- Enters email and role (
adminormember), clicks Send Invite POST /api/teams/invitecreates invitation, sends email via Resend- Invitee receives email with link to
/accept-invitation?token=xxx - Invitee signs up or logs in, then accepts
POST /api/teams/accept-invitationadds them with the invited role
Access Control
lib/teams/access-control.ts gates features server-side:
- Billing — owners only (
/api/billing/portal, billing settings) - Invite / team management — owners and admins
- Members — app access; no billing or invite UI
API Routes
| Endpoint | Method | Description |
|---|---|---|
/api/teams/invite | POST | Create invitation (role: admin | member), send email |
/api/teams/accept-invitation | POST | Accept invite, join team |
/api/teams/members/[id] | PATCH | Update member role |
/api/teams/members/[id] | DELETE | Remove member |
Database
subscriptions— Owner isuser_idteam_members— Membership with role (admin|member)team_invitations— Pending invites with token + role
Components
components/team-member-invite.tsx— Invite UI with role pickercomponents/team-member-row.tsx— Role edit / removecomponents/auth/accept-invitation-form.tsx— Accept flowapp/(dashboard)/admin/team/page.tsx— Team management page
Next Steps
- Owner, admin, member: put Stripe on one person — why billing sits on the owner
- Accept Invitation — Invite acceptance flow
- Admin — Admin panel overview