> For the complete documentation index, see [llms.txt](https://textav.gitbook.io/firebase-react-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://textav.gitbook.io/firebase-react-notes/firestore/associated-firebase-data-with-users.md).

# associated Firebase data with Users

associated Firebase data with Users [How to Connect Firebase Users to their Data - 3 Methods](https://youtu.be/2ciHixbc4HE)

* Keep data shallow in NoSQL vs SQL
* use auth state to get current user id. And then can do queries based on that auth state, for items nested under that user id.
* firebase security rules on firestorm

Other option

* adding user id on the item&#x20;

Multiple users

### ADR around reasoning to design of schema and security

{% embed url="<https://github.com/bbc/digital-paper-edit-firebase/blob/master/docs/ADR/2019-12-02-nosql-schema-security.md>" %}
ADR around the NoSQL Schema
{% endembed %}

### Example of implementation

{% embed url="<https://github.com/bbc/digital-paper-edit-firebase/blob/master/firestore.rules>" %}
Security Rules
{% endembed %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://textav.gitbook.io/firebase-react-notes/firestore/associated-firebase-data-with-users.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
