Skip to content

feat: implement backup management features and export functionality#4773

Open
biggora wants to merge 5 commits intohomarr-labs:devfrom
biggora:backups
Open

feat: implement backup management features and export functionality#4773
biggora wants to merge 5 commits intohomarr-labs:devfrom
biggora:backups

Conversation

@biggora
Copy link

@biggora biggora commented Dec 31, 2025

A comprehensive backup system has been implemented, allowing you to export the entire configuration or individual boards and restore them if necessary.

  • Builds without warnings or errors (pnpm build, autofix with pnpm format:fix)
  • Pull request targets dev branch
  • Commits follow the conventional commits guideline
  • No shorthand variable names are used (eg. x, y, i or any abbrevation)
  • Documentation is up to date. Create a pull request here.

Link to the merge request documentation homarr-labs/documentation#477

Screenshot 2025-12-31 142040 Screenshot 2025-12-31 142052 Screenshot 2025-12-31 142110 Screenshot 2025-12-31 142208 Screenshot 2025-12-31 142232 Screenshot 2025-12-31 142247 Screenshot 2025-12-31 142857 Screenshot 2026-01-01 112011 Screenshot 2026-01-01 111959

@biggora biggora requested a review from a team December 31, 2025 08:31
@biggora biggora requested a review from a team as a code owner December 31, 2025 08:31
@deepsource-io
Copy link
Contributor

deepsource-io bot commented Dec 31, 2025

Here's the code health analysis summary for commits 939996f..3dfc511. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScript✅ Success
🎯 3 occurences resolved
View Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@manuel-rw
Copy link
Member

Minimum review criteria is not met, please fix the deepsource issues.

@manuel-rw manuel-rw added the enhancement New feature or request label Dec 31, 2025
@biggora biggora force-pushed the backups branch 3 times, most recently from df1c4e8 to e3225fe Compare December 31, 2025 11:34
@ajnart
Copy link
Member

ajnart commented Dec 31, 2025

@biggora you don't need to force-push all your commits, you can leave them linear and we'll squash on merge

@biggora
Copy link
Author

biggora commented Dec 31, 2025

@biggora you don't need to force-push all your commits, you can leave them linear and we'll squash on merge

just a habit :)

@ajnart
Copy link
Member

ajnart commented Dec 31, 2025

@biggora you don't need to force-push all your commits, you can leave them linear and we'll squash on merge

just a habit :)

no worries then. It would be helpful if you could add some screenshots to your PR

@biggora
Copy link
Author

biggora commented Dec 31, 2025

@biggora you don't need to force-push all your commits, you can leave them linear and we'll squash on merge

just a habit :)

no worries then. It would be helpful if you could add some screenshots to your PR

added screenshots

Copy link
Member

@ajnart ajnart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still in the process of reviewing by testing the branch. There are leftover changes from something you didn't entirely finish building. If you could make new commits to delete these artifacts it would be helpful

Also as a sidenote @biggora do you think it would be possible for you to add unit tests of this feature during the init stage ? Simply by adding the json/zip to be used inside of these tests I think we could leverage this feature to set up a demo instance of homarr

@ajnart
Copy link
Member

ajnart commented Dec 31, 2025

@biggora another comment is that you should use the same component to render users in the manage/users page to get a link to the user + the correct user icon to display

Manage/users manage/backup
image image

@biggora
Copy link
Author

biggora commented Dec 31, 2025

done

@ajnart ajnart requested review from Copilot and removed request for a team December 31, 2025 18:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a comprehensive backup and restore system for Homarr, enabling users to export their entire configuration or individual boards and restore them when needed. The implementation includes database schema updates to track backups, a new backup package with export/import functionality, validation mechanisms, and extensive internationalization support across 36 languages.

Key changes:

  • New backup database table and migration files for SQLite, PostgreSQL, and MySQL
  • Complete backup package with export, import, and validation services
  • Translation keys added for 36 language files to support the backup UI
  • Full restore capability with merge and full restore modes

Reviewed changes

