Index UI for Cloudflare R2 storage
R2 Index is a project designed to provide a storage index similar to typical file servers on Apache or Nginx. Currently, it works together with r2-ingress due to tooling restrictions. A brief architecture is shown below.
r2-ingress
would be the entry point of the service, and r2-index
serves as a service binding.
- File index page
- Filtering file names
- Ordering by file name, size, and modified date and more will come
To install the project, follow these steps:
- Clone the repository:
git clone https://github.com/poooi/r2-index.git
- Navigate to the project directory:
cd r2-index
- Install the dependencies:
pnpm install
To use the project, first you need to assign your R2 bucket with a custom domain, which will be the same domain as r2-ingress
. Then for this project, just change the worker configuration in wrangler.toml
to fit your situation, as well as the R2 site config. Explanation:
config name | usage |
---|---|
name | worker name |
account_id | optional, useful for manual deployment when the user has access to multiple Cloudflare accounts |
assets | asset binding for worker with assets, required by opennext-cloudflare |
r2_buckets | R2 storage bindings |
kv_namespaces | required by opennext-cloudflare to save temp files |
observability | optional, send logs to the worker logs tab |
routes | URLs that the r2-ingress should take, usually the same as the domain assigned to the R2 bucket, Cloudflare will route the traffic to the worker first |
services | service binding so that the 2 workers could be bound together |
To update TypeScript definition, run corepack pnpm cf-typegen
.
After deploying this worker, you'll also need to change the service binding in r2-ingress
and have it deployed.
We welcome contributions! Please follow these steps to contribute:
- Fork and clone the repository.
- Create a new branch:
git checkout -b feature-branch
- Make your changes and commit them:
git commit -m "Description of your changes"
- Push to the branch:
git push origin feature-branch
- Create a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.