{"id":47684,"library":"firebase-rest","title":"firebase-rest","description":"A lightweight REST client for Firebase Realtime Database, version 1.0.0. It wraps the standard Fetch API to provide a simple interface for CRUD operations, supporting both raw and JSON-parsed responses via `Client` and `JSONClient`. Unlike the official Firebase SDK, it avoids heavy dependencies and can be used in Node.js environments without a full Firebase setup. The package is ESM-only, requires `node-fetch` under the hood, and includes TypeScript type definitions.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/fny/node-firebase-rest","tags":["javascript","firebase","rest","typescript"],"install":[{"cmd":"npm install firebase-rest","lang":"bash","label":"npm"},{"cmd":"yarn add firebase-rest","lang":"bash","label":"yarn"},{"cmd":"pnpm add firebase-rest","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"HTTP client for making REST requests","package":"node-fetch","optional":false}],"imports":[{"note":"This is the default export. Named export does not exist.","wrong":"import { FirebaseREST } from 'firebase-rest'","symbol":"FirebaseREST","correct":"import FirebaseREST from 'firebase-rest'"},{"note":"Client is a property of the default export, not a separate named export.","wrong":"import { Client } from 'firebase-rest'","symbol":"Client","correct":"const { Client } = FirebaseREST;"},{"note":"JSONClient is a property of the default export, not a separate named export.","wrong":"import { JSONClient } from 'firebase-rest'","symbol":"JSONClient","correct":"const { JSONClient } = FirebaseREST;"}],"quickstart":{"code":"import FirebaseREST from 'firebase-rest';\n\nconst client = new FirebaseREST.JSONClient('https://your-db.firebaseio.com', { auth: process.env.FIREBASE_SECRET ?? '' });\n\nasync function main() {\n  // Write data\n  await client.put('/users/1', { name: 'Alice', email: 'alice@example.com' });\n\n  // Read data\n  const res = await client.get('/users/1');\n  console.log(res.body);\n\n  // Update data\n  await client.patch('/users/1', { email: 'alice@newdomain.com' });\n\n  // Delete data\n  await client.delete('/users/1');\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Demonstrates basic CRUD operations using JSONClient with authentication from environment variable."},"warnings":[{"fix":"Use `const FirebaseREST = require('firebase-rest').default;` instead of `const FirebaseREST = require('firebase-rest');`","message":"The package is ESM-only; CommonJS require() works only via .default at the end.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Access them as `FirebaseREST.Client` or `FirebaseREST.JSONClient` after importing the default.","message":"Client and JSONClient are properties of the default export, not named exports.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pass the object directly; the library handles JSON.stringify internally.","message":"The payload for PUT/POST/PATCH must be a plain object or value, not a stringified JSON.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always provide `auth` either in options or via query parameters.","message":"The `auth` option is required for authenticated requests; omitting it may result in 401 errors if the database has security rules.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.0':13 'api':19 'avoid':46 'client':7,37 'crud':26 'databas':11 'definit':78 'depend':48 'environ':55 'esm':65 'esm-on':64 'fetch':18,70 'firebas':2,9,43,59,80 'firebase-rest':1 'full':58 'heavi':47 'hood':73 'includ':75 'interfac':24 'javascript':79 'json':33 'json-pars':32 'jsonclient':39 'lightweight':5 'node':69 'node-fetch':68 'node.js':54 'offici':42 'oper':27 'packag':62 'pars':34 'provid':21 'raw':30 'realtim':10 'requir':67 'respons':35 'rest':3,6,81 'sdk':44 'setup':60 'simpl':23 'standard':17 'support':28 'type':77 'typescript':76,82 'unlik':40 'use':52 'version':12 'via':36 'without':56 'wrap':15","created_at":"2026-06-07T16:52:46.483779+00:00","updated_at":"2026-06-07T16:52:46.483779+00:00","problems":[{"fix":"const FirebaseREST = require('firebase-rest').default;","cause":"Using CommonJS require without .default","error":"TypeError: FirebaseREST is not a constructor"},{"fix":"Run `npm install firebase-rest` and ensure correct spelling.","cause":"Package not installed or wrong package name","error":"Cannot find module 'firebase-rest'"},{"fix":"Ensure you use the correct import: `import FirebaseREST from 'firebase-rest'` then `new FirebaseREST.JSONClient(...)`","cause":"Client not instantiated correctly (e.g., importing named export instead of using default export property)","error":"TypeError: client.get is not a function"},{"fix":"Pass a plain object, e.g., `{ key: 'value' }`, not `JSON.stringify({ key: 'value' })`","cause":"Passing a string instead of a JavaScript object as payload","error":"Unexpected token o in JSON at position 1"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/fny/node-firebase-rest#readme","github":"https://github.com/fny/node-firebase-rest","docs":null,"changelog":null,"pypi":null,"npm":"firebase-rest","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}