Models & Data Structures
User
Built-in model managed by the auth system. Not configurable via the schema engine.
| Field | Type | Required | Notes |
|---|---|---|---|
id | string (UUID) | Auto | Primary key |
email | string | Yes | Unique |
display_name | string | No | |
role | string | Yes | "user" or "admin" |
password_hash | string | Internal | bcrypt hash — never returned by API |
created_at | string (ISO 8601) | Auto | |
updated_at | string (ISO 8601) | Auto |
_files (File Metadata)
Internal table managed by StorageManager. Not in schema.json.
| Field | Type | Notes |
|---|---|---|
id | string (UUID) | Primary key |
original_name | string | Original filename from upload |
stored_name | string | <uuid>.<ext> — actual filename on disk |
mime_type | string | e.g. image/jpeg |
size_bytes | integer | File size in bytes |
visibility | string | "public" or "private" |
uploader_id | string | UUID of the uploading user |
created_at | string (ISO 8601) |
Custom Models (schema.json)
All custom models automatically receive id, created_at, and updated_at.
Example schema.json:
{
"Product": {
"fields": {
"name": { "type": "string", "required": true },
"price": "number",
"in_stock": "boolean",
"sku": { "type": "string", "unique": true }
}
},
"Order": {
"fields": {
"product_id": { "type": "string", "required": true },
"quantity": { "type": "integer", "required": true },
"status": { "type": "string", "default": "pending" }
}
}
}
Resulting routes:
Product→ tableproducts→/api/products,/api/products/:idOrder→ tableorders→/api/orders,/api/orders/:id
Agent
Stored in agents.config.json.
| Field | Type | Default | Description |
|---|---|---|---|
id | string (UUID) | Auto | |
name | string | — | Display name |
description | string | "" | Human-readable description |
provider | string | — | openai, anthropic, gemini, or ollama |
model | string | — | Model ID |
systemPrompt | string | "" | Agent's system instruction |
tools | string[] | [] | List of tool names to enable |
temperature | number | 0.7 | Sampling temperature |
maxTokens | integer | 2048 | Max tokens per LLM call |
maxIterations | integer | 10 | Max tool-call loop iterations |
createdAt | string (ISO 8601) | Auto | |
updatedAt | string (ISO 8601) | Auto |
AI Provider (ai.config.json)
| Field | Type | Description |
|---|---|---|
label | string | Display name |
apiKey | string | API key (empty string if not set) |
enabled | boolean | Whether the provider is active |
models | string[] | Available model IDs |
defaultModel | string | Default model ID |
baseUrl | string | Only for Ollama — local server URL |
Token Usage (ai.usage.json)
{
"totalRequests": 150,
"totalInputTokens": 55000,
"totalOutputTokens": 14000,
"byProvider": {
"openai": {
"requests": 100,
"inputTokens": 40000,
"outputTokens": 10000
},
"anthropic": {
"requests": 50,
"inputTokens": 15000,
"outputTokens": 4000
}
}
}