Registry / gcp / firelaw

firelaw

JSON →
library0.0.0jsnpmunverified

Firelaw is a TypeScript transpiler that lets you write type-safe and scalable Firestore Security Rules using TypeScript syntax. Version 0.0.0 is an initial release with rapid iteration. It differentiates by enabling full TypeScript type checking and IDE support for rules, reducing runtime errors compared to writing raw Firebase rules. The library compiles TypeScript to Firestore rules format, handling complex rule generation with type safety.

npm install firelaw
INSTALL
IMPORT
SIG · FIRELAW
F
firelaw
gcpjavascriptv0.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

firelaw
import { firelaw } from 'firelaw'
const firelaw = require('firelaw')
ESM-only package; CJS require will fail.
Resource
import { Resource } from 'firelaw'
import Resource from 'firelaw'
Resource is a named export, not default.
Request
import { Request } from 'firelaw'
TypeScript type for request context in rules.

Demonstrates basic Firelaw usage: writing a Firestore rule that allows read only if user is authenticated.

import { firelaw, Resource, Request } from 'firelaw' const rules = firelaw` match /databases/{database}/documents { match /{document=**} { allow read: if ${(req: Request, res?: Resource) => req.auth != null}; } } ` console.log(rules)
firelaw --version
Debug
Known issues
deprecatedfirelaw() tagged template literal syntax may change in future versions.
fix
Watch for breaking changes in pre-1.0 releases.
affects: >=0.0.0 <1.0.0
gotchaThe package is in initial development (v0.0.0). APIs are unstable and may break frequently.
fix
Pin to specific version and test thoroughly.
affects: >=0.0.0
gotchaCannot use JavaScript; only TypeScript is supported due to compile step.
fix
Write rules in TypeScript files with .ts extension.
affects: >=0.0.0
gotchaFirelaw does not support all Firestore rule features; check documentation for limitations.
fix
Review the list of supported functions and operators.
affects: >=0.0.0
Errors
Common errors & fixes
ReferenceError: firelaw is not defined
Using CommonJS require instead of ESM import.
fix
Use import { firelaw } from 'firelaw' and ensure your project is ESM (type: module in package.json or .mjs file).
TypeError: firelaw is not a function
Firelaw is a tagged template tag, not a function that returns a string directly.
fix
Use firelaw`...` (backtick template literal) instead of firelaw('...').
Upgrade
Version history
0.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
38 hits · last 30 days
node
32
OpenAI (training)
1
Resources
firelaw — npm install firelaw · libregistry