Learn more about Firestore.
Server Firebase Admin Setup
command line
npm install firebase-admin
Download your service account, then add add it’s path as an environment variable.
.env
GOOGLE_APPLICATION_CREDENTIALS="./service-account.json"
firebase.ts
// Initialize Firebase Admin resources
import * as firebaseAdmin from 'firebase-admin';
firebaseAdmin.initializeApp();
export const db = firebaseAdmin.firestore();
export const auth = firebaseAdmin.auth();
React Firebase Setup
command line
npm install firebase reactfire
import { FirebaseAppProvider } from 'reactfire';
export const firebaseConfig = {
// your config
};
ReactDOM.render(
<React.StrictMode>
<FirebaseAppProvider firebaseConfig={firebaseConfig}>
<Elements stripe={stripePromise}>
<App />
</Elements>
</FirebaseAppProvider>
</React.StrictMode>,
document.getElementById('root')
);