Skip to content

Feature: Backup Management & History UI #120

Closed

Description

@khaira777

Issue 120: Backup Management & History UI

Background

Our tech stack is Electron (main process) + better-sqlite3 + Next.js.
Right now we can trigger backups, but users need a way to track past backups and see them in the UI (similar to Time Machine or Windows Backup), and easily restore from them without needing to manually locate the file on disk.

Requirements

  1. Backend Discovery:
    • In the backend (main process), create a utility to scan the backups/ directory (located in app.getPath('userData')) for .db files.
    • Parse their creation dates using fs.stat or by parsing the timestamp embedded in the filename (e.g., flo-backup-2026-07-18T16-19-03.db).
  2. API Endpoint:
    • Expose a new API endpoint GET /api/db-tools/backups that returns a sorted list (newest first) of these backups with their dates, absolute paths, and file sizes.
  3. Frontend UI:
    • In the Next.js frontend Settings page (likely under a new Backup/Restore section or inside Database Tools), create a table or list view showing the backup history.
  4. Restore Flow:
    • Add a "Restore" button next to each backup.
    • Clicking restore should prompt the owner for the Master PIN.
    • Trigger the existing restore flow using the selected backup's file path.

Security & Best Practices

  • The endpoint must be protected and only accessible by the owner role.
  • Restore actions are highly destructive and must continue to require the Master PIN.
  • Ensure the backup scanning ignores non-sqlite files to prevent unexpected crashes.

Next Steps

  • Implement the backend scan logic and endpoint.
  • Build the frontend UI.
  • Test backup detection and the restore flow.

Activity

  1. khaira777 commented on Jul 18, 2026

    @khaira777
    ContributorAuthor

    Scope Clarification: Custom Backup Paths

    A note for this issue's implementation: Currently, when clicking 'Create Backup' in the UI, the API auto-saves the .db file directly into the default backups/ folder inside app.getPath('userData').

    While the native Electron menu (File -> Export Backup) allows the user to define the location via a save dialog (createBackup(targetPath)), the UI endpoint does not.

    Decision Needed for this Issue:
    Should the new Backup UI allow users to define a custom path when creating a backup, or should all UI-triggered backups forcefully go to the default backups/ directory to ensure they appear in the proposed 'Backup History' table?

  2. itsbkm commented on Jul 21, 2026

    @itsbkm
    Contributor

    This was already fully implemented in f7e399e (feat(settings): Backup Management & History UI) — backend scan of backups/ via listBackups(), owner-gated GET /api/db-tools/backups, frontend Backup History table, and a Master-PIN-gated restore flow (handleRestoreFromHistory → restore-backup IPC → authorizeMasterPin). Covered by tests/database-tools-api.test.ts, part of the full npm test suite. Just never got closed on GitHub. Closing now — no new work needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions