{"id":25583,"library":"firebase-bolt-compiler","title":"Firebase Bolt Compiler","description":"Compiles Firebase Bolt schema definitions (from firebase-bolt) into TypeScript interfaces, Flow types, and other code artifacts. Current stable version is 1.2.9, last released in September 2017. This package is a TypeScript rewrite of firebase-bolt-transpiler, using the same AST types as the original firebase-bolt package. It is primarily a CLI tool that reads .bolt files and outputs TypeScript or Flow type definitions. Key differentiators: generates path helper functions (since v1.2.0), handles null explicitly, and provides stricter typing compared to the original transpiler. No active development since 2017.","status":"maintenance","version":"1.2.9","language":"javascript","source_language":"en","source_url":"https://github.com/wcandillon/firebase-bolt-compiler","tags":["javascript","firebase","security","rules","schema","models","blaze","typescript"],"install":[{"cmd":"npm install firebase-bolt-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add firebase-bolt-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add firebase-bolt-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Uses the same AST types from firebase-bolt for parsing .bolt files","package":"firebase-bolt","optional":false}],"imports":[{"note":"Package exports a compile function but primary use is via CLI. Use the named import for programmatic usage.","wrong":"const compile = require('firebase-bolt-compiler').compile;","symbol":"compile","correct":"import { compile } from 'firebase-bolt-compiler';"},{"note":"No default export; use named exports only.","wrong":"import { default } from 'firebase-bolt-compiler';","symbol":"default","correct":"import pkg from 'firebase-bolt-compiler';"},{"note":"The public API includes generateTypeScript, generateFlow, etc. See source for full list.","wrong":"const { generateTypeScript } = require('firebase-bolt-compiler');","symbol":"generateTypeScript","correct":"import { generateTypeScript } from 'firebase-bolt-compiler';"}],"quickstart":{"code":"// install: yarn add firebase-bolt-compiler firebase-bolt\nimport { readFileSync } from 'fs';\nimport { compile, generateTypeScript } from 'firebase-bolt-compiler';\n\nconst boltContent = `\npath /users/{uid} is Users {\n  read() { true }\n  write() { isCurrentUser(uid) }\n}\ntype Users extends User[] {}\ntype User {\n  firstName: String;\n  lastName: String;\n}\n`;\n\nconst ast = compile(boltContent);\nconst tsOutput = generateTypeScript(ast);\nconsole.log(tsOutput);\n// Outputs:\n// type Users = { [key: string]: User };\n// export interface User {\n//     firstName: string;\n//     lastName: string;\n// }","lang":"typescript","description":"Compiles a Bolt schema string to TypeScript interfaces using the programmatic API."},"warnings":[{"fix":"Consider migrating to Firebase's official Security Rules tools or use firebase-bolt directly.","message":"Package has not been updated since 2017 and may not work with newer Firebase products (Firestore, etc.).","severity":"deprecated","affected_versions":">=1.2.0"},{"fix":"Read the file contents separately before passing to compile().","message":"The compile function expects the full Bolt source, not just a file path. It does not handle file I/O; the CLI does that.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade to v1.2.0+ and update generated type imports to include path functions.","message":"Before v1.2.0, TypeScript generation did not include path helper functions. Code relying on path helpers may break if upgrading from <1.2.0.","severity":"breaking","affected_versions":"<1.2.0"},{"fix":"Use shell redirection: firebase-bolt-compiler < input.bolt > output.ts","message":"The CLI output goes to stdout; there is no --output flag. Redirect to file manually.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use named import: import { compile } from 'firebase-bolt-compiler';","cause":"Using default import when the package only exports named exports.","error":"TypeError: compile is not a function"},{"fix":"Install firebase-bolt: npm install firebase-bolt","cause":"Missing peer dependency firebase-bolt.","error":"Cannot find module 'firebase-bolt'"},{"fix":"Install globally: npm install -g firebase-bolt-compiler, or use npx: npx firebase-bolt-compiler","cause":"Global installation missing or not in PATH.","error":"firebase-bolt-compiler: command not found"},{"fix":"Validate the .bolt file using firebase-bolt's validator or check the Bolt language specification.","cause":"Invalid Bolt syntax in input file.","error":"Error: Could not parse bolt file: Unexpected token"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}