Copilot reviewed 86 out of 88 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/db/schema/*.ts Added backup table schema definition and relations across all database types
packages/db/migrations/*/0035_add_backups.sql Migration files creating the backup table in each database dialect
packages/translation/src/lang/*.json Translation keys for backup UI added to all 36 supported languages
packages/backup/src/types.ts TypeScript type definitions for backup operations and data structures
packages/backup/src/import/validator.ts Validation logic for backup files before restoration
packages/backup/src/import/importer.ts Core import logic handling data restoration with dependency ordering
packages/backup/src/import/tests/validator.spec.ts Unit tests for backup validation functionality
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@biggora biggora force-pushed the backups branch 2 times, most recently from db62484 to 47078d5 Compare January 1, 2026 09:33
ajnart
ajnart previously approved these changes Jan 1, 2026
Copy link
Member

@ajnart ajnart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me, thank you for the contribution.

@biggora biggora force-pushed the backups branch 3 times, most recently from 4a0ef50 to e37ab84 Compare January 3, 2026 21:30
@biggora biggora force-pushed the backups branch 2 times, most recently from bcf4b0b to 15d0c59 Compare January 10, 2026 19:37
Copy link
Member

@Meierschlumpf Meierschlumpf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not done with the review yet, but here a first collection of feedback. Additionally I have a few notes:

  1. The translations should not be part of the pull request and are rather done later by the translators on Crowdin. So please only change the en.json file
  2. It's great that you were motivated to contribute, however it would have been better if you first discussed possible solutions with the team. E.g. I already had a few ideas on how a backup system could look like and the main problem with most systems is, that they are a lot of effort to maintain (as when the db changes, you have to manually adjust the import system), therefore I'm not sure yet if we should add this or create a better system that can automatically update when new tables are added to the db.

Anyway, I'll discuss with the team how we move forward and if we continue with this implementation I'll review the missing parts

@ajnart
Copy link
Member

ajnart commented Jan 12, 2026

@biggora we've decided that this feature might be annoying to maintain moving forward. What happens if I backup a board in a previous version and want to restore it ? In order to mitigate this issue I see 2 possible solutions :

  • Pin a backup to a specific version, so that the person has to first start homarr with the tag in which they backed-up the board to restore it, then upgrade and it will run migrations.
  • Do a full database backup using equivalents such as pgdump for postgres, juste a copy for sqlite... and hope that the migrations will be properly ran on that DB to upgrade it to the version the person is running.
  • Drop the feature or rethink it from the ground up

What do you think about these changes ? I personally don't mind adding a "pain" to the user that they have to temporarily rollback to a previous version to restore the backup.

@biggora
Copy link
Author

biggora commented Jan 12, 2026

@biggora we've decided that this feature might be annoying to maintain moving forward. What happens if I backup a board in a previous version and want to restore it ? In order to mitigate this issue I see 2 possible solutions :

  • Pin a backup to a specific version, so that the person has to first start homarr with the tag in which they backed-up the board to restore it, then upgrade and it will run migrations.
  • Do a full database backup using equivalents such as pgdump for postgres, juste a copy for sqlite... and hope that the migrations will be properly ran on that DB to upgrade it to the version the person is running.
  • Drop the feature or rethink it from the ground up

What do you think about these changes ? I personally don't mind adding a "pain" to the user that they have to temporarily rollback to a previous version to restore the backup.

@ajnart
I agree that issues may arise at some point (tables changed, for example), but this is also true for any module, integration, etc.
In today's reality, when we have access to many LLMs, I don't see any problems with supporting this functionality in the future. The same goes for translations into other languages; LLM handles that in minutes.
I decided to implement this feature because I encountered an issue when transferring (to another device) and restarting the app. I would lose data or access to it. Initially, I just wanted to use similar solutions. I'm a programmer, and after a while I figured out what the problem was. I created this backup system for myself to solve my problems, then decided to share.
But what happens to people who don't have the necessary knowledge? This discourages people from using the app.

@biggora
Copy link
Author

biggora commented Jan 12, 2026

I'm not done with the review yet, but here a first collection of feedback. Additionally I have a few notes:

  1. The translations should not be part of the pull request and are rather done later by the translators on Crowdin. So please only change the en.json file
  2. It's great that you were motivated to contribute, however it would have been better if you first discussed possible solutions with the team. E.g. I already had a few ideas on how a backup system could look like and the main problem with most systems is, that they are a lot of effort to maintain (as when the db changes, you have to manually adjust the import system), therefore I'm not sure yet if we should add this or create a better system that can automatically update when new tables are added to the db.

Anyway, I'll discuss with the team how we move forward and if we continue with this implementation I'll review the missing parts
@Meierschlumpf
Yes, it would be great to have a data backup system that could automatically account for system changes, but how realistic is that? How long would it take to develop such a system? Is the effort justified? And all this time, users will be without any backup system.

@biggora
Copy link
Author

biggora commented Jan 12, 2026

  • Pin a backup to a specific version, so that the person has to first start homarr with the tag in which they backed-up the board to restore it, then upgrade and it will run migrations.

@ajnart
I added the app version tag to each json file, it can be used in the future if needed for compatibility, if it will require.

@biggora biggora force-pushed the backups branch 2 times, most recently from d9b662a to 9f784b4 Compare January 12, 2026 14:33
@biggora biggora force-pushed the backups branch 7 times, most recently from b243737 to 274712f Compare January 17, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants