Files
s3mover/README.md
2026-03-26 11:46:30 +00:00

62 lines
1.7 KiB
Markdown

# 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 operations
- `frontend`: React + Vite client
- `docs`: product and implementation planning documents
## Product Documentation
- `docs/PRD.md`: product requirements document for the full application
## Backend configuration
Set these environment variables before starting the API:
- `AWS_REGION`: AWS region for the bucket
- `S3_BUCKET`: target bucket name
- `S3_PREFIX`: optional folder prefix inside the bucket
- `FRONTEND_ORIGIN`: allowed browser origin for CORS, for example `http://localhost:5173`
- `SERVER_ADDR`: HTTP bind address, default `:8080`
- `AWS_ENDPOINT_URL`: optional custom S3-compatible endpoint
- `AWS_USE_PATH_STYLE`: set to `true` for MinIO and some S3-compatible providers
- `AWS_ACCESS_KEY_ID`: access key for S3-compatible storage
- `AWS_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:
```bash
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:
```bash
cd backend
go mod tidy
go run .
```
Frontend:
```bash
cd frontend
npm install
VITE_API_BASE_URL=http://localhost:8080 npm run dev
```
Then open `http://localhost:5173`.