Flares Developer Docs

Collections & fields

Creating collections, field types, schema revisions.

Creating a collection

A collection is a named set of records with a typed schema. Create one in Basket DB → Collections, or from a backend with a secret key:

curl -X POST \
  -H 'Authorization: Bearer YOUR_SECRET_KEY' \
  -d 'name=messages' \
  -d 'fields={"body":{"type":"text","required":true},"sender_id":{"type":"text","required":true},"read":{"type":"boolean"}}' \
  https://cloud.flaresinc.com/v1/projects/YOUR_PROJECT_ID/collections
Schema changes need the secret key. A public key that could reshape the database would make every browser holding it an administrator.
Collections: fields, indexes, record counts.
Collections: fields, indexes, record counts.

Field types

TypeStoresNotes
textStringsThe default for identifiers and prose.
numberIntegers and decimalsCompared numerically in queries.
booleantrue / false
datetimeTimestampsISO-8601 in, ISO-8601 out.
jsonNested structuresStored whole; not queryable field-by-field.

A field marked required is refused when absent — validation happens server-side, before the write.

Indexes

Add an index to a field you filter or sort on frequently. Without one the query still works; with one it stays fast as the collection grows. Indexes are created from the Collections screen and listed beside each collection's fields.

Schema revisions

Every schema change increments the collection's revision and is recorded. The project overview shows recent revisions, so "when did this field appear" has an answer.

Deleting a collection

Deleting requires typing the collection's name. It is not reversible from the console — take a backup first if the records matter.