#How to use Firebase with Astro?

1 messages · Page 1 of 1 (latest)

lusty bane
#

Does anyone have any resources (preferably GitHub repo) that how I can use Firebase Firestore with my astro static site (to fetch content)?

cobalt blaze
lusty bane
#

I tried this and was not able to fetch the data, could be please help?

twilit escarp
severe sedge
#

@lusty bane Did you set the env vars properly? SNOWPACK_PUBLIC_FIREBASE_API_KEY

#

Also, that Firebase example is old. It's pre v1, so it's probs broken

twilit escarp
#

well @lusty bane
do you need a new template ?

twilit escarp
#

I made a really simple one with firestore access

severe sedge
lusty bane
#

I'll try this and will text you if I have any questions, and once again, thank you so so much

lusty bane
#

Tried it and it runs perfect! 🔥

Also, I am using firebase hosting. So do I need to write a cloud function to build it everytime the content is updated in Firestore?

Any other alternative way to achieve this?

twilit escarp
#

there is no other way to update data in SSG

lusty bane
#

is there any docs/github repo of cloud funtions for updating the astro static site hosted on firebase (automatically whenever the content is updated in firestore)?

twilit escarp
#

essentially what I do on my website is that
CMS at backend
Astro ( Vercel ) at frontend

#

and everytime data is updated
CMS sent webhooks to vercel to redeploy

lusty bane
#

Oh got it, will try searching for webhooks deploy for firebase