Storage Model and Data Shape
Canonical payload shape
Tagixo works with this structure:
{
"body": {
"background": { "color": "#ffffff" },
"spacing": {
"padding": { "top": "0", "right": "0", "bottom": "0", "left": "0" }
}
},
"components": [
{
"id": "sec_1",
"type": "section",
"parent_id": null,
"order": 0,
"props": {}
}
]
}
Important details:
bodyis a props object for the page canvas.- Tree is stored in flat form (
parent_id,order). - Nested render tree is reconstructed as needed.
propsis the only style/content payload per node.
Node contract
Each component node should contain:
idtypeparent_idorderprops
Your validators should reject malformed nodes early.
Example hierarchy in flat storage
[
{ "id": "sec_1", "type": "section", "parent_id": null, "order": 0, "props": {} },
{ "id": "row_1", "type": "row", "parent_id": "sec_1", "order": 0, "props": {} },
{ "id": "col_1", "type": "column", "parent_id": "row_1", "order": 0, "props": {} },
{ "id": "mod_1", "type": "heading", "parent_id": "col_1", "order": 0, "props": { "content": { "text": "Hello" } } }
]
This is the safest format to persist because sorting and parent relationships are explicit.
Suggested DB columns
For a content table (for example pages):
contentJSONrendered_htmlLONGTEXT nullablecssLONGTEXT nullablestatus(draft,published)published_attimestamp nullable
If you support rollback, add a related versions table rather than overloading the main record.
Save strategy
When content is saved:
- Validate JSON shape.
- Persist raw JSON.
- Re-render HTML/CSS.
- Save rendered artifacts.
This makes runtime page delivery fast and deterministic.
Validation rules you should enforce
At minimum:
bodymust be an arraycomponentsmust be an array- every node must have a stable string
id - every node must have a known string
type propsmust be an arrayparent_idmust be eithernullor a known node id- sibling
ordervalues should be deterministic
Do not rely on the renderer to clean bad editor data for you.
Versioning and templates
If your team needs rollback:
- Store versions on each save.
- Keep snapshots linked to entity ID and editor ID.
- Reuse Tagixo template/library APIs where appropriate.
Good persistence conventions
- Keep one canonical JSON payload per entity revision.
- Never mutate production JSON with silent migration logic during request-time rendering.
- If you need content migrations, write explicit migration scripts.
- Cache render artifacts, not edited state.
- Keep publishing state separate from editing state if your product has approvals.
Common mistakes
- Saving only rendered HTML and losing the underlying JSON.
- Saving nested children arrays directly while other code expects flat nodes.
- Changing module type ids after content already exists.
- Reordering nodes without updating
parent_idandordercoherently.