ImageKit Storage Provider
This provider adds the ImageKit Node SDK, validates IMAGEKIT_PRIVATE_KEY with Zod, and ships the same Multer memory-upload middleware pattern as the Cloudinary provider.
Features
- Zod-validated ImageKit credentials
- Shared
ImageKitclient instance from config - Multer memory storage with allowlist MIME types and 5 MB max file size
- MVC and Feature architecture variants
Installation Guide
npx servercn-cli add pr imagekit-storageFile Structure
MVC
-
src/configs/env.ts -
src/configs/imagekit.ts -
src/middlewares/upload-file.ts
Feature
-
src/shared/configs/env.ts -
src/shared/configs/imagekit.ts -
src/shared/middlewares/upload-file.ts
Environment Configuration
src/configs/env.ts
ImageKit client
src/configs/imagekit.ts
The template file includes commented uploadToImageKit and deleteFileFromImageKit helpers using toFile from @imagekit/nodejs—use those as a starting point in a service layer.
Upload middleware (Multer)
src/middlewares/upload-file.ts
Usage
Use upload.single("fieldName") (or array/fields) on your route, then upload req.file.buffer via the helpers described in the template’s imagekit.ts comments.