Skip to content

arcxteam/cloudflare-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Supercharge Your Buckets Files with Cloudflare R2 Storage

A Comprehensive Guide: How to Set Up Private Storage with Cloudflare R2 Buckets and S3 API Compatibility
Craft your personalized storage buckets, forging a realm of effortless file management and securely by Cloudflare R2

Version cloudflare AWS Storage License


Overview

Project knowledgment. This project a powerful and user-friendly private file storage management, was born from a its self flexibility vision. The core concept, direction, and design were by © Greyscope&Co | 0xgrey resulting in a compactibility and intuitive storage clouding but securing. The project not only meets current needs but also anticipates personal requirements, ensuring a seamless and secure user experience.

Key Features

  • ❇️ Support Continuous: Full-stack deployment (backend and frontend), with UI/UX compatibility on both mobile and desktop
  • 📊 Bucket Status: Realtime api data tracking, progress bar, bucket file stored, bucket size stored, unBucket size stored and bucket time reset (manage 10GB monthly)
  • 📁 Bucket Files: Fast file uploads up to 1GB-more (configurable), search by filename, download count tracking, copy/share link functionality, and RAW file mode
  • 🎨 UI Multiple Icons: Supports all icon media files and effects, with up to 6 files per slide in windows
  • 🧩 Flexible Deploy: Compatible with Amazon S3 API (boto3) for flexible storage deployment
  • 🗑️ Trash & Burn: Comprehensive storage file management with total cleanup functionality to prevent global S3/R2 issues
  • 🐳 Docker: Ready for production and development, fully container-optimized with double/redirect host proxy, fastest no-caching built-in Nginx configuration, and resource usage monitoring
  • ☁️ Cloudflare: Utilizes R2 private storage infrastructure for secure data management

Preview Frontend Web UI Dashboard

https://arcxteam.github.io/cloudflare-storage/frontend/

Requirements

VPS Linux Docker Cloudflare

Project Structure

cloudflare-storage/
├── .gitignore
├── .dockerignore
├── .env.example
├── docker-compose.yml
├── backend/
+   ├── README.md           # Guides delete buckets R2/AWS-S3
│   ├── Dockerfile
│   ├── requirements.txt
│   ├── app.py
│   ├── delete_buckets.py
│   └── data/
│       └── .gitkeep
├── frontend/
│   ├── Dockerfile
│   ├── nginx.conf.template
│   ├── index.html
│   ├── style.css
│   ├── script.js
│   └── src/
│       └── favicon.ico
├── docs/
+   ├── README.md          # Guides main host nginx + template
│   └── /etc/nginx/sites-available/your-domain
│
├── LICENSE
└── README.md

Quick Start

1. Prerequisites

Signup & Securely Cloudflare Access

Install Docker & Compose if not already installed

Instal docker is optional, if you don't have.. try securely

curl -sSL https://raw.githubusercontent.com/arcxteam/succinct-prover/refs/heads/main/docker.sh | sudo bash

2. Clone Repository

git clone https://github.com/arcxteam/cloudflare-storage.git
cd cloudflare-storage

Configure Environment

Create edit & save configuration file

cp .env.example .env
nano .env

Example config environment variable

R2_ACCOUNT_ID=YOUR_ACCOUNT_ID
R2_ACCESS_KEY_ID=YOUR_ACCESS_KEY_ID
R2_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY
R2_BUCKET_NAME=YOUR_NAME_CREATE_BUCKETS
+ Enabled (Public Development URL or Custom Domains, Create Record A sub-sub-domain)
R2_PUBLIC_URL=https://pub-xxxxx.r2.dev or https://sub-sub-your-domain.com

# NOTE: Choose one, personal access web-ui dashboard (upload/download)
+ Option A: IP Public server
PUBLIC_BASE_URL=http://your-ip-address

+ Option B: Localnetwork (VSCode/Codespaces/etc)
PUBLIC_BASE_URL=http://localhost

+ Option C: Custom domains
PUBLIC_BASE_URL=https://your-domain.com or sub-domain

Create Buckets

  1. Access Dashboard Cloudflare
  2. Chosee Storage & databaseR2 Object StorageOverview
  3. Create bucket
  4. Add Detail Bucket:
    • Bucket name: Create unique
    • Location: Automatic
  5. Save → Create bucket

Create R2 API token

  1. Return to R2, then select Manage R2 API tokens.
  2. Select Create Account API Tokens.
  3. In Permissions, select Object Read & Write.
  4. In Specify bucket(s), choose Apply to specific buckets only. Select the bucket you created.
  5. For TTL default is forever or Define how long this token will stay active:
  6. For Client IP Address Filtering no have action default is blank/null
  7. Select Create API Token.
  8. Copy the Access Key ID, Secret Access Key, and endpoint URL values. You will not be able to access these values again.
  9. Select Finish.

Config CORS Policy

  1. Use mode Custom Domain (Production)
  • Policy name: web-app-cors
  • Allowed origins: https://your-domain
  • Allowed methods: Pilih GET, POST, PUT, DELETE, HEAD
  • Allowed headers: *
  • Max age seconds: 86400
  • Click "Add policy or save"`
  1. Use mode Localhost/Development
  • Policy name: dev-cors-policy
  • Allowed origins: http://localhost:5000, http://127.0.0.1:5000
  • Other are same & TLS 1.3 optional

Choose one CORS above, a format JSON

[
  {
    "AllowedOrigins": ["https://your-domain", "http://localhost:5000", "http://127.0.0.1:5000"],
    "AllowedMethods": ["GET", "POST", "PUT", "DELETE", "HEAD"],
    "AllowedHeaders": ["*"],
    "MaxAgeSeconds": 86400
  }
]

3. Build and Start

Starting running

docker compose up --build -d

Monitor logs & stop

docker compose logs -f
# docker compose down

License

This project is licensed under the MIT License - see the LICENSE file for details.