---
# System prepended metadata

title: Database structure

---

# Database structure

> [!Note]
> **Time format:** timestamps (miliseconds)

## User

```json
{
    "users": {
        "userId": {
            "displayName": "",
            "email": "",
            "bio": "",
            "photoUrl": "",
            "deviceToken": "",
            "createdOn": 0,
            "lastModified": 0,
            "isOnline": false,
            "lastOnline": 0,
            "sentFriendRequests": {
                "userId": {
                    "sentAt": 0
                },
                ...
            },
            "receivedFriendRequests": {
                "userId": {
                    "receivedAt": 0
                },
                ...
            },
            "friends": {
                "userId": {
                    "friendSince": 0,
                    "blocked": false,
                    "muted": false,
                    "chatId": ""
                },
                ...
            }
        },
        ...
    }
}
```

## Chat

`type`: text, image, video

```json
{
    "chats": {
        "chatId": {
            "createdOn": 0,
            "messages": {
                "messageId": {
                    "owned": "",
                    "content": "",
                    "sentAt": 0,
                    "type": "",
                    "isRevoked": false,
                    "repliedTo": ""
                },
                ...
            }
        },
        ...
    }	
}
```
