Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/climactic/tinyjobs
TinyJobs is tiny user-friendly background jobs framework for JavaScript runtimes.
https://github.com/climactic/tinyjobs
background-jobs bullmq hacktoberfest jobs queue redis tinyjobs
Last synced: about 2 months ago
JSON representation
TinyJobs is tiny user-friendly background jobs framework for JavaScript runtimes.
- Host: GitHub
- URL: https://github.com/climactic/tinyjobs
- Owner: Climactic
- Created: 2024-08-25T21:49:30.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-03T18:30:05.000Z (4 months ago)
- Last Synced: 2024-10-11T11:32:29.293Z (2 months ago)
- Topics: background-jobs, bullmq, hacktoberfest, jobs, queue, redis, tinyjobs
- Language: TypeScript
- Homepage:
- Size: 661 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TinyJobs
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/Climactic/TinyJobs/ci.yml?style=flat-square)
![NPM License](https://img.shields.io/npm/l/tinyjobs?style=flat-square)
![NPM Version](https://img.shields.io/npm/v/tinyjobs?style=flat-square&label=tinyjobs)
![NPM Version](https://img.shields.io/npm/v/@tinyjobs/cli?style=flat-square&label=@tinyjobs/cli)TinyJobs is tiny user-friendly background jobs framework for JavaScript runtimes.
## What's inside?
This repo includes the following packages/apps:
### Apps and Packages
- [`tinyjobs`](packages/tinyjobs/README.md): TinyJobs core package that provides the framework for creating and running background jobs.
- [`@tinyjobs/cli`](packages/cli/README.md): CLI for managing TinyJobs in your project.
- [`@example/app`](apps/example/README.md): Example app that demonstrates how to use TinyJobs.
- [`@tinyjobs/eslint-config`](packages/eslint-config/README.md): `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
- [`@tinyjobs/typescript-config`](packages/typescript-config): `tsconfig.json`s used throughout the monorepo## CLI
Install and use the TinyJobs CLI to manage TinyJobs in your project.
```sh
npm i -G @tinyjobs/cli
tinyjobs
```## Usage
Instantiate a new `TinyJobs` instance and add the job:```ts
import TinyJobs from 'tinyjobs';const tinyJobs = new TinyJobs();
// Load jobs from the jobs directory
await tinyJobs.loadJobs();// Invoke the job to run in the background
await tinyJobs.invoke('exampleJob', { name: 'world' });
```## Creating a Job
### Your First Job
Let's create a new job in the `jobs` directory:
```ts
import { Job } from 'tinyjobs';export default class FirstJob extends Job {
constructor() {
super({
name: "firstJob",
});
}async run({ name }: { name: string }) {
console.log(`Hello, ${data.name}!`);
}
}
```## Roadmap
TinyJobs is not feature complete and still in early stages, you can refer to the roadmap for the list of currently planend features and their progress [here](https://github.com/orgs/Climactic/projects/1/views/4).## Develop
To develop all apps and packages, run the following command:
```bash
bun run dev:packages # run watch modeon packages
bun run dev:apps # run watch mode on example app
```