Documentation

Guides and references

Teams

Teams

Team management, invitations, and owner / admin / member access control.

Overview

NextBento supports multi-user teams with three roles:

RoleCapabilities
OwnerSubscription holder: billing, full team control, invite/remove anyone
AdminInvite/remove members, manage non-owner roles (not billing)
MemberApp 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:

ConstantValueDescription
MAX_TEAM_MEMBERS25Hard cap on members per team
INVITATION_EXPIRY_DAYS7Invite link validity
PLAN_TEAM_MEMBER_LIMITS5/10/25Per-plan member limits

Plan limits are member caps — not seat billing or org RBAC.

Invite Flow

  1. Owner or admin goes to AdminTeam
  2. Enters email and role (admin or member), clicks Send Invite
  3. POST /api/teams/invite creates invitation, sends email via Resend
  4. Invitee receives email with link to /accept-invitation?token=xxx
  5. Invitee signs up or logs in, then accepts
  6. POST /api/teams/accept-invitation adds them with the invited role
Admin → Team — members and invite form

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

EndpointMethodDescription
/api/teams/invitePOSTCreate invitation (role: admin | member), send email
/api/teams/accept-invitationPOSTAccept invite, join team
/api/teams/members/[id]PATCHUpdate member role
/api/teams/members/[id]DELETERemove member

Database

  • subscriptions — Owner is user_id
  • team_members — Membership with role (admin | member)
  • team_invitations — Pending invites with token + role

Components

  • components/team-member-invite.tsx — Invite UI with role picker
  • components/team-member-row.tsx — Role edit / remove
  • components/auth/accept-invitation-form.tsx — Accept flow
  • app/(dashboard)/admin/team/page.tsx — Team management page

Next Steps