Netpress Laravel-inspired backend framework for Node.js
Frameworkv0.1.14 Starterv0.1.12 Docsv1.0.3
Overview Installation Architecture CLI
Features

Queues

Queues move slow work out of the request cycle. In the starter kit, jobs run through BullMQ and Redis, while the base job class comes from the netpress package.

Quick Example

// app/Jobs/SendWelcomeEmailJob.js
import { BaseJob } from "@admicaa/netpress";
import WelcomeMail from "../Mail/WelcomeMail.js";

export default class SendWelcomeEmailJob extends BaseJob {
  static get queue() {
    return "emails";
  }

  async handle({ user }) {
    await new WelcomeMail(user).send(user.email);
  }
}

Explanation

BaseJob gives you a class-based way to dispatch work. QueueServiceProvider binds the Redis connection to the container, then queue:work discovers job classes in app/Jobs/ and runs them.

Additional Examples

Dispatch a job:

await SendWelcomeEmailJob.dispatch({ user });

Delay a job:

await SendWelcomeEmailJob.dispatchAfter(60_000, { user });

Start the worker:

npm run artisan -- queue:work --queue=emails

Advanced Usage

Use separate queues for mail, imports, and long-running tasks when your application starts to grow. That makes worker tuning and failure handling much easier.

Notes / Tips

  • Keep job payloads small.
  • Push side effects into jobs when the HTTP response should stay fast.
  • Make sure Redis is available before relying on queue workers in local development.