How to implement a multi-tenant architecture for Atlassian Connect apps?

I am working on a test app that uses Postgres for add-on data storage. So far I know, we have two options available to support multi-tenancy:

  1. A database instance per tenant
  2. Using a single database (with row-level security policies)

I would think achieving option 1 is easier compared to option 2.

My question is, to implement option 1 (a database instance per tenant) what the config.json looks like? Or, is it done somewhere else in the app?

Thanks.
Nazmus

Hi @NasmusSadat. Generally speaking, spinning up a database instance per tenant probably isn’t ideal, especially from a scaling perspective. If you’re building an app for a predictable number of instances (ex: for your own company instances), as opposed to your app potentially be installed by hundreds or thousands of different companies, then perhaps option 1 could be considered.

That being said, I don’t believe that you can implement your option 1 with Atlassian Connect Express out of the box.

I recommend you check out the following page in the docs re: multitenancy:
https://developer.atlassian.com/developer-guide/multitenancy/

1 Like

Hi @nmansilla Thanks a lot for your response.
Yes, I agree. spinning up a database instance per tenant isn’t ideal. I was just curious about this approach when I read about it from a reply of Marketplace partner. I quote from his reply:
“There are Marketplace Partners that use a single database (with row-level security policies), others use a database instance per tenant.”

Here is the link of that post: How Can I Deploy My Cloud App to PROD

You can choose a schema-per-tenant approach. In some databases schema is the same as database instance, but for some it is not.

Multitennancy should be considered through your tech stack rather as a standalone problem, because of different support for this. For example spring (java) has different support for this compared to nodejs/express or python.

We use mongodb and schema per tenant approach based on java spring because it opens several feature to us, like customer migrations between realms or custom customer backups.

1 Like