All skills
onmax avatar

/nitro

@de09c7b official
by Maxonmax/nuxt-skills715 stars
38

Nitro is the framework-agnostic server toolkit (powering Nuxt) for building and deploying web servers anywhere. Use when working with nitro.config, server routes/event handlers, route rules, caching, storage, tasks, websockets, or deploying to Node/Bun/Deno/Cloudflare/Vercel.

Use this Skill: https://skilld.dev/gh/onmax/nuxt-skills/nitro

This session only. Nothing lands on disk.

referencescore-storage.md

≈927 tokens on demand. Your agent reads this file only when SKILL.md points to it.

KV Storage

Nitro ships a runtime-agnostic key-value layer powered by unstorage. Access it with useStorage() from nitro/storage.

Usage

import { useStorage } from "nitro/storage";

// Default storage (in-memory, not persisted across restarts)
await useStorage().setItem("test:foo", { hello: "world" });
const value = await useStorage().getItem("test:foo");

// Scope to a base/mountpoint
const test = useStorage("test");
await test.setItem("foo", { hello: "world" });

// Type the return value
await useStorage<{ hello: string }>("test").getItem("foo");

Common methods

Method Description
getItem(key) / setItem(key, val) Read / write (returns null if missing).
getItemRaw / setItemRaw Binary / unserialized values.
getItems / setItems Batch operations.
hasItem(key) Existence check.
removeItem(key) Delete a key.
getKeys(base?) / clear(base?) List / clear by prefix.
getMeta(key) / setMeta(key, meta) Metadata (mtime, etag, type, ttl).
mount(base, driver) / unmount(base) Dynamically attach a driver.
watch(cb) / unwatch() React to "update" / "remove" events.

Aliases: get, set, has, del, remove, keys.

Configuring drivers

Mount drivers by name; the key is the mount point, the value is the driver config.

import { defineConfig } from "nitro";

export default defineConfig({
  storage: {
    redis: { driver: "redis", url: "redis://localhost:6379" },
    db: { driver: "redis", host: "prod.example.com" },
  },
  // Override mounts in dev (e.g. when the prod driver isn't available locally)
  devStorage: {
    db: { driver: "fs", base: "./.data/db" },
  },
});

Then useStorage("redis") / useStorage("db"). See the unstorage drivers list (fs, memory, redis, cloudflare-kv, s3, ...).

Built-in mount points

  • Default (no base): in-memory, not persisted. Mount an fs/redis driver to persist.
  • assets:server (a.k.a. assets/server): read-only access to bundled server assets — see core-assets.
  • cache: used by the caching layer — see core-cache.

Runtime / dynamic mounts

When credentials are only known at runtime, mount a driver from a plugin:

import { definePlugin } from "nitro";
import { useStorage } from "nitro/storage";
import redisDriver from "unstorage/drivers/redis";

export default definePlugin(() => {
  const storage = useStorage();
  storage.mount("redis", redisDriver({
    base: "redis",
    host: process.env.REDIS_HOST,
    port: process.env.REDIS_PORT,
  }));
});

Key Points

  • Import useStorage from nitro/storage (v2 path nitropack/runtime/storage is gone).
  • Default storage is in-memory; configure a persistent driver via storage for production.
  • Use devStorage to swap drivers in development without changing production config.
  • Prefer this abstraction over platform-specific KV APIs (e.g. Cloudflare KV) for portability.
<!-- Source references: - https://nitro.build/docs/storage - https://unstorage.unjs.io -->

Source: SKILL.md on GitHub

No alerts9d3 checks · Risk SAFE
  • Gen Agent Trust Hub9d

    The Nitro skill provides comprehensive documentation for building and deploying web servers using the Nitro framework. It covers routing, configuration, storage, caching, database integration, and deployment presets. The skill is informative and describes standard web framework features and best practices.

  • Socket9d

    No alerts

  • Snyk9d

    Risk: LOW · No issues

Signed by skilld at de09c7b. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated last week
Other metadata
metadata
{
  "author": "Anthony Fu",
  "version": "2026.6.22",
  "source": "Generated from https://github.com/nitrojs/nitro, scripts located at https://github.com/antfu/skills"
}

README badge

README badge for onmax/nuxt-skills/nitro