{"id":38343155,"url":"https://github.com/bencleary/uploader","last_synced_at":"2026-01-17T03:00:58.580Z","repository":{"id":194384316,"uuid":"686108905","full_name":"bencleary/uploader","owner":"bencleary","description":"A small service that handles image uploads for an imaginary chat application.","archived":false,"fork":false,"pushed_at":"2025-12-31T14:53:32.000Z","size":16460,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-03T10:23:23.309Z","etag":null,"topics":["chat","filesharing","uploads"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bencleary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-01T19:08:58.000Z","updated_at":"2025-12-31T14:36:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"a7d9dcca-e41a-43c9-90b7-9d20afd87674","html_url":"https://github.com/bencleary/uploader","commit_stats":null,"previous_names":["bencleary/uploader"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bencleary/uploader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencleary%2Fuploader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencleary%2Fuploader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencleary%2Fuploader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencleary%2Fuploader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bencleary","download_url":"https://codeload.github.com/bencleary/uploader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencleary%2Fuploader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28492593,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T02:39:23.645Z","status":"ssl_error","status_checked_at":"2026-01-17T02:34:19.649Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chat","filesharing","uploads"],"created_at":"2026-01-17T03:00:43.953Z","updated_at":"2026-01-17T03:00:58.557Z","avatar_url":"https://github.com/bencleary.png","language":"Go","readme":"[![Go 1.21+](https://img.shields.io/badge/go-1.21+-00ADD8.svg)](https://go.dev/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n# File Upload Service (Go)\n\nA small service that handles image uploads for an imaginary chat application: it stores encrypted files, creates a resized original + a preview image, and records upload metadata for later retrieval.\n\nInspired by [Code Aesthetic’s](https://www.youtube.com/watch?v=J1f5b4vcxCQ) “file upload service” walkthrough (the video uses TypeScript; this project is the Go implementation).\n\n## Features\n\n- Upload images over HTTP\n- Resize originals (max width) + generate preview images\n- Encrypt stored files (AES-GCM)\n- Record metadata in SQLite for later downloads\n- Support for local filesystem or S3-compatible storage backends\n\n## Quickstart\n\n### Requirements\n\n- Go 1.21+\n- A C toolchain (required by `github.com/mattn/go-sqlite3`)\n\n### Run the server\n\n```bash\nmake server\n```\n\nThe server listens on `http://localhost:1323` and writes:\n\n- Metadata: `filer.sqlite`\n- Encrypted files: `temp/\u003cupload-uuid\u003e/...` (local storage) or S3 bucket (S3 storage)\n- Working files: `vault/\u003cvault-uuid\u003e/...` (temporary staging area)\n\n**Storage Backend:** By default, files are stored locally. To use S3-compatible storage (e.g., MinIO), set `UPLOADER_STORAGE=s3` and configure the S3 options. See `docs/LOCAL_S3.md` for details.\n\n### Upload a file\n\nThe API requires an `key` header. It must be **32 characters** (AES-256 key material) and pass validation.\n\n```bash\nKEY='0123456789abcdef0123456789abcdef'\ncurl -sS \\\n  -H \"key: ${KEY}\" \\\n  -F \"file=@./path/to/image.png\" \\\n  http://localhost:1323/file/upload\n```\n\nResponse shape:\n\n```json\n{\n  \"file_name\": \"example.png\",\n  \"preview_url\": \"http://localhost:1323/file/\u003cuid\u003e?preview=true\",\n  \"download_url\": \"http://localhost:1323/file/\u003cuid\u003e\",\n  \"uploaded_at\": \"2025-01-01T00:00:00Z\"\n}\n```\n\n### Download an original or preview\n\n```bash\nUID='\u003cuid-from-upload-response\u003e'\ncurl -sS -H \"key: ${KEY}\" \"http://localhost:1323/file/${UID}\" -o original.bin\ncurl -sS -H \"key: ${KEY}\" \"http://localhost:1323/file/${UID}?preview=true\" -o preview.bin\n```\n\n## API\n\n- `POST /file/upload` (multipart form field: `file`)\n- `GET /file/:uid` (query: `preview=true|false`)\n\nMore details: `docs/API.md`.\nLocal S3 setup (MinIO): `docs/LOCAL_S3.md`.\n\n## Project layout\n\n- Root package: interfaces and core types (`uploader.*`)\n- `internal/http`: Echo server + handlers\n- `internal/storage`: storage backends (local filesystem and S3-compatible)\n- `internal/encryption`: AES-GCM encryption provider\n- `internal/scaler` + `internal/preview`: image scaling + preview generation\n- `internal/db`: SQLite-backed filer (metadata store)\n\nArchitecture notes: `docs/ARCHITECTURE.md`.\n\n## Developer commands\n\n```bash\nmake test\nmake fmt\nmake ci\n```\n\n## Notes / assumptions\n\n- This service assumes authentication/authorization is handled elsewhere; the encryption key is provided per-request.\n- Only common image types are supported today (`image/png`, `image/jpeg`, `image/gif`).\n\n## Roadmap\n\n- [ ] Finish CLI (`cmd/cli`)\n- [x] Add S3 storage backend\n- [ ] Improve error responses + consistent JSON errors\n- [ ] Streaming encryption (avoid buffering whole files in memory)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbencleary%2Fuploader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbencleary%2Fuploader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbencleary%2Fuploader/lists"}