Is it possible to create a custom datasource and add it in a "Data sources" palate similar to how today we have for HTTP API or PostgresSQL

We are planning to use self hosted version of UI Bakery for internal app development . To avoid everytime adding the connection params in PostgresSQL database data source, we would like to deliver more smooth experience to Users by a readymade and pre-filled PostgresSQL datasource. The connection values will be hidden from the users. User exp will be like user can just select the resource and submit “create resource” and no need to provide any details. All the connection details will be handled under the hood in the application server level.

Hi @dilip_chainani,

I’m not sure what you mean with

since once you’ve connected a datasource it stays connected as datasource until removed.

You say also say

which kind of sounds like users can create their own custom datasource, but then no need to provide any details wouldn’t make sense. So are the resources already existing PostgresSQL databases or do they still need to be created?

And if they still need to be created I don’t think they can be dynamically added to datasources by code and you would need to save the connection details manually somewhere else.

Hi @Max , Thanks for the response. May be I forgot to mention that

  • we are in multi-tenant model and each Tenant access to dedicated external PSQL database.
  • Resource or connection is not shared within the Tenants.
  • We want to provide a dedicated resource to each tenant so that they can just use the resource to create connection by few clicks and avoiding any manual configurations.
  • We would like to hide the configuration part of the Resources from the UI and control them from the server side code. Assume that Users(all admin/editor/viewer) do not know which database to connect.

Let me try to explain further by second example of HTTP connector this time. We would like to provide a resources such as “GetEmployeeSchedule”, “GetEmployeeSalary”, “PromoteEmployee”, etc to all our customers as a readymade bundle in resources. These resources are self ready and do not need to provided with rest end point, host, http verbs or payload details and authn creds.

1 Like

I understand now, thanks for explaining.

I’m not really that familiar with the multi-tenant model, but I think I got the gist of it. From what I’ve read, a well-designed multi-tenant system checks a user’s credentials and automatically determines which tenant they belong to. Correct me if I’m wrong.

Since you said you are planning to use the on-prem version of UI Bakery, is there anything already implemented? Something like a backend server or an auth system to recognize users and determine their tenant?

Because this could be implemented just in UI Bakery or with a backend server, but seeing you even mention and control them from the server side code I think it’s safe to assume you would like to work with a backend server.

Even so, there are different approaches to things like authentification, tenant management, etc. so you need to decide for yourselves what you want to handle in UI Bakery and what on the server.

Personally, I would decide between two auth and resource assignment workflows.

Either send the users name/email/token immediately after logging in on UI Bakery to the server and get a value back (maybe a name, JWT, custom identifiers, etc.) that you can send with each request to tell the server what tenant needs to be accessed. Or send the users name/email/token with each request and let the server determine the tenant on the fly.

Either way, I’d have the server manage the user - tenant relationship.
I also read that PostgreSQL offers two approaches for multi-tenant use, “tennant-schema” and “shared-table”. I found a good answer on stackoverflow that explains the differences, drawbacks and use-cases for both.

Of course, all the things mentioned above are suggestions, as there are more approaches to this issue. I didn’t quite get exactly what answer/information you came here for, so I think this should draw an outline of the concept, but if you are seeking for something specific feel free to ask.

Thanks for the reply. But may be we are still not on the same page. I did further analysis around datasources and found this small footer note at the bottom. Ref the screenshot.


What I am looking for is to add my custom datasource, which should only be available in my self hosted UI bakery and to my tenants. We dont want to push those in cloud or opensource GIT of UI bakery.

By server, i meant the one which hosts UI bakery app. In our case, we plan to go self hosted. I am evaluating various requirements on the UI bakery before we host it.

Oh sorry, seems like I misunderstood.

You say custom datasource, but in the end it still is just a PostgreSQL right? I think technically it makes no difference wether you set it up on the same server as where you host UI Bakery or a different one, UI Bakery can’t access to it over localhost so you will always end up having to use the IP of the server.

But, no matter where you set it up, if you define DB users with fixed hosts and privileges that should do the trick no?

1 Like