Coder Social home page Coder Social logo

rabbithole's Introduction

Rabbithole

Commandline Cloudflare R2 pre-signed URL file uploader using KV and Worker

Inspired by Construindo back-end de app de upload/download de arquivos

Features

  • Upload files to Cloudflare R2 Bucket using pre-signed URL
  • JWT authentication
  • Progress bar (with percent and average speed)
  • Sharable link after upload
  • User upload history
  • MIME Content-Type filtering

Setting up

Installation

# Clone git repository
git clone https://github.com/caiostoduto/rabbithole.git
cd rabbithole

# Deploy pages.dev/functions
pnpm web install
pnpm web pages:deploy

# Install cli
pnpm cli install
pnpm cli build
npm install -g ./@app/cli

Configuring

# Create a KV Namespace
https://developers.cloudflare.com/kv/get-started/

# Configure KV Namespace in Pages/Functions
https://developers.cloudflare.com/pages/functions/bindings/

# Add /index redirect URL to KV
https://github.com/caiostoduto/rabbithole/blob/main/docs/kv-redirect.jpeg

# Create a R2 Bucket
https://developers.cloudflare.com/r2/get-started/

# (Optional) Congifure file deletion after 7 days
https://github.com/caiostoduto/rabbithole/blob/main/docs/auto-deletion.jpeg

# Create a R2 API Token (with write access)
https://developers.cloudflare.com/r2/api/s3/tokens/

# Set environment variables
https://developers.cloudflare.com/pages/functions/bindings/#environment-variables

# Re-eploy pages.dev/functions
pnpm web pages:deploy

# Configure cli (jwt must be the same as the one in the environment variables)
rabbithole setup

Enviroment variables:

Variable Description
ACCESSKEYID Cloudflare Account ID
BUCKETNAME Cloudflare R2 Bucket Name
ENDPOINT Cloudflare R2 Bucket S3 Endpoint
JWTSECRET Random string without special chars
SECRETACCESSKEY Cloudflare R2 Bucket ID

Usage

$ rabbithole --help

Usage: rabbithole [options] [command]

Rabbithole CLI

Options:
  -V, --version              output the version number
  -h, --help                 display help for command

Commands:
  upload|u [options] <path>  Upload file to rabbithole storage
  history                    Show history
  setup                      Setup rabbithole cli settings
  help [command]             display help for command

rabbithole's People

Watchers

Caio Stoduto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.