SETUP GUIDES · FILE STORAGE
Cloudflare R2 bucket
Store your app’s files in Cloudflare R2, with no download fees.
Cloudflare R2 works like Amazon S3 but does not charge for downloads. You create a bucket and an API token that can only read and write that one bucket.
Words you’ll see
- Bucket
- A storage container for files at a storage provider, like a top-level folder in the cloud. Your app’s uploads go into it.
- Access key ID and secret access key
- A pair of values that works like a username and password for programs. The ID can be shown; the secret is shown once when you create it.
- Endpoint
- The web address Claspine uses to reach your storage provider, such as https://s3.us-east-1.amazonaws.com.
- Signed URL
- A web link that allows one upload or download for a few minutes. Claspine creates these so files travel directly between your users and your bucket without passing through Claspine.
- CORS
- A browser safety setting on the bucket that says which websites may upload or download directly. Without it, browsers block uploads from your app.
Steps
- In the Cloudflare dashboard open R2 Object Storage and click Create bucket.
- Open Manage R2 API Tokens → Create API token.
- Set permission to Object Read & Write and choose Apply to specific buckets only → your bucket. Create the token.
- Copy the Access Key ID, the Secret Access Key and the S3 address shown (
https://<ACCOUNT_ID>.r2.cloudflarestorage.com). - Open your bucket → Settings → CORS policy and allow PUT and GET from your app’s web address.
- Open the Claspine console, choose your project and go to File Storage.
- Pick this provider in the list, then fill in the fields as shown in “What goes where in Claspine” below.
- Click Save & test. Claspine writes one tiny test file into your bucket, reads it back and deletes it. A green result means everything is connected.
What goes where in Claspine
| Console field | Value |
|---|---|
| ENDPOINT | https://<ACCOUNT_ID>.r2.cloudflarestorage.com |
| REGION | auto |
| ACCESS KEY ID / SECRET | From the token in step 4. |
Keep it safe
- A token limited to one bucket cannot read or delete anything else in your Cloudflare account.
Claspine stores the values encrypted, never shows them again in full, and never sends them to your app or SDK.