loopbackio / loopbackio/loopback-next

Multi-tenancy and dynamic schema selection

Open
#5,056 21 comments 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

epic help wanted major needs discussion
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

Recently, several people asked about implementing dynamic schema selection to enable schema-base multi-tenancy, where tenant isolation is achieved via DDL Schemas. (If you are not familiar with DDL schemas then you can learn the basics e.g. in PostgreSQL docs).

I am opening this Epic to do discuss possible solutions, implement necessary improvements and document how to implement multi-tenancy, possibly including an example app.

Related discussions:

Aspects to consider:

  • CLI should recognize dynamic repository/datasource in commands like lb4 datasource
  • How to boot custom artifacts - we can improve @loopback/boot (if needed) or move the registration to a different place (e.g. from a datasource file to a boot script)
  • How to migrate/update database tables for all tenants when the model shape changes
  • How to onboard a new tenant (create the new schema & all tables)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the related LoopBack 4 issue 5055 and the linked PostgreSQL schema documentation. Review the listed concerns around CLI commands, @loopback/boot, migrations, and tenant onboarding to determine the design scope. Done would require an agreed solution, implementation improvements, documentation, and possibly an example app.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, typescript
Domain
backend, cli, databases, documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.