A robust file uploader for Cloudflare R2. Complements Render nicely.
If you want something simpler though, try https://github.com/Erisa/simple-r2-form.
- Multipart uploads
- Uploads are resumable (even after tab refreshes)
- Image editor
- Progress tracking
- Most of these are thanks to Uppy!
- Aster DOES NOT AUTHENTICATE! You should put it behind Cloudflare Access.
- Non-multipart uploads are currently disabled in the UI because Uppy doesn't display the URL: transloadit/uppy#4618
- Configure the R2 bucket CORS policy in the Cloudflare dashboard:
[
{
"AllowedOrigins": ["https://[CHANGE ME TO YOUR WORKER CUSTOM DOMAIN]"],
"AllowedMethods": ["GET", "PUT"],
"MaxAgeSeconds": 3000,
"AllowedHeaders": [
"Authorization",
"x-amz-date",
"x-amz-content-sha256",
"content-type"
],
"ExposeHeaders": ["ETag", "Location"]
}
]
- Create a R2 token: here with
Object Read & Write
permissions.
- Clone locally:
git clone https://github.com/kotx/aster.git
- Install dependencies:
pnpm i
- Tweak
wrangler.toml
to your liking (setbucket_name
,PUBLIC_BUCKET_URL
,R2_BUCKET_NAME
) - Run
wrangler secret put [NAME]
forR2_ACCESS_KEY
,R2_SECRET_KEY
- Run
pnpm run deploy
- Fork this repository
- Set the secrets
CF_API_TOKEN
(with theEdit Cloudflare Workers
template) andCF_ACCOUNT_ID
in the repo settings - Enable workflows in the Actions tab
- Update
wrangler.toml
as needed (this will trigger the workflow) - In your Cloudflare dashboard, set the required secrets
R2_ACCESS_KEY
,R2_SECRET_KEY
in the worker settings.
Remember to add "http://127.0.0.1:8787", "http://localhost:8787"
to the allowed origins CORS policy above.
Install deps:
pnpm i
Start development server:
pnpm dev