Firebase Provider
Setup
Auth uses a service account JSON file from the Firebase console.
- Go to Firebase console → Project settings → Service accounts
- Click Generate new private key → download the JSON file
- Store it somewhere safe (outside version control)
The firebase option in @Deploy is optional - if FIREBASE_SA is set in your environment, it's picked up automatically.
// Explicit
@Deploy({ firebase: process.env.FIREBASE_SA! })
// Or let it read FIREBASE_SA from env
@Deploy({ dryRun: true })
Hosting
Deploy a static site from a local build directory.
Firebase.Hosting("your-site-id")
.source("./dist") // path to your built static files
.domain("example.com") // optional custom domain
The site ID is the Firebase Hosting site name - by default it matches your project ID (e.g. my-project → https://my-project.web.app). You can override the displayed URL using .domain("yourdomain.com").
Deploy flow:
- Creates a new Hosting version
- SHA256-hashes all files in the source directory
- Sends the hash map to Firebase - only files that changed are uploaded
- Finalizes the version and creates a release
- Outputs the live URL
Idempotency: Each deploy creates a new release (Firebase's native model). Previous releases remain in the console but are inactive.
Full example
import "dotenv/config";
import "reflect-metadata";
import { Firebase, Stack, Deploy } from "puls-dev";
@Deploy({ dryRun: false })
class DocsSite extends Stack {
site = Firebase.Hosting("puls-docs")
.source("./site")
.domain("pulsdev.io");
}
Build your site first, then deploy:
# MkDocs example
pip install mkdocs-material
mkdocs build # outputs to ./site
npx tsx examples/docs-blog.ts
Service account permissions
The service account needs the Firebase Hosting Admin role. In the Firebase console:
Project settings → Service accounts → Manage service account permissions
Or via IAM: grant roles/firebasehosting.admin to the service account email.