Multiple databases?

I read the docs, played around with the app-example app, created a few tables, and poked around using the API Explorer. What I’m curious about is the option to create instances of schemas–for example, having a separate DB for each customer, for security and performance purposes.

Is there or will there be support for multiple database/instances? One way is to namespace each table, but that can quickly get out of hand. I don’t think Workspaces is the right solution (workspace per customer?).

Hey Mike! Great question.

First off is that an 8base workspace can be configured to support single-instance multi-tenant software, each “tenant” can be thought of as a customer whose data is securely isolated through scope in the database. Right now, we’re working to productize this so that it’s simply an option when creating a new workspace! However, it can be done.

Second, if you truly need separate databases, you can always create multiple workspaces!

Sebastian

Thanks for the quick reply! If I understand correctly, multi-tenant data is possible, but it’s a manual process? Can you elaborate? The only “tenant” search finds https://docs.8base.com/8base-console/authentication#authorization which has an “IBM_APP_ID_TENANT_ID” environment variable in an screen-shot. Roles? Pseudo-namespaced tables? I can guess :slight_smile:

Haha! Yeah, I should update those docs to scratch anything misleading…

So, yes to possible and yes to manual. We don’t have any official documentation around it yet, as we’re instead moving to make it a configurable option. That said, at a high level it can be configured using a combination of a Tenants table (or whichever name) and custom roles.

For example, let’s say we made the Tenants table and the gave it a many-to-many relation with Users, as well as a one-to-many relationship with Contacts. Then we could make then make a custom Role for accessing contacts, like so.

{
  "tenant": {
      "users": {
        "some": {
          "is_self": true
        }
     }
  }
}

This is somewhat of a crude example, though hopefully gets the point across. Additionally, the custom role on tenants itself would also mirror to something like:

{
    "users": {
      "some": {
        "is_self": true
      }
   }
}

Let me know if this is helpful. I can always pull in backup if needed :slight_smile:

1 Like