Skip to content

Add subdomain-based organization multitenancy - #23

Merged
kcdragon merged 2 commits into
mainfrom
add-organization-multitenancy
Jun 10, 2026
Merged

kcdragon merged 2 commits into
mainfrom
add-organization-multitenancy

Conversation

@kcdragon

Copy link
Copy Markdown
Collaborator

Adds multi-tenancy where each tenant is a community foundation: new Organization and OrganizationMembership models, with the active tenant resolved from the request subdomain (e.g. arlington.localhost) and exposed via Current.organization. Every page requires a resolved org via the SetCurrentOrganization concern — the apex renders a landing page listing the foundations, unknown subdomains 404, and signed-in non-members are bounced to the apex. Authentication is isolated per subdomain: sign-up auto-creates a membership atomically and mails subdomain-scoped confirmation/reset links, sign-in requires membership of the current org, and an existing email is pointed to sign in rather than shown a uniqueness error. Includes migrations, fixtures, model/controller tests, seeds, a bin/setup seed step, and tld_length = 0 config so *.localhost subdomains resolve in dev/test. Also adds a .rubocop.yml house-style override (no extra indent after private), which reformatted a few existing files.

🤖 Generated with Claude Code

kcdragon and others added 2 commits June 10, 2026 08:23
Introduce Organization and OrganizationMembership models with the active
tenant resolved from the request subdomain (e.g. arlington.localhost) and
exposed via Current.organization. Every page requires a resolved org via the
SetCurrentOrganization concern; the apex renders a landing page listing the
foundations, unknown subdomains 404, and non-members are bounced to the apex.

Sign-up/in, confirmation, and password reset are scoped per subdomain:
registration auto-creates a membership (atomically) and mails subdomain-scoped
links, sign-in requires membership, and existing emails are pointed to sign in.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The CI system-test job runs `bin/rails test:system`, which errored with a
LoadError because the repo had no test/system directory. Add the standard
ApplicationSystemTestCase plus an apex landing smoke test. Capybara is pointed
at the "localhost" hostname (not 127.0.0.1) so the tenant resolver treats the
bare host as the apex rather than parsing IP octets as a subdomain.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@kcdragon
kcdragon merged commit d092baa into main Jun 10, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant