Buckets
Buckets are schema-defined collections of documents with ready-made REST, GraphQL and realtime APIs, validation, rules, localization and history.
A bucket is a collection of documents that share a schema. When you create a bucket, Spica immediately serves:
- A REST API to list, read, create, replace, patch and delete documents.
- A realtime WebSocket stream that pushes inserts, updates and deletes to subscribers.
- A GraphQL schema, when GraphQL is enabled.
- A data entry UI in the admin panel, generated from the schema.
Every write is validated against the schema. Every read can be filtered, sorted, paginated, localized and joined with related buckets.

A first look
A bucket definition is JSON. This one describes blog posts:
{
"title": "Posts",
"description": "Blog posts",
"primary": "title",
"history": true,
"properties": {
"title": {"type": "string", "title": "Title", "options": {"translate": true}},
"slug": {"type": "string", "title": "Slug", "pattern": "^[a-z0-9-]+$"},
"status": {"type": "string", "title": "Status", "enum": ["draft", "published"], "default": "draft"},
"author": {"type": "relation", "title": "Author", "bucketId": "<authorsBucketId>", "relationType": "onetoone"},
"created_at": {"type": "date", "title": "Created at", "default": ":created_at", "readOnly": true}
},
"required": ["title", "slug"],
"acl": {"read": "document.status == \"published\"", "write": "false == true"}
}And this is how an app reads published posts with their authors, in Turkish:
curl "https://api.example.com/api/bucket/<postsBucketId>/data?relation=author&limit=10" \
-H "Authorization: USER <token>" \
-H "Accept-Language: tr_TR"In this section
Every property type, validation keyword and bucket setting.
Create, read, replace, patch and delete documents over REST.
Filters, sorting, pagination, relations and localization.
Decide which documents and fields each user can read or write.
Subscribe to live query results over WebSocket.
Keep the previous versions of documents and inspect them.
Query and mutate bucket data with GraphQL.
Indexes, document limits, caching, hashed and encrypted fields.
Who can access bucket data
Access is checked in two layers:
- Policies decide whether the caller may use an endpoint on a bucket at all, for example
bucket:data:indexon thePostsbucket. - Rules decide which documents a
USERmay read or write. Identities and API keys skip rules.