37signals-multi-tenant

Implement URL-based multi-tenancy with account scoping in Rails applications.

1|Updated Feb 3, 2026
One-click install
npx skills add https://github.com/joshyorko/agent-skills --skill 37signals-multi-tenant
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: 37signals-multi-tenant
Source: https://github.com/joshyorko/agent-skills/tree/main/plugins/rails-37signals-patterns/skills/37signals-multi-tenant
Command: npx skills add https://github.com/joshyorko/agent-skills --skill 37signals-multi-tenant

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Implements URL-based multi-tenancy with account scoping for Rails apps, ensuring every resource belongs to an account and URLs reflect account context, enabling secure, scalable data isolation in a single database.

Core Features & Use Cases

  • Account and Membership models for per-account access control and role management.
  • Current context (Current.account, Current.user) for per-request scoping across controllers, models, and routes.
  • URL-based routing with account_id in the path, explicit account-scoped queries, and UUID primary keys.

Quick Start

Configure your Rails app to expose per-account routes and initialize Current.account from the URL.

Frequently Asked Questions about 37signals-multi-tenant

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement URL-based multi-tenancy in a Rails application?

URL-based multi-tenancy in Rails is implemented by enforcing an account_id on every table, using UUIDs for primary keys, and routing requests through a per-request Current context to isolate data per account within a single database.

What is the best way to isolate data per account in a single Rails database?

Data isolation per account in a single database is achieved by scoping all queries through a Current context that sets Current.account and Current.user per request, ensuring every resource is restricted to its account.

How does Current context work for account-scoped routing in Rails?

Current context works by initializing Current.account from the URL path on each request, allowing account-aware routing, controllers, and models to automatically restrict resource access to the active account.

Do I need UUIDs for multi-tenant primary keys in Rails SaaS apps?

UUIDs for primary keys are used in this multi-tenant approach to ensure unique identifiers across all accounts within the single database, preventing collision and maintaining secure data isolation.

Can I use account-scoped queries for admin panels and collaboration tools?

Account-scoped queries support admin panels, SaaS apps, and collaboration tools by using Account and Membership models for per-account access control and role management, keeping resources restricted to an account.

When should I not use URL-based multi-tenancy with a single database?

URL-based multi-tenancy with a single database requires enforcing account_id on every table and routing through account context, which may not suit applications needing physical database separation per tenant.