Introduction
Backend handlers, route policies, and lifecycle hooks for S3 file flows.
@dimah-s3/server is the backend engine for dimah-s3. It generates presigned URLs, enforces route constraints, authorizes requests through guards, and coordinates lifecycle callbacks.
Upload and download operate directly between the client and the bucket via short-lived signed URLs. S3 credentials remain on the server, while deletion is handled securely server-side.
Key features
- Unified configuration —
dimahS3()exports both an HTTP route handler and a typed server-sideapi. - Server-owned keys — Keys follow
{keyPrefix}/{uuid}/{name}namespaces to prevent bucket tampering. - HeadObject verification — Real file sizes and MIME types are verified directly from S3 on upload confirmation.
- Lifecycle hooks — Inject auth, database records, or quota checks at presign, confirmation, and deletion.
- Universal adapters — Native handlers for Next.js, Hono, Express, Fastify, SvelteKit, Elysia, and standard Fetch.
Documentation
Setup & Adapters
Install and mount route handlers across modern runtimes.
Route Definitions
Configure routes, file constraints, operations, and key prefixes.
Security & Auth
Guards, key isolation, tenant scoping, and metadata validation.
Error Handling
APIError structure, error codes, and client mapping.
Lifecycle Hooks
Presign, confirmation, download, and delete lifecycle events.
Plugins
Extend server capabilities with plugins like @dimah-s3/db.