Viewing Mode

App Presets › Single-tenant

Single-tenant (shared)

What it is. One shared workspace, no personal workspaces, the tenancy UI suppressed. Every authenticated user is a member of the same workspace; new signups land there automatically. The workspace switcher names that workspace and lists no other; there is no “New workspace” UI and no way for users to create additional workspaces.

Who it’s for. Internal company tools, one-org deployments, classroom/cohort tools with central administration — any product where “the workspace” is implicit and there’s no need to expose tenancy as a user-facing concept.

How users relate

Everyone shares one workspace. Each person (with how they sign in) is a member of the same Acme workspace; signup is invite-only, so people are invited straight in — and there are no personal workspaces:

A Alice signs in: email + password B Bob signs in: Google OAuth C Carol signs in: magic link Acme the shared workspace Owner · bootstrapped Member · via invitation Admin · via invitation

One shared workspace · no personal workspaces · signup is invite-only

What you get when configured.

Knob Value Mechanism
signup.mode typically :invite_only (your call) config/initializers/signup.rb
tenancy.onboarding :shared User#onboard_workspace dispatches to join_shared_workspace
tenancy.workspace_creation :disabled RequiresWorkspaceCreationEnabled (included by WorkspacesController and Operations::WorkspacesController) redirects :new/:create — operators included; a second workspace on a single-tenant instance means flipping the flag or a console one-liner
permitted_join_strategies [:invite] (default — SIGNUP_PERMITTED_JOIN_STRATEGIES) Invitation.consume! is the single membership-grant path
session.reauth_enabled false (optional — your call) config/initializers/sessions.rb; internal tools often skip the “confirm it’s you” interstitial
session.new_device_notification false (optional — your call) same file; skips “new sign-in” alerts when every teammate’s laptop would fire one

The workspace switcher stays, naming the shared workspace: with one membership its menu lists no other workspace, only “All workspaces”, so no extra suppression is needed.

Setup steps.

  1. Set the ENV vars before running bin/setup (or before deploying):

    Variable Required? Example Purpose
    WORKSPACE_ON_SIGNUP no, after bin/fork --preset shared shared Selects this preset; defaults to the preset in .fork.yml
    TENANCY_WORKSPACE_CREATION yes disabled Turns off “New workspace” UI + route — operators included; a second workspace on a single-tenant instance means flipping the flag or a console one-liner
    TENANCY_SHARED_WORKSPACE_SLUG no, after bin/fork --preset shared acme URL-safe slug of the shared workspace; defaults to the name in .fork.yml
    TENANCY_SHARED_WORKSPACE_NAME no Acme Inc. Display name (defaults to the product name in config/locales/en/brand.en.yml)
    TENANCY_OWNER_EMAIL in production admin@acme.com Email of the initial Owner; development falls back to owner@<slug>.test, so a fresh fork’s bin/setup needs nothing set
    TENANCY_OWNER_FIRST_NAME no Admin Display first name (default Workspace)
    TENANCY_OWNER_LAST_NAME no User Display last name (default Owner)
    SIGNUP_MODE yes invite_only Lock account creation to invitations
    APP_HOST no app.acme.com Host used in the logged workspace URL and in tenancy:owner_setup_link‘s sign-in link (default: the mailer’s host, RAILS_HOST in production)
  2. Run bin/setup (or bin/rails db:seed on an existing app). The seed is idempotent — safe to re-run.

  3. The seed creates the shared workspace and the Owner user (with a verified email Authentication and an Owner Membership). In development it emails the Owner a sign-in link, captured by Letter Opener: open /letter_opener to see it (it isn’t sent over SMTP). With passwords turned on, the link lands on the set-a-password form. In production it deliberately does not put a credential in the logs (a logged token would linger in log retention past its short expiry); instead it logs the workspace URL and points you to an on-demand task. Mint the Owner’s sign-in link when you’re ready to use it:

    bin/rails tenancy:owner_setup_link
    

    This prints a fresh sign-in link, valid for 15 minutes — the expiry clock starts when you run it, not at deploy time. Deliver it to the Owner out-of-band (or run it yourself if you’re claiming the account). It doubles as a break-glass Owner login if email delivery is ever down.

  4. The Owner opens the link, which signs them in (with AUTH_PASSWORDS=enabled it opens the set-password form first). They can then invite other users via the normal invitation flow — each invitation specifies the role the invitee receives (Member, Admin, etc.). The Owner remains the single source of new-role-granting authority for the shared workspace; roles can also be changed after signup via the members UI at /workspaces/:slug/members.

Re-inviting under :shared updates the role, it doesn’t error. Because :shared onboarding pre-creates a placeholder membership for every new user, Workspace#admit reconciles — admitting an existing member to a new role updates their role rather than raising “already a member” (the behavior you’d get under the default :personal posture). So re-inviting someone at a higher role is a valid way to promote them.

How to verify your setup is Single-tenant. After running the seed:

bin/rails console
TenancyConfig.shared?                          # => true
TenancyConfig.shared_workspace.slug            # => "acme" (your slug)
TenancyConfig.shared_workspace.personal?       # => false
TenancyConfig.shared_workspace.memberships.count  # => 1 (the seeded Owner)

owner = User.find_by!(email_address: ENV["TENANCY_OWNER_EMAIL"])
owner.workspaces                               # => [<Workspace slug: "acme">]
owner.personal_workspace_id                    # => nil
owner.memberships.first.role.slug              # => "owner"

In the browser, after the Owner has signed in:

  1. They land on the home page; Go to your workspaces lists only the shared workspace.
  2. The workspace switcher at the top of the sidebar names the shared workspace and their role; its menu lists no other workspace — only “All workspaces”.
  3. /workspaces/new redirects to root with the alert Workspace creation is disabled on this instance.
  4. Invited new users (via the standard invitation flow) verify their email and become Members of the same shared workspace.

When to switch presets.

  • “Users should each get their own personal workspace; this is too restrictive.” → Solo-default.
  • “Each customer should have their own workspace, and signup should be public.” → Open SaaS.

Next steps