Page:
core Overview
Pages
Home
ai Overview
ai gemini Overview
api HowTo
api Overview
api client HowTo
api client Overview
api server HowTo
api server Overview
api server express HowTo
app HowTo
app Overview
auth HowTo
auth Overview
auth basic HowTo
auth basic Overview
auth firebase HowTo
auth firebase Overview
auth oidc Overview
auth pocketbase HowTo
auth pocketbase Overview
auth supabase HowTo
auth supabase Overview
backend HowTo
backend Overview
backend firestore Overview
backend migrations Overview
backend postgres Overview
backend restapi Overview
backend restapi recipes Overview
backend sqlite HowTo
backend sqlite Overview
cache Overview
cache redis Overview
cloudwrapper HowTo
cloudwrapper Overview
cloudwrapper firebase HowTo
cloudwrapper firebase Overview
cloudwrapper supabase HowTo
cloudwrapper supabase Overview
code Overview
code github Overview
core HowTo
core Overview
core cli HowTo
core cli Overview
gateway upstream express HowTo
gateway upstream express Overview
i18n HowTo
i18n Overview
i18n en HowTo
i18n en Overview
i18n fr HowTo
i18n fr Overview
log HowTo
log Overview
messaging HowTo
messaging Overview
messaging firebase HowTo
messaging firebase Overview
queue HowTo
queue Overview
queue amqp HowTo
queue amqp Overview
queue aws HowTo
queue aws Overview
queue gcp HowTo
queue gcp Overview
storage HowTo
storage Overview
storage firebase HowTo
storage firebase Overview
storage local Overview
storage s3 HowTo
storage s3 Overview
storage supabase HowTo
storage supabase Overview
studio Overview
testing Overview
types HowTo
types Overview
ui Overview
ui form react Overview
ui list HowTo
ui list Overview
ui list react HowTo
ui list react Overview
worker HowTo
worker Overview
No results
2
core Overview
GitHub Action edited this page 2026-04-21 19:26:34 +00:00
@quatrain/core
The foundation of the Quatrain framework. This package provides the base components for building business objects and defining data models. It works entirely in-memory and has no persistence dependencies.
Features
- Base Objects:
BaseObject,AbstractObject,DataObjectfor in-memory object management - Built-in Models:
UserandEntitymodels with full property definitions - Property System: Strongly-typed properties with built-in validation
- Object URI: A unified resource identification system that works with or without a database
- Status Management: Built-in lifecycle statuses (
created,pending,active,deleted)
Installation
npm install @quatrain/core
# or
yarn add @quatrain/core
Quick Start
Defining a Model
import { BaseObject, StringProperty, NumberProperty } from '@quatrain/core'
export class Product extends BaseObject {
static COLLECTION = 'products'
static PROPS_DEFINITION = [
{ name: 'name', type: StringProperty.TYPE, mandatory: true },
{ name: 'sku', type: StringProperty.TYPE, mandatory: true },
{ name: 'price', type: NumberProperty.TYPE, defaultValue: 0 },
]
}
Creating and Using Objects
const product = await Product.factory()
product._.name = 'My Awesome Product'
product._.sku = 'PROD-001'
product._.price = 29.99
console.log(product.isValid()) // true
console.log(product.toJSON()) // { name: 'My Awesome Product', sku: 'PROD-001', price: 29.99 }
Property Types
| Property | Description | Example |
|---|---|---|
StringProperty |
Text values | Names, descriptions, SKUs |
NumberProperty |
Numeric values | Prices, quantities, ages |
BooleanProperty |
True/false values | Flags, toggles |
DateTimeProperty |
Timestamps | Created dates, due dates |
EnumProperty |
Predefined options | Status, category |
ArrayProperty |
Lists of values | Tags, related items |
ObjectProperty |
References to other objects | Author, parent |
FileProperty |
File references | Documents, images |
HashProperty |
Encrypted values | Passwords |
MapProperty |
Key-value pairs | Metadata, settings |
Object Lifecycle
Objects follow a standard lifecycle with built-in status management:
created → pending → active → deleted
Access status via object.status and update using object.set('status', statuses.ACTIVE).
Architecture
This package is designed to be the base layer with no external dependencies except logging. For persistence, combine with backend adapters:
@quatrain/backend-postgres- PostgreSQL/Supabase@quatrain/backend-firestore- Firebase Firestore@quatrain/backend-sqlite- SQLite
Documentation
For concrete examples and usage guides, please refer to the How-To Guide.
License
AGPL-3.0-only
Core Documentation
Foundations
Storage, Data & Cache
- backend
- backend-firestore
- backend-postgres
- backend-sqlite
- backend-migrations
- storage
- storage-firebase
- storage-s3
- storage-supabase
- storage-local
- cache
- cache-redis
Queue & Messaging
Auth & Cloud
- auth
- auth-firebase
- auth-supabase
- auth-oidc
- auth-pocketbase
- cloudwrapper
- cloudwrapper-firebase
- cloudwrapper-supabase