open-index/open-npm huggingface dataset:
npm package: @safaricom-mxl/nuxthub
Description: Self-hosted log retention for mxllog using NuxtHub database storage
Latest version: 0.0.4

# @safaricom-mxl/nuxthub

[![npm version](https://img.shields.io/npm/v/@safaricom-mxl/nuxthub?color=black)](https://npmjs.com/package/@safaricom-mxl/nuxthub)
[![npm downloads](https://img.shields.io/npm/dm/@safaricom-mxl/nuxthub?color=black)](https://npm.chart.dev/@safaricom-mxl/nuxthub)
[![CI](https://img.shields.io/github/actions/workflow/status/HugoRCD/mxllog/ci.yml?branch=main&color=black)](https://github.com/HugoRCD/mxllog/actions/workflows/ci.yml)
[![TypeScript](https://img.shields.io/badge/TypeScript-black?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
[![Nuxt](https://img.shields.io/badge/Nuxt-black?logo=nuxt&logoColor=white)](https://nuxt.com/)
[![Documentation](https://img.shields.io/badge/Documentation-black?logo=readme&logoColor=white)](https://mxllog.dev)
[![license](https://img.shields.io/github/license/HugoRCD/mxllog?color=black)](https://github.com/HugoRCD/mxllog/blob/main/LICENSE)

Self-hosted log retention for [mxllog](https://mxllog.dev) using [NuxtHub](https://hub.nuxt.com) database storage. Store, query, and automatically clean up your structured logs with zero external dependencies.

## Setup

Install the packages:

```bash
npx nuxi module add @nuxthub/core @safaricom-mxl/nuxthub
```

Add the module to your `nuxt.config.ts`:

```typescript
export default defineNuxtConfig({
  modules: ['@nuxthub/core', '@safaricom-mxl/nuxthub'],

  mxllog: {
    retention: '7d',
  },
})
```

> `@safaricom-mxl/log/nuxt` and `@nuxthub/core` can be auto-installed if missing, but we recommend installing `@nuxthub/core` explicitly and registering it in `modules`.

## Configuration

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `retention` | `string` | `'7d'` | How long to keep events. Accepts `d` (days), `h` (hours), or `m` (minutes). |

The cleanup cron schedule is automatically derived from the retention value.

## Database Support

NuxtHub supports multiple database dialects. The `mxllog_events` table schema is automatically registered for:

- **SQLite** (default for Cloudflare D1)
- **MySQL**
- **PostgreSQL**

## Deployment

For Vercel deployments, the module can create a `vercel.json` with the appropriate cron schedule during `nuxi module add`. For Cloudflare and other platforms, the Nitro scheduled task handles cleanup automatically.

## Documentation

[Full documentation](https://mxllog.dev)

## License

[MIT](https://github.com/HugoRCD/mxllog/blob/main/LICENSE)