#[Opinions] is serverless viable? Vercel Postgres

27 messages · Page 1 of 1 (latest)

willow leaf
#

I'm looking to build a solution that enables real-time synchronization of data between a Google Sheet and a specified database (e.g., MySQL, PostgreSQL). The solution should detect changes in the Google Sheet and update the database accordingly, and vice versa.

Is it possible to handle all these requirements in a serverless architecture?

neat boneBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

mossy maple
#

u probably need to read the google sheets api for doing something when a document changes

#

for example triggering a request to a edge function that updates the db

#

uhm

willow leaf
#

yup i need to use app script

mossy maple
#

vice versa

#

idk

willow leaf
#

but i need it to sync the other way too

#

yeah thats the issue

#

Im doubtful if this can be achieved serverless-ly

mossy maple
#

uhm a funny thing u could do is

#

setup a cronjob in your serverless platform if it supports it

#

and doing your logic there

#

looking for changes in the db for example

willow leaf
#

im using vercel

mossy maple
willow leaf
#

at that point would you just shift to a service like supabase which comes with all the features 😂

mossy maple
#

check this

willow leaf
#

Since the database is not accessible externally, I could just sync data every time a crud request is made. I'll also have polling implemented for principle's sake

mossy maple
#

and how are u suppose to sync from google drive?

willow leaf
#

i meant to say I wont allow direct external access from google sheets (can i even do this with vercel postgres?) since it goes through an API or middleware i wont have to worry about someone making changes to the db externally

mossy maple
#

im not understanding what u mean arent u suppose to call a "sync" endpoint? for example google sheets calls your sync endpoint, your endpoint retreaves your data from sheets on the serverside and updates the db

#

and vice versa. Vercel calls your sync endpoint for postgre, u get the data from postgre and update your sheets

willow leaf
#

ok that makes sense. I hit the sync endpoint everytime either nodes make a change and then proceed with my crud operations on the db