{"id":26994,"library":"firelaw","title":"Firelaw","description":"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.","status":"active","version":"0.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/tylim88/firelaw","tags":["javascript","firebase","firestore","transpiler","typescript"],"install":[{"cmd":"npm install firelaw","lang":"bash","label":"npm"},{"cmd":"yarn add firelaw","lang":"bash","label":"yarn"},{"cmd":"pnpm add firelaw","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only package; CJS require will fail.","wrong":"const firelaw = require('firelaw')","symbol":"firelaw","correct":"import { firelaw } from 'firelaw'"},{"note":"Resource is a named export, not default.","wrong":"import Resource from 'firelaw'","symbol":"Resource","correct":"import { Resource } from 'firelaw'"},{"note":"TypeScript type for request context in rules.","symbol":"Request","correct":"import { Request } from 'firelaw'"}],"quickstart":{"code":"import { firelaw, Resource, Request } from 'firelaw'\n\nconst rules = firelaw`\n  match /databases/{database}/documents {\n    match /{document=**} {\n      allow read: if ${(req: Request, res?: Resource) => req.auth != null};\n    }\n  }\n`\n\nconsole.log(rules)","lang":"typescript","description":"Demonstrates basic Firelaw usage: writing a Firestore rule that allows read only if user is authenticated."},"warnings":[{"fix":"Watch for breaking changes in pre-1.0 releases.","message":"firelaw() tagged template literal syntax may change in future versions.","severity":"deprecated","affected_versions":">=0.0.0 <1.0.0"},{"fix":"Pin to specific version and test thoroughly.","message":"The package is in initial development (v0.0.0). APIs are unstable and may break frequently.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Write rules in TypeScript files with .ts extension.","message":"Cannot use JavaScript; only TypeScript is supported due to compile step.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Review the list of supported functions and operators.","message":"Firelaw does not support all Firestore rule features; check documentation for limitations.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use import { firelaw } from 'firelaw' and ensure your project is ESM (type: module in package.json or .mjs file).","cause":"Using CommonJS require instead of ESM import.","error":"ReferenceError: firelaw is not defined"},{"fix":"Use firelaw`...` (backtick template literal) instead of firelaw('...').","cause":"Firelaw is a tagged template tag, not a function that returns a string directly.","error":"TypeError: firelaw is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}