# @schedulekit/firebase

> Schedule toolkit for Firebase

Latest version **0.10.0** (published 2023-04-17) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install @schedulekit/firebase
pnpm add @schedulekit/firebase
yarn add @schedulekit/firebase
bun add @schedulekit/firebase
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.10.0 |
| Published | 2023-04-17 |
| First published | 2022-10-05 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 34.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sasha Koss |
| Maintainers | kossnocorp |
| Keywords | Firebase, schedule, Firestore, serverless, Firebase, Functions |

## Links

- npm: https://www.npmjs.com/package/@schedulekit/firebase
- Repository: https://github.com/kossnocorp/schedulekit
- Homepage: https://github.com/kossnocorp/schedulekit#readme
- Issues: https://github.com/kossnocorp/schedulekit/issues
- npm.io page: https://npm.io/package/@schedulekit/firebase

## Dependencies (6)

- [croner](https://npm.io/package/croner.md) ^5.1.1
- [date-fns](https://npm.io/package/date-fns.md) ^2.29.3
- [typesaurus](https://npm.io/package/typesaurus.md) 10.0.0-beta.4
- [firebase-admin](https://npm.io/package/firebase-admin.md) ^11.0.1
- [firebase-functions](https://npm.io/package/firebase-functions.md) ^3.24.1
- [@google-cloud/tasks](https://npm.io/package/@google-cloud/tasks.md) ^3.0.2

## Recent versions

- 0.10.0 (latest) — 2023-04-17
- 0.9.1 — 2022-11-21
- 0.9.0 — 2022-11-21
- 0.8.0 — 2022-10-08
- 0.7.0 — 2022-10-08
- 0.6.0 — 2022-10-06
- 0.5.0 — 2022-10-06
- 0.4.0 — 2022-10-06
- 0.3.0 — 2022-10-05
- 0.2.0 — 2022-10-05
- 0.1.0 — 2022-10-05

## README

# Schedule Kit

🚧 Work in progress

## Setting Up

First, follow these steps to create Cloud Tasks queue, set up and deploy schedule function:

1. Make sure you have created a Firebase project and initialized Firebase Functions.
2. [Enable Cloud Tasks API](https://console.cloud.google.com/cloudtasks)
3. [Create a queue](https://console.cloud.google.com/cloudtasks/create). Note that the queue name and the region will be required to set up the Schedule Kit.
4. Set up and export a function.

   ```js
   const functions = require("firebase-functions");
   // 1. Import the function
   const { createScheduleKit } = require("@schedulekit/firebase");
   // 2. Import firebase-admin
   const admin = require("firebase-admin");

   // 3. Initialize the app
   admin.initializeApp();

   // 4. Set up and export function
   const { processSchedule } = createScheduleKit("schedule-queue", {
     region: "asia-southeast1-a", // You can skip options if you use us-central1
   });
   export { processSchedule };

   exports.helloWorld = functions.https.onRequest((request, response) => {
     functions.logger.info("Hello logs!", { structuredData: true });
     response.send("Hello from Firebase!");
   });
   ```

5. Deploy the functions

### Executions recovery

Create a composite index with the given settings to enable executions recovery:

- Collection: `executions`
- Fields:
  - `state`: Ascending
  - `startedAt`: Ascending
- Query scope: Collection group

---
_Source: https://npm.io/package/@schedulekit/firebase · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
