Skip to content

Sveltekit Firebase Authenication Recipe Site

Notes

  • SSR means that all the html is rendered by the server.
  • Benefits SEO and Social Media Sharing.
  • This example does not work with admin becuase it does not account for login.
  • If you want it to work with login you will have to validate the firebase jwt token and recreate your firebase firestore rules in code.

Firebase Rules

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /recipes/{document=**} {
      allow read: if true;
      allow create: if request.auth != null;
    }

    match /private/{document=**} {
      allow read, write: if request.auth != null;
    }

    match /public/{document=**} {
      allow read: if true;
    }
  }
}