{"id":47692,"library":"firestore-rest-serdes","title":"Firestore REST SerDes","description":"A lightweight serializer/deserializer for converting between plain JSON objects and Firestore REST API's Document format. Version 1.0.5, stable, no dependencies. Essential for backend functions needing to trigger Firestore security rules via REST with user ID tokens, which the Admin SDK cannot do. Unlike the official Firebase SDK, this module is minimal and framework-agnostic, focusing solely on field conversion.","status":"active","version":"1.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/central182/firestore-rest-serdes","tags":["javascript","Firestore","REST"],"install":[{"cmd":"npm install firestore-rest-serdes","lang":"bash","label":"npm"},{"cmd":"yarn add firestore-rest-serdes","lang":"bash","label":"yarn"},{"cmd":"pnpm add firestore-rest-serdes","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM imports work; CJS require also supported.","wrong":"const serialize = require('firestore-rest-serdes').serialize","symbol":"serialize","correct":"import { serialize } from 'firestore-rest-serdes'"},{"note":"Default import does not exist; use named imports.","wrong":"import serdes from 'firestore-rest-serdes'","symbol":"deserialize","correct":"import { deserialize } from 'firestore-rest-serdes'"},{"note":"CommonJS destructuring works in Node.js.","symbol":"serialize, deserialize","correct":"const { serialize, deserialize } = require('firestore-rest-serdes')"}],"quickstart":{"code":"import { serialize, deserialize } from 'firestore-rest-serdes';\n\nconst plainObj = { hello: 'world', zero: 0 };\nconst serialized = serialize(plainObj);\nconsole.log(serialized);\n// Output: { hello: { stringValue: 'world' }, zero: { integerValue: '0' } }\n\nconst firestoreFields = { hello: { stringValue: 'world' }, zero: { integerValue: '0' } };\nconst deserialized = deserialize(firestoreFields);\nconsole.log(deserialized);\n// Output: { hello: 'world', zero: 0 }","lang":"typescript","description":"Shows basic serialization and deserialization between plain JSON and Firestore REST Document fields."},"warnings":[{"fix":"Manually handle unsupported types using Firestore REST API types before serialization.","message":"The serializer only converts primitive types (string, number, boolean, null) and arrays/objects. MapValue and arrayValue are handled, but timestamp, bytes, reference, geoPoint, and latlng are not serialized correctly and will be omitted or throw.","severity":"gotcha","affected_versions":"<1.1.0"},{"fix":"Extract the fields property from a Document before calling deserialize.","message":"The deserializer expects Firestore field objects with value type keys (e.g., stringValue, integerValue). It does not support the full Document proto (e.g., createTime, updateTime). Passing the entire Document object will cause unexpected behavior.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use BigInt or string for numbers outside Number.MAX_SAFE_INTEGER, but they will be serialized as doubleValue.","message":"Numbers are always serialized as integerValue (for integers) or doubleValue (for floats). There is no support for the Firestore integerValue string format for large integers beyond JavaScript safe integer range.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.5':21 'admin':43 'agnost':59 'api':16 'backend':27 'cannot':45 'convers':64 'convert':8 'depend':24 'document':18 'essenti':25 'field':63 'firebas':50 'firestor':1,14,32,66 'focus':60 'format':19 'framework':58 'framework-agnost':57 'function':28 'id':39 'javascript':65 'json':11 'lightweight':5 'minim':55 'modul':53 'need':29 'object':12 'offici':49 'plain':10 'rest':2,15,36,67 'rule':34 'sdk':44,51 'secur':33 'serd':3 'serializer/deserializer':6 'sole':61 'stabl':22 'token':40 'trigger':31 'unlik':47 'user':38 'version':20 'via':35","created_at":"2026-06-07T16:52:48.877246+00:00","updated_at":"2026-06-07T16:52:48.877246+00:00","problems":[{"fix":"Use 'import { serialize } from 'firestore-rest-serdes'","cause":"Forgot to import or destructure the function correctly when using ESM.","error":"ReferenceError: serialize is not defined"},{"fix":"Use named imports: import { serialize, deserialize } from 'firestore-rest-serdes'","cause":"Attempted to default-import the module (e.g., import serdes from 'firestore-rest-serdes')","error":"TypeError: serialize is not a function"},{"fix":"Convert Date objects to strings or timestamps before serialization.","cause":"Attempted to serialize a Date object, which is not a supported type.","error":"Error: Unknown value type: object at field 'foo'"}],"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/central182/firestore-rest-serdes","github":"https://github.com/central182/firestore-rest-serdes","docs":null,"changelog":null,"pypi":null,"npm":"firestore-rest-serdes","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}}