accesspatterns.dev

saas

SaaS Multi-Tenant

Organisations and their members in one table, isolated by partition.

multi-tenantsingle-tableisolation

A single-table design where every item for an organisation shares the partition key ORG#<orgId>. Members live beside the org record, so the whole tenant reads in one Query.

The model

Organisation

A tenant.

pk
ORG#<orgId>
sk
ORG#<orgId>

Attributes: orgId (S), name (S), plan (S)

Membership

A user's membership of an organisation, with a role.

pk
ORG#<orgId>
sk
MEMBER#<userId>

Attributes: orgId (S), userId (S), role (S)

Access patterns

  • QueryGet organisation members

    List every member of an organisation.

  • GetItemGet an organisation

    Fetch a single organisation record.

Design notes

Isolation by partition keywhy

Every item for a tenant shares ORG#<orgId>, so a tenant's data never leaks into another's reads and the whole tenant is one Query away.

Org record beside its memberstrade-off

Storing the organisation under SK = ORG#<orgId> keeps it in the same partition as its members, so one Query can fetch the org and its people together.

resolving the model…

The in-browser engine is a preview; behaviour is illustrative and not conformance-verified against AWS.