Skip to content

Repository files navigation

Gwork

A lightweight local network file-sharing web application. Users register, log in, upload files, and manage their own file library — all from a single-page web UI served by a single Go binary.

Features

  • User Registration & Login — JWT-based authentication with bcrypt password hashing
  • File Upload — Drag-and-drop or click-to-upload with real-time progress
  • File Management — Preview (images/PDF), download with speed indicator, and delete your own files
  • File Sharing — Share files with other users by username; recipients get a notification to accept or deny
  • Online Status — See which users are currently online when choosing a share recipient
  • Dark Theme UI — Clean, modern interface with no build step
  • Single Binary — Entire app compiles to one Go executable with embedded static assets

Quick Start

Requirements

  • Go 1.25+
  • No C compiler needed (uses pure-Go SQLite)

Build

go build -o gwork .

Windows GUI build

On Windows the app can run as a background system-tray application with no console window. Build with:

# PowerShell
$env:GOOS = "windows"; $env:GOARCH = "amd64"
go build -ldflags "-H=windowsgui" -o gwork.exe .
:: CMD
set GOOS=windows
set GOARCH=amd64
go build -ldflags "-H=windowsgui" -o gwork.exe .

The tray icon provides:

  • Open Gwork — opens http://localhost:8080 in the default browser
  • Restart server — restarts the embedded web server
  • Quit — shuts down the application

Run

./gwork

Then open http://localhost:8080 in your browser.

Environment Variables

Variable Default Description
DATA_DIR . Base directory for data
UPLOAD_DIR $DATA_DIR/uploads File uploads folder
DB_PATH $DATA_DIR/localshare.db SQLite database path
PORT 8080 HTTP server port
JWT_SECRET change-me-in-production JWT signing secret

Example:

PORT=8081 JWT_SECRET=my-secret ./gwork

Tech Stack

  • Backend: Go 1.25, stdlib net/http, SQLite via modernc.org/sqlite, JWT via github.com/golang-jwt/jwt/v5
  • Frontend: Vanilla HTML/CSS/JS, no build step, single-page app
  • Windows UX: Optional system-tray mode with no console window
  • Database: SQLite with auto-migration on startup

API Endpoints

Method Path Auth Description
POST /api/auth/register No Register new user
POST /api/auth/login No Login
GET /api/users Yes List users with online status
POST /api/files/upload Yes Upload file
GET /api/files Yes List files (own + accepted shares)
GET /api/files/download/{id} Yes Download file
DELETE /api/files/delete/{id} Yes Delete file
POST /api/files/share Yes Share file with a user
GET /api/shares/pending Yes List pending incoming shares
POST /api/shares/accept/{id} Yes Accept a share
POST /api/shares/deny/{id} Yes Deny a share

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages