We are making an offline desktop application in Electron that needs to sync when the user goes online.

Sqlite is used as the database when offline and it gets synced to postgres on the server when the user goes online through a node js server with a REST API.

One of the features is to upload files to the application.

Entities for the scenario are: A "Project" has many "Files"

Many users can upload/delete files for the same project and it can be done when the user is offline.

What would be a proper way to implement this? - User uploads file to the application. ( This would just copy the file to the filesystem? ) - The local database saves the files with the file's path with the created Date - When the User goes online, it first fetches the files from the server. Checks which file is new/updated/delete, syncs it accordingly. - Then uploads the new files that are imported while offline?

Also the node server would upload that files to a S3 bucket, meaning, the database would consist of the url of the uploaded image. But the offline app would have the "file path"....

Hmm, very confused by now, any suggestions?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.