> For the complete documentation index, see [llms.txt](https://docs.lingoql.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lingoql.com/sub0/apis-abi/practical-examples/wallet-backend-data-model.md).

# Wallet backend: Data model

Start here when you want the data layer first.

### Best for

A wallet or account backend with uploads and OAuth.

### What it shows

* One model per file
* Core relationships for the walkthrough
* Timestamp fields needed for common SQL write patterns

### Use this when

You want safe model snippets that can be pasted one file at a time.

{% hint style="info" %}
Create one file per model, such as `_users.json` or `_transactions.json`.
{% endhint %}

#### `_users`

```json
{
  "id": {
    "type": "String",
    "primary_key": true
  },
  "name": {
    "type": "String",
    "fts": true,
    "indexable": true
  },
  "email": {
    "type": "String",
    "max_length": 255,
    "fts": true,
    "indexable": true
  },
  "wallet_balance": {
    "type": "Float"
  },
  "password": {
    "type": "String",
    "max_length": 255
  },
  "age": {
    "type": "Number",
    "optional": true
  },
  "created_at": {
    "type": "DateTime"
  },
  "updated_at": {
    "type": "DateTime"
  },
  "deleted_at": {
    "type": "DateTime",
    "optional": true
  }
}
```

#### `_transactions`

```json
{
  "id": {
    "type": "String",
    "primary_key": true
  },
  "user_id": {
    "type": "String",
    "foreign_key": {
      "of": "_users",
      "key": "id"
    }
  },
  "amount": {
    "type": "Float"
  },
  "status": {
    "type": "String"
  },
  "created_at": {
    "type": "DateTime"
  },
  "updated_at": {
    "type": "DateTime"
  },
  "deleted_at": {
    "type": "DateTime",
    "optional": true
  }
}
```

#### `_gallery`

```json
{
  "id": {
    "type": "String",
    "primary_key": true
  },
  "user_id": {
    "type": "String",
    "foreign_key": {
      "of": "_users",
      "key": "id"
    }
  },
  "storage_key": {
    "type": "String"
  },
  "url": {
    "type": "String"
  },
  "dominant_color": {
    "type": "String"
  },
  "file_size": {
    "type": "String"
  },
  "created_at": {
    "type": "DateTime"
  },
  "updated_at": {
    "type": "DateTime"
  },
  "deleted_at": {
    "type": "DateTime",
    "optional": true
  }
}
```

#### `_csrf_token_store`

```json
{
  "id": {
    "type": "String",
    "primary_key": true
  },
  "user_id": {
    "type": "String",
    "foreign_key": {
      "of": "_users",
      "key": "id"
    }
  },
  "csrf_token": {
    "type": "String"
  },
  "created_at": {
    "type": "DateTime"
  },
  "updated_at": {
    "type": "DateTime"
  },
  "deleted_at": {
    "type": "DateTime",
    "optional": true
  }
}
```

### Next step

Continue with auth and account endpoints in the next walkthrough page.


---

# 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:

```
GET https://docs.lingoql.com/sub0/apis-abi/practical-examples/wallet-backend-data-model.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
