I used JSON files instead of a database for 1,699 records. Here’s what actually broke
Описание и применение
Использование плоских JSON‑файлов вместо базы данных привело к проблемам с уникальностью URL, скрытым ошибкам и риску повреждения файлов при одновременных записях.
Задача
Relying on flat JSON files for a read‑heavy, append‑mostly dataset caused hidden data integrity and scalability issues.
Результат
The project remained functional but suffered from 95 unreachable papers, 52 redirect loops, a missing homepage section, and potential file corruption under concurrent writes.
Рабочий процесс
- Read entire JSON file on each request
- Filter array for queries
- Write entire file on updates
- Generate slugs from paper metadata
- Build slug index to detect collisions
- Enqueue writes to serialize concurrent writes
- Rename temp file to replace original
- Restore from backup on parse failure
Доказательства
95 papers that existed but had no URL
Two requests writing the file at once will corrupt it
- Дата записи: 2026-09-06T17:21:53.359Z