Server
Backend handlers, route policies, and lifecycle hooks for S3 file flows.
@dimah-s3/server generates
presigned URLs, enforces route constraints, authorizes requests through
guards, and coordinates lifecycle callbacks.
Uploads and, by default, downloads travel directly between the browser and the bucket through short-lived signed URLs. Downloads can instead use same-origin proxy mode. S3 credentials stay on the server, and deletions run server-side.
Key features
- Unified configuration —
dimahS3()exports both an HTTP route handler and a typed server-sideapi. - Server-owned keys — The server generates namespaced object keys instead of trusting browser-provided keys.
- HeadObject verification — Confirmation rechecks stored byte length and
Content-Typemetadata from S3. - Lifecycle hooks — Run auth, persistence, quotas, and cleanup at defined operation boundaries.
- Framework adapters — Mount handlers in Next.js, Hono, Express, Fastify, SvelteKit, Elysia, and standard Fetch runtimes.
Documentation
Server Setup
Install and mount route handlers across modern runtimes.
Routes
Configure routes, file constraints, operations, and key prefixes.
Security
Guards, key isolation, tenant scoping, and metadata validation.
Errors
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.