Database Structure

Our colleague Gianluca kindly sent me these codes to save this data in the firebase database.





Since access is now done via email and password, my structure is as follows:

What I want is for each user to have their own registration and then create their own budget. In this structure that Gianluca created, the data is somewhat “loose.”

Structure model:

Hi Carlos,

This was the post where I explained how to use all these blocks:
https://community.kodular.io/t/data-is-not-being-written-to-firebase/300898/4?u=rayzzz

It seems that your data structure isn’t consistent.
Inside uid, you either have a value like "xyz34" or a dictionary.

It should look like this, correct?

"users": {
  "xyz34": {
    "image": "image",
    "email": "email@email.com",
    "name": "xpto"
  }
}

If that’s the case, you would just need to add the new uid node to the GetValue and GotValue.

:white_check_mark: Solution

Right now, your Firebase structure is a bit loose because cadastro and orcamento are outside the user node.
If you want each user to keep their own registration and budgets, the best practice is to store everything inside the user’s UID.

Recommended Firebase structure

orcamento_compras:
  users:
    xyz34:
      image: ""
      email: "xpto@gmail.com"
      name: "xpto"
      cadastro:
        - hipermercado: "Villerfort, BH"
          produto: ["arroz", "feijão"]
          marca: ["Vilma", "Camil"]
      orcamento:
        - data_orcamento: "11/09/2025"
          hipermercado: "Villefort"
          produto: "arroz"
          marca: "Camil"
          preco: "R$ 20,00"

Why this is better

  • All user data stays under their UID.
  • Easy to fetch only that user’s info, e.g.
    orcamento_compras/users/xyz34/orcamento
  • Supports multiple users (abc12, def56) without mixing data.

In Kodular (Firebase blocks)

  • Save cadastro
    Use FirebaseDB.StoreValue
    • Tag: orcamento_compras/users/<uid>/cadastro/<unique_key>
    • Value: registration info (hipermercado, produto, marca).
  • Save orcamento
    Use FirebaseDB.StoreValue
    • Tag: orcamento_compras/users/<uid>/orcamento/<unique_key>
    • Value: budget info (date, hipermercado, produto, price).

In the bank it looked like this:

On my login screen, I have: Access, Registration, and Reset Password.
In the Firebase blocks, it looks like this:

Registration screen: Hypermarkets, Products and Brands:



Thanks for sharing your blocks.

Now, what kind of problem do you face?
Explain it clearly for better understand :slight_smile: .