sveltekit-firebase-auth-ssr Svelte Themes

Sveltekit Firebase Auth Ssr

SvelteKit + Firebase Auth (SSR-aware)

@mierune/sveltekit-firebase-auth-ssr

[WIP]

A package for integrating Firebase Authentication into SvelteKit, designed specifically for Server-Side Rendering (SSR).

It works not only in Node.js but also on Cloudflare Workers/Pages (MIERUNE/firebase-auth-cloudflare-workers-x509).

Demo: https://sveltekit-firebaseauth-ssr-stripe-demo.pages.dev/

Installation

npm install -D @mierune/sveltekit-firebase-auth-ssr

Usage

  1. Prerequisites:
    • Project ID of the Firebase project
    • API Key of the Firebase project
    • Firebase Service Account Key (from Google Cloud)
  2. Add the necessary code to the following files:
    • src/hooks.client.ts (Example: TODO)
    • src/hooks.server.ts (Example: TODO)
    • src/app.d.ts (Example: TODO)
    • src/routes/+layout.server.ts (Example: TODO)
  3. Implement sign-in and sign-out functionality in your application. (Example: TODO)
  4. Use the user information and implement database integration if needed.
  5. Ensure that the required environment variables are set in the execution environment.

Development

direnv allow
pnpm dev-in-emulator

Top categories

Loading Svelte Themes