Is CUBA suitable for creating SaaS app?

Hello everybody!
Is it possible/suitable to create SaaS app with CUBA?
For example — we need to create a web application, which should help to handle customers orders. Something like typical web-shop backend.
Basic entities are:

  1. Client - a company, our client
  2. Client Manager - users, client’s staff (managers)
  3. Items - goods
  4. Order - customer’s Order

Each Client/client managers shoud read/write only their own items/orders.
So, Items and Orders are belong to Client, as well as Client Managers.
One of client managers (admin) should have permission to create other client managers for their company (Client entity).

Example above is simplified, just to help to describe an idea.
What do you think, should we try CUBA for this task? How it could be implemented?

Thank you in advance.

Best regards,
Max.

1 Like

Hi Max,

The short answer is yes, you can create SaaS applications with CUBA.

Your question is quite common, so we have prepared a complete example of a multi-tenant application here: GitHub - cuba-platform/sample-saas: Example of a multi-tenant application
The example is also available on the Samples tab in CUBA Studio.

Please let us know if you have further questions or comments.

Thank you, Konstantin.

How can I make that how Administrator can create records what every uses sees?
And I already had datas in database when I needed to make these changes. How to make these datas to be available to a user?

> How can I make that how Administrator can create records what every uses sees?

Change constraint for the entity to

{E}.client = :session$client_id or {E}.client is null

If you want all records created by admin to be accessible by all clients, just change the init() method in StandardClientEntity. Otherwise, you can make the “client” attribute accessible in UI and give permission to see and change it to admin’s role.

> And I already had datas in database when I needed to make these changes. How to make these datas to be available to a user?

If I correctly understand your question, you need to add the CLIENT column and update rows to set appropriate values.

1 Like

Unfortunatelly this

{E}.client = :session$client_id or {E}.client is null

not works… I did not updated these datas yet.
If I change Constraints Is Active to unchecked, then client user sees the datas which created by admin, but with that condition, user sees only his own records…
Any idea?

It should work if the records created by admin will have ‘client’ attribute set to null.

It seems

{E}.client = :session$client_id or {E}.client = 0

works, old records got 0 value for client, but new ones get null. I’ll update database. Sorry, and thanks (: