A robust file uploader for Cloudflare R2. Complements Render nicely.
If you want something simpler though, try https://github.com/Erisa/simple-r2-form.
![a screenshot of aster](https://private-user-images.githubusercontent.com/33439542/260266129-19b7ea0d-0d1c-40b5-963a-5d815cc9aa06.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ4OTk5MzAsIm5iZiI6MTcyNDg5OTYzMCwicGF0aCI6Ii8zMzQzOTU0Mi8yNjAyNjYxMjktMTliN2VhMGQtMGQxYy00MGI1LTk2M2EtNWQ4MTVjYzlhYTA2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI5VDAyNDcxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQyYTgxNjJlMGM0YjE3YjViNTEzZGZlM2NhMWU3MTU2YThmMTg2ZjMwNTQyOWE5ODMwMDVhNWZmYTg4YzRhNzMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.CdHiyj73XrWAAzdEukV8PYv7OrBF9UvM58hDFZfGGdE)
- 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