Sign inSign up

shreevatshan/dragndrop

By shreevatshan

•Updated 3 months ago

A lightweight file sharing web application that allows users to upload and download files.

Image
Networking
Developer tools
Databases & storage
0

644

shreevatshan/dragndrop repository overview

⁠Drag 'n Drop File Sharing Web Application

A lightweight file sharing web application built with Go that allows users to upload and download files without authentication.

⁠Features

  • Simple and intuitive user interface
  • File upload with drag and drop functionality
  • File selection via traditional file picker
  • Folder upload with maintained directory structure
  • List of all uploaded files with download links
  • Copy download URL to clipboard
  • Download folders as ZIP files
  • Responsive design that works on mobile and desktop

⁠Quick Start with Docker

The fastest way to run the application is with the published image.

docker run -d \
  --name dragndrop \
  -p 8080:8080 \
  -e PUBLIC_DOMAIN=files.example.com \
  -v dragndrop_uploads:/app/static/uploads \
  shreevatshan/dragndrop:latest

The server will start at http://localhost:8080⁠

PUBLIC_DOMAIN is required — set it to the address other machines reach this host on (its LAN IP, hostname, or domain). It's the host that shareable Copy link URLs point at, so a link you copy still resolves when pasted on another machine. The container refuses to start without it.

Uploaded files are persisted in the dragndrop_uploads volume so they survive container recreation.

⁠Using Docker Compose

Create a docker-compose.yaml:

services:
  dragndrop:
    image: shreevatshan/dragndrop:latest
    container_name: dragndrop
    restart: unless-stopped
    environment:
      # REQUIRED — host that shareable "Copy link" URLs point at.
      - PUBLIC_DOMAIN=${PUBLIC_DOMAIN:?set PUBLIC_DOMAIN to your host's address}
    ports:
      # Change HOST_PORT to publish on a different host port.
      - "${HOST_PORT:-8080}:8080"
    volumes:
      # Persist uploaded files across container recreation.
      - uploads:/app/static/uploads

volumes:
  uploads:

Then run:

PUBLIC_DOMAIN=files.example.com docker compose up -d
⁠Configuration

Each setting is read from a command-line flag if present, otherwise an environment variable, otherwise its default (flags win over env):

FlagEnvDefaultPurpose
-public-domainPUBLIC_DOMAINrequiredHost (or full origin) that shareable Copy link URLs point at
-portPORT8080Port the server binds to
-basepathBASE_PATH(none)Path prefix the app is served under, e.g. /fileshare

Only the Copy link action uses the public domain; assets, uploads and downloads are loaded relative to the page, so the app itself still works fine when you browse it via localhost.

Examples:

docker run -d -p 8080:8080 \
  -e PUBLIC_DOMAIN=https://files.example.com \
  -v dragndrop_uploads:/app/static/uploads \
  shreevatshan/dragndrop:latest
⁠Supported Tags
  • latest — the most recent build
  • The image is multi-arch and runs on linux/amd64 and linux/arm64.

⁠Running from Source

If you'd rather build and run the application directly, you'll need Go 1.16 or higher.

# Clone the repository
git clone https://github.com/shreevatshan/dragndrop.git
cd dragndrop

# Run the application
go run main.go

The server will start at http://localhost:8080⁠

-public-domain is required; the other flags (and their environment-variable equivalents) are optional:

# Required public domain, plus a custom port and path prefix
go run main.go -public-domain 192.168.1.50 -port 9000 -basepath /fileshare

# Equivalent via environment variables
PUBLIC_DOMAIN=192.168.1.50 PORT=9000 BASE_PATH=/fileshare go run main.go
⁠Building the Docker image yourself
git clone https://github.com/shreevatshan/dragndrop.git
cd dragndrop
docker build -t dragndrop .

⁠Usage

  1. Open your web browser and navigate to http://localhost:8080⁠
  2. Choose between "Upload Files" or "Download Files" tabs
  3. To upload files:
    • Drag and drop files onto the upload area, or
    • Click "Choose Files" to select individual files from your device
    • Click "Choose Folder" to select and upload an entire folder with its structure
  4. To download files:
    • Click the "Download Files" tab to see all uploaded files and folders
    • For individual files:
      • Click "Download" to download a file directly
      • Click "Copy URL" to copy the download link to your clipboard
    • For folders:
      • Click "Download" to download the entire folder as a ZIP archive

⁠Project Structure

.
├── main.go                # Go server implementation
├── Dockerfile             # Multi-arch container build
├── docker-compose.yaml    # Compose deployment
├── templates/
│   └── index.html         # HTML template for the web interface
├── static/
│   ├── css/
│   │   └── style.css      # CSS styles
│   ├── js/
│   │   └── app.js         # JavaScript functionality
│   └── uploads/           # Directory for uploaded files
└── README.md              # This file

⁠License

This project is open source and available under the MIT License⁠.

Tag summary

Content type

Image

Digest

sha256:8f07b1135…

Size

10 MB

Last updated

3 months ago

docker pull shreevatshan/dragndrop