Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
N

nuxt-cron

> 前端框架
Open source

A Nuxt module for cron jobs in your app.

99 stars0 likes1 views
WebsiteGitHub

About

A Nuxt module for cron jobs in your app.

Nuxt Cron

npm version npm downloads License

A Nuxt module for cron jobs in your app.

  • Documentation
  • Playground
  • ✨ Releases

Features

  •   19 time presets
  • ️  Time zone support
  • ️  TypeScript support
  • ✨  Auto imports enabled
  • ⚡  Zero configuration to start
  •   Nuxt 3/4 support
  •   Extendable by Nuxt modules

Installation

bash
# Using pnpm
pnpm add nuxt-cron -D

# Using yarn
yarn add nuxt-cron -D

# Using npm
npm install nuxt-cron -D

Usage

Setup

Add nuxt-cron to the modules section of nuxt.config.ts

javascript
export default defineNuxtConfig({
  modules: ['nuxt-cron']
})

Configuration

You can configure the module by adding a nuxt-cron section to your nuxt.config file.

javascript
export default defineNuxtConfig({
  cron: {
    runOnInit: true,
    timeZone: 'Africa/Abidjan',
    jobsDir: 'cron'
  }
})

by default, nuxt-cron will auto-import your cron from the models directory from server directory. You can change this behavior by setting the jobsDir option.

API

defineCronHandler

This function creates a new cron job. Example usage:

typescript
// server/cron/job.ts
import { defineCronHandler } from '#nuxt/cron'

export default defineCronHandler('everySecond', () => {
  console.log('I run every seconds')
})

or use with params:

typescript
// server/cron/job.ts
import { defineCronHandler } from '#nuxt/cron'

export default defineCronHandler('everySecond', () => {
  console.log('I run every seconds')
}, { runOnInit: true })

More examples can be found here.

Credits

A huge thank you to everyone who is helping to improve nuxt-cron. Thanks to you, the project can evolve!

Contributors

To become a contributor, please follow our contributing guide.

License

This app is open-sourced software licensed under the MIT license.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptcronnodenuxt-modulenuxt3

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架