Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Aronaman's avatar

Integration web application with local database

i made web application and i want to integrate with desktop app(which has its own local database), and what i did is i make api on my web application then i create cron job for desktop to fecth data every 30sec (if there is any change either new record, update record, delete), excute in local database.

my question is #1 when i delete record from web app it succesfully delete it from the cloud server, but how can i delete from the desktop (b/c it already delete from the server)?

#2 consider i have 1k client (desktop user with local database) and when i send cron job every 30 sec it will increase server load right? if so how should i manage it ?

0 likes
2 replies
tisuchi's avatar

@aronaman

#1. There could be two ways as of my understanding- a. Use soft delete and then fetch by API from local that which one has been deleted and do the same operation locally. b. If option A is not applicable, then create a separate table when you just track the deleted records ID. It can be a polymorphic relationship.

#2. If it is locally, 1K client is not that big, according to my experience. May be to speed you, you can increase job running time a bit, in every 5 mints.

Aronaman's avatar

@tisuchi thanks for response

what if I create API in my desktop app (to delete ,update and create ) and when i delete from the web app i directly hit endpoint (desktop api for delete) then delete from desktop?

Please or to participate in this conversation.