Organizations Module
The organizations module manages multi-tenant organization accounts, user invitations, and join requests.
Data Model
Organization
├── name (unique)
├── domain (unique)
├── website, logo, description
├── users[] → User[]
├── projects[] → Project[]
├── invitations[] → OrganizationInvitation[]
└── joinRequests[] → OrganizationJoinRequest[]
Endpoints
Organizations
| Method | Path | Description |
|---|---|---|
GET | /organizations | List all organizations |
POST | /organizations | Create a new organization |
GET | /organizations/:id | Get organization details |
PATCH | /organizations/:id | Update organization |
DELETE | /organizations/:id | Delete organization |
Invitations
| Method | Path | Description |
|---|---|---|
POST | /organizations/:id/invite | Invite a user by email |
GET | /organizations/invitation/:token | Get invitation details |
POST | /organizations/invitation/:token/accept | Accept an invitation |
Join Requests
| Method | Path | Description |
|---|---|---|
POST | /organizations/:id/request-join | Request to join an org |
GET | /organizations/:id/join-requests | List pending join requests |
POST | /organizations/join-requests/:id/approve | Approve a request |
POST | /organizations/join-requests/:id/reject | Reject a request |
Invitation Flow
Admin invites user@example.com
│
▼
OrganizationInvitation created
│ (email, token, roleId, expiresAt)
│
▼
Email sent with invitation link
│
▼
User clicks link → /invitation/:token
│
├── If user exists → Added to org
│
└── If new user → Register → Added to org
Join Request Flow
User requests to join Organization
│
▼
JoinRequest created (status: PENDING)
│
▼
Org admin sees request in dashboard
│
├── APPROVE → User added to org
│
└── REJECT → Request closed
Domain Blacklist
The DomainBlacklist model prevents users from specific email domains from registering:
admin@blocked-domain.com → Registration rejected