Skip to content

feat: make organization membership limit configurable via ORG_MEMBERSHIP_LIMIT env#4640

Open
nizepart wants to merge 2 commits into
Dokploy:canaryfrom
nizepart:feat/configurable-org-membership-limit
Open

feat: make organization membership limit configurable via ORG_MEMBERSHIP_LIMIT env#4640
nizepart wants to merge 2 commits into
Dokploy:canaryfrom
nizepart:feat/configurable-org-membership-limit

Conversation

@nizepart

Copy link
Copy Markdown

Summary

  • Add ORG_MEMBERSHIP_LIMIT env variable to control the maximum members per organization
  • Extract limit resolution into a testable helper (resolveOrgMembershipLimit)
  • Preserve backward compatibility: when env is not set, better-auth's default of 100 remains

Closes #4639

Problem

The better-auth organization plugin enforces a membershipLimit of 100 by default. Self-hosted instances with larger teams cannot accept new invitations once this limit is reached, with no way to configure it without patching the source.

Changes

File Change
packages/server/src/lib/membership-limit.ts New helper: reads and validates ORG_MEMBERSHIP_LIMIT from env
packages/server/src/lib/auth.ts Passes resolved limit to organization() plugin config
apps/dokploy/.env.example Documents the new variable
apps/dokploy/__test__/organization/membership-limit.test.ts Unit tests for the helper (9 tests)
apps/dokploy/__test__/organization/accept-invitation.test.ts Integration tests for limit enforcement logic (12 tests)

Usage

# Set in .env to raise or effectively remove the limit
ORG_MEMBERSHIP_LIMIT=10000

@nizepart nizepart requested a review from Siumauricio as a code owner June 15, 2026 15:14
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. enhancement New feature or request labels Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Organization membership limit (100) is hardcoded and not configurable for self-hosted instances

1 participant