hm-nodejs-storage

Implements S3-compatible object storage with local filesystem fallback as a Fastify plugin.

Updated Apr 26, 2026
One-click install
npx skills add https://github.com/ArkhiMuttaqina/publisher-for-campuss --skill hm-nodejs-storage-arkhimuttaqina
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hm-nodejs-storage
Source: https://github.com/ArkhiMuttaqina/publisher-for-campuss/tree/main/skills/hm-nodejs-storage
Command: npx skills add https://github.com/ArkhiMuttaqina/publisher-for-campuss --skill hm-nodejs-storage-arkhimuttaqina

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @aws-sdk/client-s3, @aws-sdk/s3-request-presigner, fastify-plugin.

What problem does it solve? Adding file uploads, downloads, and presigned URLs to a Node.js backend usually means scattering AWS SDK calls across services and hardcoding S3 as a requirement. This Skill provides a clean Storage interface with automatic backend selection, so services never touch the AWS SDK directly and development works without any S3 credentials. ## Core Features & Use Cases - Dual-backend Storage interface: Automatically uses AWS S3 (or MinIO, DigitalOcean Spaces, Alibaba Cloud OSS) when credentials exist, otherwise falls back to a local filesystem folder. - Presigned URL generation: Lets clients upload and download large files directly to S3, avoiding proxying through the app server. - Fastify plugin integration: Registers a single S3Client via decorator with proper cleanup on app close, plus TypeScript type augmentation. - Use Case: You are building a document upload endpoint in a Fastify API. Use this Skill to set up the storage plugin, accept multipart uploads, store files under UUID-prefixed keys, and return presigned download URLs. ## Quick Start Ask the AI to set up the S3-compatible storage Fastify plugin with a local filesystem fallback and an upload endpoint that returns presigned download URLs.

Frequently Asked Questions about hm-nodejs-storage

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement file uploads in a Fastify API with S3?▼

Register a storage Fastify plugin that decorates the instance with a Storage interface, then use @fastify/multipart's request.file() in routes and call storage.upload() with a UUID-prefixed key. Services receive the interface and never import the AWS SDK directly.

How to generate presigned URLs for direct client uploads to S3?▼

Use getSignedUrl from @aws-sdk/s3-request-presigner with a PutObjectCommand to create an upload URL, or GetObjectCommand for downloads. The client then PUTs the file directly to S3, avoiding proxying large files through your server.

Can I use MinIO or DigitalOcean Spaces instead of AWS S3?▼

Yes, any S3-compatible provider works by setting S3_ENDPOINT to the provider's URL. For MinIO and local S3 emulators, also set S3_FORCE_PATH_STYLE=true because virtual-hosted style addressing does not work with local endpoints.

How do I develop locally without S3 credentials?▼

Make the S3 environment variables optional so the plugin falls back to a local filesystem storage folder when credentials are absent. The same Storage interface is used, so route and service code works unchanged in development and tests.

Why should I not use user-supplied filenames as S3 keys?▼

User-supplied filenames risk path traversal and key collisions. Prefix keys with a resource type and a UUID, keeping the original filename only for readability, for example documents/{uuid}-invoice.pdf.

What are the limitations of presigned upload URLs with local storage?▼

Presigned upload URLs are an S3-only feature, so the local filesystem fallback returns null for getSignedUploadUrl. Services must null-check the result and handle direct server uploads in development-only flows.