Installation and architecture
Factorydrive is a NestJS storage abstraction. Applications configure named disks and use one common API whether data lives on a local filesystem, S3-compatible object storage, SFTP, or a custom backend.
Requirements
- Node.js 22 or newer
- NestJS 6 through 11
- TypeScript 5
Install the core
bash
npm install @ficsysfr/nestjs_module_factorydriveInstall a satellite driver only when the application needs it:
bash
npm install @ficsysfr/nestjs_module_factorydrive-s3
npm install @ficsysfr/nestjs_module_factorydrive-sftpDependency direction
Application services should inject FactorydriveService. They should not import node:fs, S3Client, or an SFTP client for persistent application files.
text
Business service
|
FactorydriveService
|
AbstractStorage
/ | \
local S3 SFTPFactorydriveService.getDisk() resolves the configured default disk. Select a named disk only when the use case intentionally targets a specific storage destination.
Minimal application module
ts
import { Module } from '@nestjs/common'
import { FactorydriveModule } from '@ficsysfr/nestjs_module_factorydrive'
@Module({
imports: [
FactorydriveModule.forRoot({
default: 'files',
disks: {
files: {
driver: 'local',
config: { root: `${process.cwd()}/storage` },
},
},
}),
],
})
export class AppModule {}Continue with configuration or review the 2.0 scope migration.