skip to Main Content

I am developing a SaaS Application with the following Technology:

  • NestJS (Node)
  • DB (NEO4J, ArangoDB)
  • Nginx for proxy (Micro-services Approach)

The SaaS Application will be hosting many distinct companies, as clients.
The data from 2 different companies must be fully isolated in the GraphDB.
2 different companies may have different data structures and models.

ENQUIRIES
Here are my enquiries:

  • How to setup Multi-tenancy on a GraphDB (Neo4J / ArangoDB)?
  • Is a totally separate required GraphDB instance required for each company?
  • Is it possible to host 2 companies on the same GraphDB, yet maintain isolation?

Can anyone please suggest an optimal solution for this type of architecture?
Thanks for your time

Best regards

2

Answers


  1. With ArangoDB you only need one instance and can simply use a database per tenant.

    Each database is isolated, for example, AQL queries run in the context of a single database and you can only access the collections and named graphs of that database.

    ArangoDB Architecture - Hierarchy of Databases, Collections and Documents

    You can create an ArangoDB user for each customer and restrict its access to the respective database to achieve the desired isolation.

    For scalability and resilience, there is also the OneShard feature (Enterprise Edition / managed service). It enables you to have a cluster where each database is treated like a single shard, i.e. all collections of a customer are stored on one DB-Server (excluding replicas), so that queries can be executed locally on that node. This is especially beneficial for graph traversals.

    Login or Signup to reply.
  2. Since Neo4j 4.0 multi-tenancy is supported via multi-database.

    In the system database you can create as many databases as you want and from a client select the database to talk to on a session by session basis, so you can use each database for a tenant.

    Here is the JS API:

    https://neo4j.com/docs/api/javascript-driver/current/class/src/driver.js~Driver.html#instance-method-session

    Each database instance can handle hundreds or thousands of databases.

    enter image description here

    With Neo4j Fabric enabled you can do cross-database federated queries.

    here are some more examples

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search