1.5 KiB
1.5 KiB
S3 Mover
A small web app with a Go backend and React frontend for listing, uploading, downloading, and deleting files in an S3 bucket.
Structure
backend: Go HTTP API for S3 operationsfrontend: React + Vite client
Backend configuration
Set these environment variables before starting the API:
AWS_REGION: AWS region for the bucketS3_BUCKET: target bucket nameS3_PREFIX: optional folder prefix inside the bucketFRONTEND_ORIGIN: allowed browser origin for CORS, for examplehttp://localhost:5173SERVER_ADDR: HTTP bind address, default:8080AWS_ENDPOINT_URL: optional custom S3-compatible endpointAWS_USE_PATH_STYLE: set totruefor MinIO and some S3-compatible providersAWS_ACCESS_KEY_ID: access key for S3-compatible storageAWS_SECRET_ACCESS_KEY: secret key for S3-compatible storage
Standard AWS credentials are supported through the normal SDK chain. You can also set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN.
For DigitalOcean Spaces, a typical configuration looks like:
export AWS_ACCESS_KEY_ID=[OBFUSCATED]
export AWS_SECRET_ACCESS_KEY=[OBFUSCATED]
export AWS_REGION=lon1
export S3_BUCKET=blackdice-agent
export AWS_ENDPOINT_URL=https://lon1.digitaloceanspaces.com
export AWS_USE_PATH_STYLE=false
export FRONTEND_ORIGIN=http://localhost:5173
Run locally
Backend:
cd backend
go mod tidy
go run .
Frontend:
cd frontend
npm install
VITE_API_BASE_URL=http://localhost:8080 npm run dev
Then open http://localhost:5173.