There are two ways to enable S3 or S3 compatible storage in bknd.
Enable via the admin UI.
Simply navigate to the Media tab of the bknd admin UI and enable the S3 media support.
Enter your AWS S3-compatible storage Access Key, Secret Access Key, and URL.
This will automatically configure the S3 adapter for you.
For local development and testing, you can use the local file system adapter. This is particularly useful when working with Node.js environments.
bknd.config.ts
import { registerLocalMediaAdapter } from "bknd/adapter/node";import type { BkndConfig } from "bknd/adapter";// Register the local media adapterconst local = registerLocalMediaAdapter();export default { initialConfig: { media: { enabled: true, adapter: local({ path: "./public/uploads", // Files will be stored in this directory }), }, },} satisfies BkndConfig;
This configuration will store uploaded files in the specified directory,
making them accessible through your application's public path (in this case)
or at /api/media/file/{filename}.