{"id":14968863,"url":"https://github.com/leafyeexyz/filebox","last_synced_at":"2025-07-17T06:04:56.353Z","repository":{"id":248510516,"uuid":"828733778","full_name":"LeafYeeXYZ/FileBox","owner":"LeafYeeXYZ","description":"Zero cost and serverless file delivery web app based on CloudflareR2 or MongoDB or File0 or Supabase / 基于多种可选免费存储服务的零成本无服务器文件快递柜","archived":false,"fork":false,"pushed_at":"2025-05-27T02:48:57.000Z","size":1216,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-27T03:37:26.436Z","etag":null,"topics":["cloud-storage","cloudflare","cloudflare-pages","cloudflare-workers","file0","javascript","mongodb","nextjs","r2","react","supabase","supabase-js","tailwindcss","typescript","vercel","vercel-serverless","websocket"],"latest_commit_sha":null,"homepage":"https://pan.leafyee.xyz","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LeafYeeXYZ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-15T02:45:04.000Z","updated_at":"2025-05-27T02:49:00.000Z","dependencies_parsed_at":"2024-07-30T15:05:29.118Z","dependency_job_id":"e3dcf2bf-b7e8-4186-b8e4-e8ddc36573d6","html_url":"https://github.com/LeafYeeXYZ/FileBox","commit_stats":{"total_commits":51,"total_committers":2,"mean_commits":25.5,"dds":"0.019607843137254943","last_synced_commit":"a987b589fb3541f9032bb4b4cd363d0caa2df8df"},"previous_names":["leafyeexyz/filebox"],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/LeafYeeXYZ/FileBox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeafYeeXYZ%2FFileBox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeafYeeXYZ%2FFileBox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeafYeeXYZ%2FFileBox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeafYeeXYZ%2FFileBox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeafYeeXYZ","download_url":"https://codeload.github.com/LeafYeeXYZ/FileBox/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeafYeeXYZ%2FFileBox/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265571189,"owners_count":23790035,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud-storage","cloudflare","cloudflare-pages","cloudflare-workers","file0","javascript","mongodb","nextjs","r2","react","supabase","supabase-js","tailwindcss","typescript","vercel","vercel-serverless","websocket"],"created_at":"2024-09-24T13:40:43.705Z","updated_at":"2025-07-17T06:04:56.348Z","avatar_url":"https://github.com/LeafYeeXYZ.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FileBox\nA serverless file delivery web app based on free `Cloudflare R2` / `MongoDB Atlas` / `File0` / `Supabase` databases, using `Next.js`, `React`, `Ant Design`, `Tailwind CSS`, etc.\n\n基于 `Cloudflare R2` / `MongoDB Atlas` / `File0` / `Supabase` 的零成本无服务器文件快递柜, 采用 `Next.js`, `React`, `Ant Design`, `Tailwind CSS` 等技术栈.\n\n|![](README_1.png)|![](README_2.png)|![](README_3.png)|![](README_4.png)|\n|:---:|:---:|:---:|:---:|\n\n# Usage\n使用方法\n\n# 1 Install Dependencies\n安装依赖\n\n```bash\nbun i\n```\n\n# 2 Local Development\n本地开发\n\n```bash\nbun dev\n```\n\n# 3 Deploy\n部署\n\n## 3.1 Config Storage\nYou can use all the storage solutions while only one of them is required. And when using `R2`, you should deploy a separate server side project (not this `Next.js` project).\n\n你可以同时使用所有存储解决方案, 但只需要其中一个. 当使用 `R2` 时, 你需要部署一个单独的服务端项目 (不是这个 `Next.js` 项目).\n\nAbove all, you should set `FILEBOX_UPLOAD_PW`, `FILEBOX_DOWNLOAD_PW` environment variables in `.env` file or `Vercel` no matter which storage solution you use.\n\n不管使用哪种存储方案, 你都需要在 `.env` 文件或 `Vercel` 中设置 `FILEBOX_UPLOAD_PW`, `FILEBOX_DOWNLOAD_PW` 环境变量.\n\n### 3.1.1 For Cloudflare R2\n如果使用 `Cloudflare R2`\n\nSee `workers` directory.\n\n见 `workers` 目录.\n\n### 3.1.2 For MongoDB\n如果使用 `MongoDB`\n\nSet `MONGODB_URI` environment variables in `.env` file or `Vercel`.\n\n在 `.env` 文件或 `Vercel` 中设置 `MONGODB_URI` 环境变量.\n\n### 3.1.3 For [File0](https://file0.dev/)\n如果使用 [`File0`](https://file0.dev/)\n\nSet `F0_SECRET_KEY` environment variable in `.env` file or `Vercel`.\n\n在 `.env` 文件或 `Vercel` 中设置 `F0_SECRET_KEY` 环境变量.\n\n### 3.1.4 For [Supabase](https://supabase.io/)\n如果使用 [`Supabase`](https://supabase.io/)\n\nSet `SUPABASE_URL` and `SUPABASE_KEY` environment variables in `.env` file or `Vercel`.\n\n在 `.env` 文件或 `Vercel` 中设置 `SUPABASE_URL` 和 `SUPABASE_KEY` 环境变量.\n\nCreate a storage bucket named `filebox` and create a table named `filebox` in `Supabase` dashboard. The table should have the following columns: key (text), filename (text), created_at (timestamp), filetype (text).\n\n在 `Supabase` 控制台中创建一个名为 `filebox` 的存储桶, 并创建一个名为 `filebox` 的表. 表应该有以下列: key (text), filename (text), created_at (timestamp), filetype (text).\n\n## 3.2 Deploy to [Vercel](https://vercel.com/)\n部署到 [Vercel](https://vercel.com/)\n\n# 4 All Environment Variables\n| Name | Description | Default | Required |\n| :---: | :---: | :---: | :---: |\n| `FILEBOX_UPLOAD_PW` | Upload Password | - | Yes |\n| `FILEBOX_DOWNLOAD_PW` | Download Password | - | Yes |\n| `MONGODB_URI` | MongoDB Connection URI | - | No |\n| `F0_SECRET_KEY` | File0 Secret Key | - | No |\n| `SUPABASE_URL` | Supabase URL | - | No |\n| `SUPABASE_KEY` | Supabase SECRET api key\u003cbr\u003eOr `anon` api key with additional permission | - | No |\n| `NEXT_PUBLIC_DEFAULT_SERVER` | Client Default R2 Server | - | No |\n| `NEXT_PUBLIC_DEFAULT_UPLOAD_PW` | Client Default Upload Password | - | No |\n| `NEXT_PUBLIC_DEFAULT_DOWNLOAD_PW` | Client Default Download Password | - | No |\n| `NEXT_PUBLIC_DEFAULT_STORAGE` | Client Default Storage Server\u003cbr\u003e`r2` / `mongodb` / `file0` / `supabase` | `supabase` | No |\n| `NEXT_PUBLIC_DEFAULT_UPLOAD_TYPE` | Client Default Upload Type\u003cbr\u003e`file` / `text` | `file` | No |\n\n# 5 Frontend Config\n| Name | Description |\n| :---: | :---: |\n| `上传密码` | For authentication, should be the same as the `FILEBOX_UPLOAD_PW` environment variable in the server side |\n| `下载密码` | For authentication, should be the same as the `FILEBOX_DOWNLOAD_PW` environment variable in the server side |\n| `存储服务器` | Choose storage server |\n| `R2 服务器地址` | See [3.1.1](#311-for-cloudflare-r2), only appears when `R2` is selected |\n\n# 6 Realtime Progress Support\n上传/下载实时进度支持情况\n\n| Storage | Upload | Download |\n| :---: | :---: | :---: |\n| `R2` | ✅ (XHR's onUploadProgress Event) | ✅ (Fetch \u0026 Stream API) |\n| `MongoDB` | ✅ (Split File into Chunks \u0026 XHR's onUploadProgress Event) | ✅ (Fetch \u0026 Stream API) |\n| `File0` | ❌ (SDK's Upload API) | ✅ (SDK's Download as Stream) |\n| `Supabase` | ✅ (XHR's onUploadProgress Event) | ✅ (Public Direct Download Link) |\n\n\u003e `R2` and `MongoDB` have different real-time upload progress implementations because vercel has a 4.5MB limit on the request body size while cloudflare workers is 100MB. As a result, `MongoDB`'s upload speed is slower than other three storage solutions.\n\n\u003e `R2` 和 `MongoDB` 有不同的实时上传进度实现, 因为 vercel 对请求体大小有 4.5MB 的限制, 而 cloudflare workers 为 100MB. 因此, `MongoDB` 的上传速度比其他三种存储方案慢.\n\n# 7 File Storage Architecture\n文件存储架构\n\n| Storage | File | Metadata |\n| :---: | :---: | :---: |\n| `R2` | Cloudflare R2 (ArrayBuffer) | Cloudflare R2 |\n| `MongoDB` | `file` Collection (Base64) | `meta` Collection |\n| `File0` | File0 (Blob) | File0 |\n| `Supabase` | Supabase Storage (Blob) | Supabase Postgres |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafyeexyz%2Ffilebox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleafyeexyz%2Ffilebox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafyeexyz%2Ffilebox/lists"}