nandorojo / swr-firestore

Implement Vercel's useSWR for querying Firestore in React/React Native/Expo apps. 👩‍🚒🔥

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Best way to get some of these features for server side Firebase interactions?

dsernst opened this issue · comments

Hey @nandorojo— you've done such a great job with this library.

I'm curious if you have advice / perspective / opinions on how to incorporate some of the nice features of this library, like its easier to use API, Typescript schema support, and automatic date conversion when using Firebase on the server, e.g. as a replacement for firebase-admin?

As far as I can tell, swr-firestore is tightly coupled to React, because of all the hooks, right?

Thanks, I appreciate that!

Yeah, this library is pretty tightly coupled to react. If you go to the static mutations file (I think) you'll see some examples of getting a document and collection, for example. That said, this library mainly targets React and leverages SWR's caching mechanism.

I wouldn't be surprised if you could rebuild some of this for the server, such as getting documents / collections.

My cofounder @jerber has more experience using Firestore on the server than I do, so he might be able to chime in here with some thoughts. He built something similar to my library for Python servers (a typed Firebase ORM). I assume the principles could carry over to Node.