Dynamic REST Engine
The core of Rotifex. Reads schema.json, creates SQLite tables, and registers five CRUD routes per model — all at startup and live when models are added via the admin API.
Use case: A developer defines a Product model with name, price, and in_stock fields. Rotifex immediately exposes /api/products with full CRUD, filtering, sorting, and pagination — no restart needed.
How It Works
schema.jsonis parsed byschemaLoader.jsinto normalized model definitions.tableSync.jsrunsCREATE TABLE IF NOT EXISTSfor each model.routeFactory.jsregisters generic parametric routes (/api/:table) that resolve the model from an in-memory store at request time.- When a model is added/removed via the admin API, the in-memory store is updated and routes resolve immediately.
Field Types
| Schema Type | SQLite Type | Notes |
|---|---|---|
string | TEXT | |
number | REAL | Float |
integer | INTEGER | |
boolean | INTEGER | Stored as 0/1 |
Field Definition Formats
// Shorthand
{ "name": "string" }
// Full form
{
"name": {
"type": "string",
"required": true,
"unique": false,
"default": "Unnamed"
}
}
Auto-Generated Columns
Every model automatically gets:
id— UUID primary keycreated_at— ISO 8601 timestampupdated_at— ISO 8601 timestamp (updated on every PUT)
Table Naming
Model names are lowercased and pluralized:
Product→ tableproducts→ route/api/productsOrder→ tableorders→ route/api/orders