{"id":23377977,"url":"https://github.com/beyondjs/firestore-collection","last_synced_at":"2026-03-09T11:32:06.876Z","repository":{"id":200218530,"uuid":"705056464","full_name":"beyondjs/firestore-collection","owner":"beyondjs","description":"Lightweight JavaScript library for handling Firestore collections with optimized queries, caching, and real-time updates.","archived":false,"fork":false,"pushed_at":"2024-10-25T17:22:15.000Z","size":94,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-24T02:28:34.874Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beyondjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-14T23:03:23.000Z","updated_at":"2024-10-25T17:22:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"c295a203-8d42-42cf-bedb-8d51589f5cec","html_url":"https://github.com/beyondjs/firestore-collection","commit_stats":null,"previous_names":["beyondjs/firestore-collection"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/beyondjs/firestore-collection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondjs%2Ffirestore-collection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondjs%2Ffirestore-collection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondjs%2Ffirestore-collection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondjs%2Ffirestore-collection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beyondjs","download_url":"https://codeload.github.com/beyondjs/firestore-collection/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondjs%2Ffirestore-collection/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30292411,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T11:12:22.024Z","status":"ssl_error","status_checked_at":"2026-03-09T11:10:54.577Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-21T18:33:40.665Z","updated_at":"2026-03-09T11:32:06.860Z","avatar_url":"https://github.com/beyondjs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BeyondJS Firestore Collection\n\n## Overview\n\nThe `Collections` module provides a TypeScript class for simplifying interactions with Firestore collections and\ndocuments. Utilizing the power of TypeScript's strong typing, this class aims to make it easier to handle CRUD\noperations in Firestore.\n\n## Features\n\n-   Strongly typed operations via TypeScript.\n-   Methods for retrieving a collection or a document.\n-   Asynchronous methods for fetching document snapshots.\n-   Integrated error handling using the `ModelError` class from the `Errors` module.\n-   Uniform API responses using the `Response` class.\n\n## Usage\n\n### Authentication and Configuration\n\nDuring development, the `Collection` class will attempt to authenticate using the credentials specified in a local JSON\nfile (`credentials/gcloud.json`). Place this file in the root of your project and ensure it contains valid Firebase\ncredentials. If the file is found, it will be used as the primary method for authentication. If not present, the class\ndefaults to using the credentials of the associated Google Cloud service account.\n\n**Important:**\n\n-   **Local Development**: We recommend you to use a service account only in local environment. Ensure you include the\n    `credentials` path in your `.gitignore` file to prevent uploading sensitive information to version control.\n-   **Production Deployment**: When deploying your application, avoid using service account credentials. Instead, rely\n    on the identity and access management (IAM) configurations that are native to the environment where your application\n    is hosted (e.g., Google Cloud IAM roles).\n\n### Initialization\n\nTo include this module in your project, import it as follows:\n\n```typescript\nimport { Collection } from '@beyond-js/firestore-collection/collection';\n```\n\nCreate a new `Collection` object by specifying the Firestore collection name.\n\n```typescript\nconst users = new Collection\u003cUserType\u003e('Users');\n```\n\n### Fetching a Collection\n\nRetrieve a Firestore collection reference.\n\n```typescript\nconst collection = users.col();\n```\n\n### Fetching a Document\n\nRetrieve a Firestore document reference.\n\n```typescript\nconst doc = users.doc({ id: '...', parent: '...' });\n```\n\n### Fetching a Document Snapshot\n\nGet a snapshot of a document asynchronously.\n\n```typescript\nconst response = await users.snapshot({ id: '...', parent: '...' });\n```\n\n### Fetching Document Data\n\nFetch document data along with additional metadata asynchronously.\n\n```typescript\nconst response = await users.data({ id: '...', parent: '...' });\n```\n\n### Error Handling\n\nThe `Collections` class uses `ModelError` for error encapsulation and returns it as part of a `Response` object.\n\n```typescript\nconst response = await users.data({ id: 'nonexistentId', parent: '...' });\nif (response.error) return response.error;\nif (!response.data.exists) return response.data.error;\n```\n\n## API Reference\n\n-   `Collection\u003cDataType\u003e`: Generic class for managing Firestore collections.\n-   `col(params?: { parent?: string })`: Method to get a collection reference.\n-   `doc(params: { id: string; parent: string })`: Method to get a document reference.\n-   `snapshot(params: { id: string; parent: string })`: Asynchronous method to fetch a document snapshot.\n-   `data(params: { id: string; parent: string })`: Asynchronous method to fetch document data along with metadata.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondjs%2Ffirestore-collection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeyondjs%2Ffirestore-collection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondjs%2Ffirestore-collection/lists"}