2022-04-06 05:56:08 +00:00
# Lifecycle Hooks
Nuxt provides a powerful hooking system to expand almost every aspect using hooks powered by [unjs/hookable ](https://github.com/unjs/hookable ).
2022-08-13 07:27:04 +00:00
## Nuxt Hooks (Build Time)
2022-04-06 05:56:08 +00:00
2022-04-16 13:53:36 +00:00
These hooks are available for [Nuxt Modules ](/guide/going-further/modules ) and build context.
2022-04-06 05:56:08 +00:00
### Usage with `nuxt.config`
```js [nuxt.config]
export default defineNuxtConfig({
hooks: {
'close': () => { }
}
})
```
### Usage with Nuxt Modules
```js
import { defineNuxtModule } from '@nuxt/kit'
export default defineNuxtModule({
setup (options, nuxt) {
nuxt.hook('close', async () => { })
})
})
```
2022-08-13 07:27:04 +00:00
## App Hooks (Runtime)
2022-04-06 05:56:08 +00:00
App hooks can be mainly used by [Nuxt Plugins ](/guide/directory-structure/plugins ) to hook into rendering lifecycle but could also be used in Vue composables.
### Usage with Plugins
```js [plugins/test.ts]
2022-05-06 08:48:10 +00:00
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook('page:start', () => {
/* your code goes here */
})
})
2022-04-06 05:56:08 +00:00
```
::alert{icon=👉}
Learn more about [available lifecycle hooks ](/api/advanced/hooks )
::