Our great sponsors
-
nodejs-firestore
Node.js client for Google Cloud Firestore: a NoSQL document database built for automatic scaling, high performance, and ease of application development.
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
One thing to note is that the 'firebase' package only works from the browser. In svelte-kit the components may be rendered on the server depending on how a page is loaded. You'll have to make sure that any calls to anything imported from 'firebase/firestore' are only run in the browser. You can do this with the the brwoser global imported from $app/env as described here https://kit.svelte.dev/docs#modules-$app-env. Obviously this negates the benefits of server side rendering. If you want the bits which depend of firestore to be server side rendered you'll need to write code which can access firestore that is compatible with NodeJS. You can use the google cloud package https://github.com/googleapis/nodejs-firestore. For some reason the 'firebase-admin' package which is supposed to be the package to use for NodeJS doesn't play nicely with vite and svelte-kit. But in practice 'firebase-admin' just returns an instance of Firestore from the '@google-cloud/firestore' anyway so it shouldn't make too much difference.