Skip to main content

Collections & Fields

Collections & Fields

Collections in NodeStack correspond directly to tables in SQLite, with built-in schema validation, access rules, triggers, and full-text search indexing.


System Collections​

When NodeStack initializes, it automatically provisions system collections prefixed with _:

  • users (_auth): Handles user authentication, email addresses, password hashes, and token invalidation.
  • _superusers: Master administrators with unrestricted access to the Web Admin UI and system APIs.
  • _audit_logs: Immutable record of field-level data mutations, actor IDs, timestamps, and old-to-new diffs.
  • _webhooks: Outbound webhook endpoint registrations, action triggers, and secrets.
  • _webhook_deliveries: Outbound HTTP dispatch attempt logs, response status codes, latency, and retry counts.

Supported Field Types​

Every field in a collection is backed by an SQLite data type and validated at runtime:

Field TypeSQLite TypeValidation & Behavior
textTEXTPlain text strings, min/max length checks, regex patterns. Can be indexed for FTS5 full-text search.
numberREAL / INTEGERFloating point or integers, with optional min and max constraints.
boolINTEGERBoolean 0 or 1. Normalized automatically from JSON booleans.
emailTEXTRFC 5322 email validation.
urlTEXTURL format validation.
dateTEXTISO 8601 UTC date/time strings (YYYY-MM-DDTHH:mm:ss.sssZ).
selectTEXTSingle or multi-choice dropdown with custom option values.
jsonTEXTArbitrary JSON objects and arrays validated with JSON parser.
fileTEXT (filename)Multipart file attachments with MIME validation and size limits.
relationTEXT (ID)Foreign key pointing to another collection's record ID. Supports expanding.

Schema Inference (schema:infer)​

NodeStack supports automatic schema inference. If you have existing JSON records or CSV data, the CLI can automatically infer the optimal column types:

npx @nodestackapp/server schema infer ./sample-data.json --collection products

Automatic Timestamps & IDs​

Every record created in NodeStack automatically includes:

  • id: 15-character nano-ID unique string (e.g. rec_7x9k2p8mq1).
  • created: ISO 8601 UTC timestamp of creation.
  • updated: ISO 8601 UTC timestamp of the latest mutation.