[PR #3364] [CLOSED] feat: FileStorage plugin #4784

Closed
opened 2026-03-13 11:59:41 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3364
Author: @ping-maxwell
Created: 7/13/2025
Status: Closed

Base: mainHead: feat/file-storage


📝 Commits (10+)

📊 Changes

21 files changed (+2291 additions, -229 deletions)

View changed files

📝 docs/components/sidebar-content.tsx (+7 -0)
docs/content/docs/plugins/file-storage.mdx (+429 -0)
📝 packages/better-auth/src/client/path-to-object.ts (+35 -23)
📝 packages/better-auth/src/client/proxy.ts (+15 -4)
packages/file-storage/build.config.ts (+12 -0)
packages/file-storage/package.json (+54 -0)
packages/file-storage/src/client.ts (+105 -0)
packages/file-storage/src/create-route.ts (+9 -0)
packages/file-storage/src/file-storage.test.ts (+8 -0)
packages/file-storage/src/index.ts (+562 -0)
packages/file-storage/src/providers/file-system.ts (+68 -0)
packages/file-storage/src/providers/index.ts (+26 -0)
packages/file-storage/src/routes/index.ts (+1 -0)
packages/file-storage/src/routes/userImage.ts (+69 -0)
packages/file-storage/src/types/index.ts (+291 -0)
packages/file-storage/src/types/mime-types.ts (+193 -0)
packages/file-storage/src/types/schema.ts (+34 -0)
packages/file-storage/src/utils.ts (+22 -0)
packages/file-storage/tsconfig.json (+20 -0)
packages/file-storage/vitest.config.ts (+10 -0)

...and 1 more files

📄 Description

File Storage Plugin

Connect a file storage provider of your choice to Better-auth and allow for secure file uploads!

Features

  • Securely upload a profile image during sign-up.
  • Allows the dev to create "file routes" to easily handle upload/get/delete operations for files for different scenarios.
  • Allows other plugins to extend off of the file-storage plugin.

https://github.com/user-attachments/assets/6dc1e832-25de-4b30-9bfa-8bb6009a99b3


Summary by cubic

Added a FileStorage plugin to Better-auth, allowing secure file uploads, downloads, and deletions with support for custom storage providers and file routes.

  • New Features
    • Upload, get, and delete files through new endpoints.
    • Define custom file routes with validation, hooks, and metadata schemas.
    • Support for pluggable storage providers, including a file system provider.
    • Extensible for other plugins to build on top of file storage.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/3364 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 7/13/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/file-storage` --- ### 📝 Commits (10+) - [`1544a94`](https://github.com/better-auth/better-auth/commit/1544a94107057385d44d7bee00e5f4774a414b3e) fix: add support for formData via authClient - [`a2ac65a`](https://github.com/better-auth/better-auth/commit/a2ac65a1d739caa3dc04a41fa1d1f7b384620dcd) feat: file-storage - [`3211c71`](https://github.com/better-auth/better-auth/commit/3211c716640876d5adf17c3bce1aeb6b610f378b) Update packages/file-storage/src/index.ts - [`9427802`](https://github.com/better-auth/better-auth/commit/9427802d924b10776b05ab3f86f00c26902a0b82) chore: cleanup - [`29d9193`](https://github.com/better-auth/better-auth/commit/29d9193f7eb9226956efde2893f7ca878c400387) chore: lint - [`3ebe173`](https://github.com/better-auth/better-auth/commit/3ebe173da3f4a67d0aa81b841c7530ef4dd4579d) chore: lockfile - [`bfab134`](https://github.com/better-auth/better-auth/commit/bfab134de40316414c2b6fcd55ea4c11603354da) add: temp test - [`5e33aef`](https://github.com/better-auth/better-auth/commit/5e33aef7c4a2ed3c73c54c71e25aae0360059d49) WIP: docs - [`6a8dc43`](https://github.com/better-auth/better-auth/commit/6a8dc4334aecac95a277547c109fc7c56cacf965) fix: root dir should be cwd - [`1d37345`](https://github.com/better-auth/better-auth/commit/1d373455dd3df0ca805dffc55372ff5d80f752e7) chore: lint ### 📊 Changes **21 files changed** (+2291 additions, -229 deletions) <details> <summary>View changed files</summary> 📝 `docs/components/sidebar-content.tsx` (+7 -0) ➕ `docs/content/docs/plugins/file-storage.mdx` (+429 -0) 📝 `packages/better-auth/src/client/path-to-object.ts` (+35 -23) 📝 `packages/better-auth/src/client/proxy.ts` (+15 -4) ➕ `packages/file-storage/build.config.ts` (+12 -0) ➕ `packages/file-storage/package.json` (+54 -0) ➕ `packages/file-storage/src/client.ts` (+105 -0) ➕ `packages/file-storage/src/create-route.ts` (+9 -0) ➕ `packages/file-storage/src/file-storage.test.ts` (+8 -0) ➕ `packages/file-storage/src/index.ts` (+562 -0) ➕ `packages/file-storage/src/providers/file-system.ts` (+68 -0) ➕ `packages/file-storage/src/providers/index.ts` (+26 -0) ➕ `packages/file-storage/src/routes/index.ts` (+1 -0) ➕ `packages/file-storage/src/routes/userImage.ts` (+69 -0) ➕ `packages/file-storage/src/types/index.ts` (+291 -0) ➕ `packages/file-storage/src/types/mime-types.ts` (+193 -0) ➕ `packages/file-storage/src/types/schema.ts` (+34 -0) ➕ `packages/file-storage/src/utils.ts` (+22 -0) ➕ `packages/file-storage/tsconfig.json` (+20 -0) ➕ `packages/file-storage/vitest.config.ts` (+10 -0) _...and 1 more files_ </details> ### 📄 Description # File Storage Plugin Connect a file storage provider of your choice to Better-auth and allow for secure file uploads! ## Features - Securely upload a profile image during sign-up. - Allows the dev to create "file routes" to easily handle upload/get/delete operations for files for different scenarios. - Allows other plugins to extend off of the file-storage plugin. https://github.com/user-attachments/assets/6dc1e832-25de-4b30-9bfa-8bb6009a99b3 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Added a FileStorage plugin to Better-auth, allowing secure file uploads, downloads, and deletions with support for custom storage providers and file routes. - **New Features** - Upload, get, and delete files through new endpoints. - Define custom file routes with validation, hooks, and metadata schemas. - Support for pluggable storage providers, including a file system provider. - Extensible for other plugins to build on top of file storage. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 11:59:41 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#4784