Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
Best data structure for nested multi tenant structure

I am not sure if I am going the right way about structuring my data, I am looking at creating a multi tenant database which I will provide as JSON to the front end with the relevant information for each client.

Below is an example array with one entry that represents one clients data, this would be repeated for each client.

Each client will have subsets of client data which include employees, teams, locations etc.

Each client will have an array of customers who will all be able to be assigned rewards, and enter personal info which will be accessible by the client, the same applies for all the other nested arrays and objects.

Is this nested way of structuring things the correct way to go, or should I have a seperate structure for clients and customers.

[
  {
    client_id: 12345678,
    client_name: "client one",
    client_email: "email@email.com",
    client_teams: [
      {
        team_id: 1234,
        team_name: "team one",
        team_location_id: "ldn_01"
      },
      {
        team_id: 1234,
        team_name: "team two",
        team_location: "ldn_02"
      }
    ],
    client_employees: [
      {
        employee_id: 1234,
        team_id: 1234,
        employee_email: "email@email.com",
        employee_password: "password",
        employee_username: "name",
        employee_access: "admin"
      },
      {
        employee_id: 4567,
        team_id: 1234,
        employee_email: "email@email.com",
        employee_password: "password",
        employee_username: "name",
        employee_access: "viewer"
      }
    ],
    is_connected: false,
    date_joined: "date",
    customers: [
      {
        customer_id: 1234,
        first_name: "firstname",
        last_name: "last name",
        date_joined: "date",
        total_rewards_redeemed: 1,
        total_points_accumulated: 20,
        current_points_accumulated: 2,
        rewards_available: [1234, 1235],
        age: 25,
        city: "London"
      }
    ],
    locations: [
      { location_id: 1234, location_name: "location one" },
      { location_id: 2234, location_name: "location two" }
    ],
    rewards: [
      {
        reward_id: 1234,
        reward_name: "10off",
        reward_description: "10% off",
        reward_start_date: "25-06-2022",
        reward_end_date: "30-06-2023"
      }
    ],
    campaigns: []
  }
];```
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!