Bihar Police Notebook runs entirely in your browser — there is no application server that receives or stores your documents. Every letter and FIR case diary you write is automatically persisted in your browser’s IndexedDB, a structured client-side database that survives page refreshes and browser restarts. This page explains how that storage is organised, when saves happen, and what happens when you delete a document.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/arverma/Bihar-Police-Notebook/llms.txt
Use this file to discover all available pages before exploring further.
Database structure
The app opens an IndexedDB database namedbp-writing-tool at schema version 2 (defined in editor/js/store.js). Inside it, two object stores hold documents side by side:
| Object store | What it holds | Key |
|---|---|---|
letter | Hindi letter documents | Auto-increment integer id |
diary | FIR case diary documents | Auto-increment integer id |
filename— non-unique, lets the app look up documents by display name.uuid— unique, the stable identifier used to match local documents with their counterpart on Google Drive.
Document fields
Every row in either object store has the following fields:| Field | Type | Meaning |
|---|---|---|
id | number | Auto-incremented primary key, local to this browser |
filename | string | Display name shown in the History sidebar (often a date) |
content | string | object | Letter: raw text string. Diary: JSON object { header, pages } |
type | "letter" | "diary" | Discriminator — mirrors which object store the row lives in |
uuid | string | Stable cross-device identifier generated with crypto.randomUUID() |
created_at | string | ISO 8601 timestamp set once when the document is first created |
updated_at | string | ISO 8601 timestamp refreshed on every save |
driveFileId | string | null | Google Drive file ID once the document has been backed up |
syncedAt | string | null | ISO 8601 timestamp of the last successful Drive sync |
syncError | string | null | Error message from the last failed Drive sync attempt, if any |
deletedAt | string | null | ISO 8601 timestamp set when the document is soft-deleted; null for live documents |
Autosave sequence
The editor does not require you to press a save button. Changes are written to IndexedDB automatically via a 600 ms debounce:User edits the document
Typing or any content change fires an
onChange event in the letter or diary sheet component.scheduleSave debounces the write
main.js schedules a deferred save. If another change arrives within 600 ms, the timer resets — preventing a write on every keystroke.flushSave triggers the store
Once 600 ms elapse without further changes,
flushSave calls saveDocumentById in store.js.saveDocumentById writes to IndexedDB
The function opens a
readwrite transaction on the appropriate object store, sets updated_at to the current ISO timestamp, clears any previous syncError, and issues an IDBObjectStore.put(). If no id is present yet (new document), it calls add() instead and also assigns a fresh uuid.Delete modes
The app uses two different deletion strategies depending on whether a Drive backup exists.- Soft delete
- Hard delete
When a document has ever been synced to Drive (i.e.,
driveFileId is set), deleting it sets deletedAt to the current timestamp rather than removing the row. The document disappears from the History sidebar immediately, but its row remains as a tombstone so the next Drive sync can upload the deletion signal and have it reflected on all devices.Once the tombstone has been successfully pushed to Drive, hardDeleteById is called automatically to clean up the local row.Preferences storage
UI and feature flags — such as the Drive connection state, the dictation language, and toggle positions — are not stored in IndexedDB. They live in the browser’slocalStorage under keys prefixed with bpnt. (managed by editor/js/prefs.js):
Origin scope and data loss
Data stays on your device
No letter or diary content is ever transmitted to an application server. The only time data leaves your device is when you explicitly connect Google Drive and run a sync.
Portable across tabs
Because IndexedDB is scoped to the origin, the same documents are visible across any tab open to
bpdiary.arverma.dev in the same browser profile.Private browser mode
In private/incognito mode, IndexedDB is still available but is wiped when the private session ends. Preference to use private mode for confidential drafts.
No cross-device sync without Drive
Documents do not automatically appear on other devices or browsers. Enable Google Drive backup to access documents from a second device.