Backend File Type flat vs indexed for list storage
Flat vs indexed lists

Appifio Creator · Lesson X07 · Troubleshooting

AI uses writeFile on a list
→ data breaks

Contacts/products/blog lists “vanish,” shrink, or corrupt shards - usually writeFile writing the whole array instead of indexed CRUD.

Learning goals: Spot Diff with writeFile('contacts.json', [...]); migrate to appendData/readList/updateData; recover with Clone/Checkpoint.

Reading time: ~12 minutes · Previous: T03, F05 · Next: X08

UI labels: Compare changes: · Versions · Create new (Clone) · Backend · View backend database content · Save changes · Discard

Warning: writeFile on an indexed list (contacts, products, orders…) can overwrite / break sharding - data may be unrecoverable if you already Save changes without a Clone.

1. Spot & fix flow

Symptoms: list vanishes at scale · admin shows only a few rows · Diff has writeFile([...]) for the whole array
→ Not yet Save changes? ✗ Diff or Discard
→ Already saved? Versions tab → switch to an older Clone/Checkpoint
→ Before migrate: Create new (Clone)
→ Prompt: move to indexed - appendData + readList + updateData + deleteFile(id)
→ Diff: ✗ every writeFile on contacts/products/orders lists
→ Test append → Backend View backend database content
❌ NEVER writeFile a whole list array · NEVER touch shard internals (T04)

2. Glossary (Flat vs Indexed - T03)

TypeUse whenCorrect API
FlatOne config object (settings)readFile / writeFile
Indexed / CRUD listcontacts, products, blog posts, orders…appendData · readList · updateData · readFile(file,id)
writeFile on a listWrong - overwrites master + breaks shardsAlways ✗ in Diff

3. Rescue & migrate steps

CMS Contacts list used to verify list data after rescue
Verify contacts list
  1. Emergency: if not published yet → Discard or ✗ the writeFile Diff.
  2. Already published → Versions tab → pick a Clone/Checkpoint from before the break (T10).
  3. Create new (Clone) before any large migrate.
  4. Mode Coder / Architecture: “Move contacts/products to indexed; ban writeFile on lists; use appendData/readList/updateData.”
  5. Open Compare changes: - ✗ if you see writeFile('contacts.json', [...]) or the same for products/orders.
  6. Preview Changes → test submit → BackendView backend database content.
  7. Aura CMS on: follow data_file in the manifest (T05) - don’t invent file names.
  8. OK → Save changes.

4. Compare · Can / Cannot

One browser memory cell holding the whole list: same mistake as writeFile-on-list - breaks at scale. Airtable/Notion DB: always record-oriented ≈ indexed Aura Storage.

Can: Large lists via automatic sharding; restore from Clone; reject Diff early.
Cannot: Hand-merge shards; set ids yourself; writeFile a whole array; edit shard system files.

5. Security

Guests may appendData only when policy allows - never give guests writeFile/updateData (K05/T07). Guest writeFile on a list = broken data and a security hole.

6. Symptom table

SymptomFix
List “vanishes” after a few hundred rowsSuspect writeFile - migrate indexed; restore Clone
Diff shows writeFile([...])✗ reject - re-prompt for appendData
Only one object left instead of a listFile overwritten as flat - Clone + migrate
Aura CMS panel empty though form worksWrong data_file / writeFile on the wrong manifest file
Already clicked Save changes, with no backupOlder Clone if any; no magic fix - contact support

7. Tips · Checklist

  • Standing prompt for every project: “Indexed for every list; Flat only for settings.”
  • Review Diff like a PR - one writeFile-on-list line = ✗ immediately.
  • Before a large CMS prompt: Clone + (optional) Export .afi.
  1. Can you tell Flat vs Indexed (T03)?
  2. Know to ✗ writeFile on contacts/products in Diff?
  3. Clone before letting AI migrate a list?

Appifio Creator · User guide · X07