Registry / devops / firemin

firemin

JSON →
library0.3.1jsnpmunverified

Firebase Firestore/Storage security rules minifier. Current stable version 0.3.1 (latest, last updated 2020). Infrequently updated. Minifies Firebase security rules to stay under the 256KB (or effectively 50KB) size limit by removing comments, whitespace, unused functions, and renaming functions/parameters to shorter names. Different from hand-optimization as it automates the process without restructuring the database or moving validation to the client.

devops
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.

Library exports a single default export; no named exports.

import firemin from 'firemin'

Minifies Firebase Firestore security rules by removing comments, whitespace, and unused functions, and shortening function names.

import firemin from 'firemin'; const inputRules = ` service cloud.firestore { match /databases/{database}/documents { function isAuthenticated() { return request.auth != null; } // Allow read only if authenticated match /{document=**} { allow read: if isAuthenticated(); } // Admin functions (unused, will be removed) function isAdmin() { return request.auth.token.admin == true; } // Another unused function function isOwner(userId) { return request.auth.uid == userId; } } } `; const minified = firemin(inputRules); console.log(minified); // Output: service cloud.firestore{match /databases/{database}/documents{function a(){return request.auth!=null}match /{document=**}{allow read:if a()}}}
Debug
Known footguns
gotchaThe package has not been updated since 2020. Ensure it works with your Node.js version (requires Node >=10.0).
gotchaFiremin may not handle all edge cases in rules syntax; always double-check the output rules are valid.
gotchaFunction removal relies on static analysis; if a function is used dynamically (e.g., via variable), it may be incorrectly removed.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
8 hits · last 30 days
gptbot
3
ahrefsbot
2
Resources