{"id":25871259,"url":"https://github.com/1w6ts/aws-secure-downloads-example","last_synced_at":"2026-04-10T07:09:09.886Z","repository":{"id":271306109,"uuid":"913024224","full_name":"1w6ts/aws-secure-downloads-example","owner":"1w6ts","description":"simple Next.js application that allows users to download files securely from Cloudflare R2 or AWS S3 using signed URLs","archived":false,"fork":false,"pushed_at":"2025-01-15T13:08:23.000Z","size":89,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-01T14:26:51.437Z","etag":null,"topics":["api","aws","backend","cloudflare","nextjs","r2","s3","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1w6ts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-01-06T21:57:30.000Z","updated_at":"2025-01-07T19:02:05.000Z","dependencies_parsed_at":"2025-01-06T23:18:47.751Z","dependency_job_id":"cc83bb1f-d4de-4169-805f-bd445dba7af4","html_url":"https://github.com/1w6ts/aws-secure-downloads-example","commit_stats":null,"previous_names":["jacobrozwadowski/aws-download-nextjs-app","1w6ts/aws-secure-downloads-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1w6ts%2Faws-secure-downloads-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1w6ts%2Faws-secure-downloads-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1w6ts%2Faws-secure-downloads-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1w6ts%2Faws-secure-downloads-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1w6ts","download_url":"https://codeload.github.com/1w6ts/aws-secure-downloads-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241470363,"owners_count":19968041,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["api","aws","backend","cloudflare","nextjs","r2","s3","typescript"],"created_at":"2025-03-02T06:45:02.082Z","updated_at":"2026-04-10T07:09:09.854Z","avatar_url":"https://github.com/1w6ts.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloudflare R2 / AWS File Downloader (Next.js)\n\nThis project is a simple Next.js application that allows users to download files securely from Cloudflare R2 or AWS S3 using signed URLs. It demonstrates how to integrate Cloudflare R2 with Next.js (App Router) to generate signed URLs for downloading large files. This solution works well for serving files that are stored privately in Cloudflare R2 without exposing them to the public directly.\n\n## Features\n\n- Generate **signed URLs** for files stored in Cloudflare R2.\n- **Secure** file download via temporary, time-limited URLs. (adjustable in the code)\n- Full integration with Next.js App router and API routes.\n- TypeScript support for type safety.\n- Easy-to-implement frontend with dynamic file download.\n\n## Prerequisites\n\nBefore running the project locally, ensure you have the following prerequisites:\n\n- **Node.js** (version 20 or higher)\n- **Cloudflare R2 / AWS S3** account and access keys\n- **Git** to clone the repository\n\n## Cloudflare R2 Setup\n\n1. **Create a R2 Bucket**:\n\n- Go to the Cloudflare dashboard.\n- Create an R2 bucket to store your files.\n- Generate access keys (Access Key ID \u0026 Secret Access Key)\n\n2. **Environment Variables:** Create a `.env.local` file at the root of your project and add the following environment variables (replace with your actual values):\n\n```\nR2_ACCESS_KEY=your_r2_access_key\nR2_SECRET_KEY=your_r2_secret_key\nR2_BUCKET_NAME=your_bucket_name\nR2_ENDPOINT=your_r2_uri\n```\n\n# Getting Started\n\n## Clone the Repository\n\nStart by cloning the repository to your local machine.\n\n```\ngit clone https://github.com/jacobrozwadowski/aws-download-nextjs-app.git\ncd aws-download-nextjs-app\n```\n\n## Install Dependencies\n\nInstall the required dependencies using npm:\n\n```\nnpm install\n```\n\n## Run the development server\n\nOnce dependencies are installed, you can start the development server:\n\n```\nnpm run dev\n```\n\nThis will start the server on http://localhost:3000.\n\n# How it works\n\nThis project is structured as follows:\n\n- **API Route** (`/api/getsignedurl`): This API route generates a signed URL for downloading a file securely whilst it being private from R2 or S3. The url is valid for a limited time (5 minutes by default).\n- **Frontend** (`download-button.tsx`): A React component that triggers the download by fetching the signed URL and initiating the download in the browser.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1w6ts%2Faws-secure-downloads-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1w6ts%2Faws-secure-downloads-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1w6ts%2Faws-secure-downloads-example/lists"}