{"id":20375092,"url":"https://github.com/hebertcisco/nestjs-techniques-firebase-admin","last_synced_at":"2026-04-13T12:01:37.960Z","repository":{"id":292542998,"uuid":"980108433","full_name":"hebertcisco/nestjs-techniques-firebase-admin","owner":"hebertcisco","description":"NestJS Firebase Admin Integration","archived":false,"fork":false,"pushed_at":"2026-04-08T23:19:40.000Z","size":2739,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-09T00:20:44.646Z","etag":null,"topics":["firebase","firebase-cloud-messaging","firebase-database","firebase-realtime-database","nestjs","nestjs-library"],"latest_commit_sha":null,"homepage":"https://github.com/hebertcisco/nestjs-firebase-admin","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/hebertcisco.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-08T15:17:29.000Z","updated_at":"2026-04-08T23:20:00.000Z","dependencies_parsed_at":"2025-09-13T22:14:36.975Z","dependency_job_id":"41c308a5-9ecf-43e9-842e-3e60fdbd5041","html_url":"https://github.com/hebertcisco/nestjs-techniques-firebase-admin","commit_stats":null,"previous_names":["hebertcisco/nestjs-techniques-firebase-admin"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hebertcisco/nestjs-techniques-firebase-admin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hebertcisco%2Fnestjs-techniques-firebase-admin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hebertcisco%2Fnestjs-techniques-firebase-admin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hebertcisco%2Fnestjs-techniques-firebase-admin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hebertcisco%2Fnestjs-techniques-firebase-admin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hebertcisco","download_url":"https://codeload.github.com/hebertcisco/nestjs-techniques-firebase-admin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hebertcisco%2Fnestjs-techniques-firebase-admin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31751705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T09:16:15.125Z","status":"ssl_error","status_checked_at":"2026-04-13T09:16:05.023Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["firebase","firebase-cloud-messaging","firebase-database","firebase-realtime-database","nestjs","nestjs-library"],"created_at":"2024-11-15T01:28:46.687Z","updated_at":"2026-04-13T12:01:37.954Z","avatar_url":"https://github.com/hebertcisco.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NestJS Techniques: Firebase Admin\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://nestjs.com/\" target=\"blank\"\u003e\u003cimg src=\"https://nestjs.com/img/logo-small.svg\" width=\"120\" alt=\"Nest Logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nExample project demonstrating how to integrate [nestjs-firebase-admin](https://www.npmjs.com/package/nestjs-firebase-admin) with NestJS, including Realtime Database CRUD, FCM push notifications, and MQTT-based event-driven messaging.\n\n## Stack\n\n| Layer | Technology |\n|---|---|\n| Framework | NestJS 11 |\n| Firebase | `nestjs-firebase-admin` (Admin SDK wrapper) |\n| Messaging | MQTT via `@nestjs/microservices` |\n| Push Notifications | Firebase Cloud Messaging (FCM) |\n| Docs | Swagger (`@nestjs/swagger`) |\n| Validation | `class-validator` + `class-transformer` |\n| Deploy | Docker, Docker Compose, Fly.io |\n\n## Project Structure\n\n```\nsrc/\n  app.module.ts             # Root module (Firebase Admin + MQTT setup)\n  app.controller.ts         # REST endpoints (CRUD)\n  app.service.ts            # Business logic (DatabaseService usage)\n  main.ts                   # Bootstrap (HTTP + MQTT microservice + Swagger)\n  dtos/\n    SetDataDto.ts           # Create DTO with validation\n    UpdateDataDto.ts        # Partial update DTO\n  notification/\n    notification.controller.ts  # MQTT event listener (@EventPattern)\n    notification.service.ts     # FCM + MQTT publish logic\n```\n\n## Prerequisites\n\n- Node.js \u003e= 20\n- Firebase project with Admin SDK credentials\n- MQTT broker (e.g., Mosquitto)\n\n## Setup\n\n```bash\nnpm install\ncp .env.example .env\n```\n\nFill in `.env`:\n\n```env\nFIREBASE_PROJECT_ID=your-project-id\nFIREBASE_CLIENT_EMAIL=your-client-email\nFIREBASE_PRIVATE_KEY=\"-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n\"\nFIREBASE_DATABASE_URL=https://your-project.firebaseio.com\nFIREBASE_STORAGE_BUCKET=your-project.appspot.com\nMQTT_URL=mqtt://localhost:1883\nPORT=5672\n```\n\n## Running\n\n```bash\n# Development (watch mode)\nnpm run start:dev\n\n# Production\nnpm run build \u0026\u0026 npm run start:prod\n```\n\nThe app starts both an HTTP server and an MQTT microservice. Swagger docs are available at `/docs`.\n\n## API Endpoints\n\n| Method | Path | Description |\n|---|---|---|\n| `GET` | `/` | List all data |\n| `POST` | `/` | Create data (triggers MQTT event + delayed FCM notification) |\n| `PUT` | `/update/:id` | Update data by ID |\n| `DELETE` | `/delete/:id` | Delete data by ID |\n\n## How It Works\n\n1. **Create** (`POST /`) - Saves data to Firebase Realtime Database, then publishes a `data-created` event via MQTT\n2. **MQTT Listener** - `NotificationController` subscribes to `data-created` events using `@EventPattern`\n3. **FCM Push** - `NotificationService` sends a welcome push notification via FCM after a 10s delay\n4. **CRUD** - All database operations use `DatabaseService` from `nestjs-firebase-admin`\n\n## Docker\n\n```bash\n# Build and run\ndocker build -t nestjs-techniques-firebase-admin .\ndocker run --env-file .env -p 5672:5672 nestjs-techniques-firebase-admin\n\n# Or with Docker Compose\ndocker-compose up --build\n```\n\n## Deploy to Fly.io\n\n```bash\nfly launch\nfly deploy\n```\n\nThe `fly.toml` is pre-configured for the `gru` region on port 5672.\n\n## Testing\n\n```bash\nnpm run test          # Unit tests\nnpm run test:e2e      # E2E tests\nnpm run test:cov      # Coverage\n```\n\n## License\n\n[UNLICENSED](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhebertcisco%2Fnestjs-techniques-firebase-admin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhebertcisco%2Fnestjs-techniques-firebase-admin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhebertcisco%2Fnestjs-techniques-firebase-admin/lists"}