- Entry:
src/index.tsstarts the Hono app on port 4141 (configurable at build/deploy level) and connects router. - Router:
src/router/index.tsorchestrates- Config validation (reads
config.json) - Redis connection (
services/dbRedis.ts) - Storage setup (
storage/storageManager.tswith S3/FTP/SFTP/LOCAL) - Global middleware: logger, unhandled error handler
- Routes registration
- Config validation (reads
- Controllers
CtrlImagehandles single-image flow (read, transform viaSharpManager, save, return)CtrlBatchhandles directory/list batch operations and progress updatesCtrlConfigconfig related handling, validates storage credentialsCtrlRedisthin wrapper for high-level handling of references/progress with Redis
- Services
SharpManager: typed, chainable wrapper aroundsharp- Storage managers:
S3Manager,FtpClientManager,SftpClientManager DbRedis: connection and helpers for Redis
- Utilities
validateConfig.ts: zod-basedconfig.jsonvalidatorfunctions.ts: helpers – query parsing/validation, content-type mapping, S3 path sanitizing, etc.extras.ts: parameter and format maps
- Middlewares
middlewareResponse- standardized response wrappermiddlewareUnhandled- catching all unhandled errors